system-manager/nix/modules/system-manager.nix
2023-02-15 15:12:39 +01:00

37 lines
805 B
Nix

{ lib
, pkgs
, config
, ...
}:
{
options.system-manager = {
services = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
};
etcFiles = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
};
};
config = {
# Avoid some standard NixOS assertions
boot = {
loader.grub.enable = false;
initrd.enable = false;
};
system.stateVersion = lib.mkDefault lib.trivial.release;
assertions = lib.flip map config.system-manager.etcFiles (entry:
{
assertion = lib.hasAttr entry config.environment.etc;
message = lib.concatStringsSep " " [
"The entry ${entry} that was passed to system-manager.etcFiles"
"is not present in environment.etc"
];
}
);
};
}