Flakes: Difference between revisions
imported>Asymmetric m --update-input argument was moved to lock subcommand |
imported>Das-g m fix markup (MediaWiki syntax is needed here instead of Markdown) |
||
Line 55: | Line 55: | ||
=== Non-NixOS === | === Non-NixOS === | ||
On non-nixos systems, install | On non-nixos systems, install <code>nixUnstable</code> in your environment: | ||
<syntaxHighlight lang=console> | <syntaxHighlight lang=console> | ||
Line 353: | Line 353: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Otherwise it's also possible to set the | Otherwise it's also possible to set the <code>nix develop</code> bash prompt system wide using the [https://nixos.org/manual/nix/unstable/command-ref/conf-file.html nix.conf option bash-prompt]. (On nixos I think it is set in <code>nix.extraOptions</code>) | ||
== Pushing Flake inputs to Cachix == | == Pushing Flake inputs to Cachix == | ||
Line 394: | Line 394: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
== Getting | == Getting ''Instant'' System Flakes Repl == | ||
How to get a nix repl out of your current flake: | How to get a nix repl out of your current flake: | ||
Line 407: | Line 407: | ||
<syntaxHighlight>nix.nixPath = let path = toString ./.; in [ "repl=${path}/repl.nix" "nixpkgs=${inputs.nixpkgs}" ];</syntaxHighlight> | <syntaxHighlight>nix.nixPath = let path = toString ./.; in [ "repl=${path}/repl.nix" "nixpkgs=${inputs.nixpkgs}" ];</syntaxHighlight> | ||
In their system | In their system <code>flake.nix</code> configuration file, and includes the following file in their root directory flake as <code>repl.nix</code>: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
Line 422: | Line 422: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
(Don't forget to | (Don't forget to <code>git add repl.nix && nixos-rebuild switch --flake "/etc/nixos"</code>) | ||
Then one can run (or bind a shell alias): | Then one can run (or bind a shell alias): | ||
Line 428: | Line 428: | ||
source /etc/set-environment && nix repl $(echo $NIX_PATH | perl -pe 's|.*(/nix/store/.*-source/repl.nix).*|\1|')</syntaxHighlight> | source /etc/set-environment && nix repl $(echo $NIX_PATH | perl -pe 's|.*(/nix/store/.*-source/repl.nix).*|\1|')</syntaxHighlight> | ||
This will launch a repl with access to | This will launch a repl with access to <code>nixpkgs</code>, <code>lib</code>, and the <code>flake</code> options in a split of a second. | ||
== Enable unfree software == | == Enable unfree software == |