Next: (maak shell), Previous: (maak main), Up: API
Nix helpers, mirroring the Guix ones in ‘(maak dsl)’. maak is Guix-first, but a task that has to build on a Nix machine should not have to hand-roll ‘nix-shell’ or ‘nix develop’ invocations either.
The two families are deliberately separate: ‘nix-shell’ and ‘nix-build’ are the classic, ‘shell.nix’/‘default.nix’ based commands, while ‘nix-develop’, ‘nix-flake-build’ and ‘nix-run’ are the flake based ones. ‘nix-flake-check’ validates a flake the way ‘guix build’ would validate a package.
Every helper here builds one command line and hands it to ‘$’, so all of them take the same five decorations: ‘#:env’, ‘#:sudo?’, ‘#:dev-null?’, ‘#:allow-failure?’ and ‘#:async?’. See ‘$’ in ‘(maak dsl)’ for what each does, and note that ‘#:env’ is what makes ‘nix-shell –run’ or ‘nix develop –command’ see the variables a build needs.
Build the derivation in FILE with the classic ‘nix-build’.
ARGUMENTS are extra words passed through verbatim, for example ‘–argstr system x86_64-linux’. OUT-LINK names the result symlink (‘–out-link’), defaulting to Nix’s own ‘result’.
Run CMD-PARTS inside the development shell of the flake FLAKE.
FLAKE is a path or flake reference such as ‘.‘ or ‘github:owner/repo’. With IMPURE? the shell inherits the host environment (‘–impure’), which some tools that read environment variables need.
(nix-develop '("make test") #:flake ".")
Build the flake FLAKE, optionally selecting the output ATTR.
(nix-flake-build #:flake "." #:attr "packages.x86_64-linux.maak")
Check every output of the flake FLAKE, as ‘nix flake check’ does.
With ALL-SYSTEMS? the check runs for all systems the flake declares rather than just the current one.
Run the application APP of the flake FLAKE with CMD-PARTS as its arguments.
(nix-run '("--version") #:flake "." #:app "maak")
Run CMD-PARTS inside a Nix shell.
With FILE the shell is described by that file (typically ‘shell.nix’); without it, Nix looks for ‘shell.nix’ or ‘default.nix’ in the current directory. Each of PACKAGES is added with ‘-p’, and PURE? passes ‘–pure’ so the host environment is hidden.
The command is handed to Nix’s own ‘–run’, so it executes inside the shell rather than after it.
(nix-shell '("python -c 'print(1)'") #:packages '("python3"))
Next: (maak shell), Previous: (maak main), Up: API