2023-05-29 17:52:03 +00:00
|
|
|
{ lib, flake-parts-lib, ... }:
|
2022-05-17 08:56:41 +00:00
|
|
|
let
|
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
types
|
|
|
|
literalExpression
|
|
|
|
;
|
2022-05-25 14:36:33 +00:00
|
|
|
inherit (flake-parts-lib)
|
2022-05-17 08:56:41 +00:00
|
|
|
mkSubmoduleOptions
|
|
|
|
;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
flake = mkSubmoduleOptions {
|
|
|
|
nixosConfigurations = mkOption {
|
|
|
|
type = types.lazyAttrsOf types.raw;
|
|
|
|
default = { };
|
2022-11-11 06:39:25 +00:00
|
|
|
description = ''
|
2022-11-11 05:40:37 +00:00
|
|
|
Instantiated NixOS configurations. Used by `nixos-rebuild`.
|
2023-01-26 19:33:50 +00:00
|
|
|
|
|
|
|
`nixosConfigurations` is for specific machines. If you want to expose
|
2023-01-26 22:10:40 +00:00
|
|
|
reusable configurations, add them to [`nixosModules`](#opt-flake.nixosModules)
|
2023-01-26 19:33:50 +00:00
|
|
|
in the form of modules (no `lib.nixosSystem`), so that you can reference
|
|
|
|
them in this or another flake's `nixosConfigurations`.
|
2022-05-17 08:56:41 +00:00
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
my-machine = inputs.nixpkgs.lib.nixosSystem {
|
2023-01-26 19:33:50 +00:00
|
|
|
# system is not needed with freshly generated hardware-configuration.nix
|
|
|
|
# system = "x86_64-linux"; # or set nixpkgs.hostPlatform in a module.
|
2022-05-17 08:56:41 +00:00
|
|
|
modules = [
|
|
|
|
./my-machine/nixos-configuration.nix
|
2022-11-11 05:40:37 +00:00
|
|
|
config.nixosModules.my-module
|
2022-05-17 08:56:41 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|