Flakes: Difference between revisions
imported>Malteneuss m Show how to use unfree packages with two or more channels |
imported>Alyaeanyx Add information about specialArgs |
||
| Line 244: | Line 244: | ||
}; | }; | ||
}; | }; | ||
} | |||
</syntaxHighlight> | |||
If you want to pass on the flake inputs to external configuration files, you can use the <code>specialArgs</code> attribute: | |||
<syntaxHighlight lang=nix> | |||
{ | |||
inputs.nixpkgs.url = github:NixOS/nixpkgs; | |||
inputs.home-manager.url = github:nix-community/home-manager; | |||
outputs = { self, nixpkgs, ... }@attrs: { | |||
nixosConfigurations.fnord = nixpkgs.lib.nixosSystem { | |||
system = "x86_64-linux"; | |||
specialArgs = attrs; | |||
modules = [ ./configuration.nix ]; | |||
}; | |||
}; | |||
} | |||
</syntaxHighlight> | |||
Then, you can access the flake inputs from the file <code>configuration.nix</code> like this: | |||
<syntaxHighlight lang=nix> | |||
{ config, lib, nixpkgs, home-manager, ... }: { | |||
# do something with home-manager here, for instance: | |||
imports = [ home-manager.nixosModule ]; | |||
... | |||
} | } | ||
</syntaxHighlight> | </syntaxHighlight> | ||