example refactor snowflake module system
This commit is contained in:
parent
0314109bc0
commit
3e29615db9
26 changed files with 1306 additions and 165 deletions
36
nix/snow/flake/modules/nixosConfigurations.nix
Normal file
36
nix/snow/flake/modules/nixosConfigurations.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
literalExpression
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake.nixosConfigurations = mkOption {
|
||||
type = types.lazyAttrsOf types.raw;
|
||||
default = { };
|
||||
description = ''
|
||||
Instantiated NixOS configurations. Used by `nixos-rebuild`.
|
||||
|
||||
`nixosConfigurations` is for specific machines. If you want to expose
|
||||
reusable configurations, add them to [`nixosModules`](#opt-flake.nixosModules)
|
||||
in the form of modules (no `lib.nixosSystem`), so that you can reference
|
||||
them in this or another flake's `nixosConfigurations`.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
my-machine = inputs.nixpkgs.lib.nixosSystem {
|
||||
# system is not needed with freshly generated hardware-configuration.nix
|
||||
# system = "x86_64-linux"; # or set nixpkgs.hostPlatform in a module.
|
||||
modules = [
|
||||
./my-machine/nixos-configuration.nix
|
||||
config.nixosModules.my-module
|
||||
];
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue