1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-23 08:02:21 +03:00

darwin: relocate nixos-only defs out of globalDefaults module

most of the `globalDefaults` module's definitions are not present in
nix-darwin, so they need to move into nixos-specific modules.

at this time, darwin does not yet have its own host-type-specific
defaults module, but there are probably some defs worth adding to such a
module.
This commit is contained in:
Chris Montgomery 2022-01-24 00:42:44 -05:00 committed by Chris Montgomery
parent 1c977a3cb5
commit 223920bf00
No known key found for this signature in database
GPG Key ID: A6BA9BA2FDA7C997
2 changed files with 15 additions and 11 deletions

View File

@ -47,11 +47,11 @@ let
# arguments in our channels api that shouldn't be passed to fup
"overlays"
];
# evalArgs sets channelName and system to null by default
# but for proper default handling in fup, null args have to be removed
stripNull = args: (lib.filterAttrs (_: arg: arg != null) args);
stripHost = args: removeAttrs (stripNull args) [
# arguments in our hosts/hostDefaults api that shouldn't be passed to fup
"externalModules" # TODO: remove deprecated option
@ -64,9 +64,12 @@ let
system = "x86_64-linux";
output = "nixosConfigurations";
# add `self` & `inputs` as specialargs so their libs can be used in imports
# add `self` & `inputs` as specialArgs so their libs can be used in imports
specialArgs = config.nixos.importables // { inherit (config) self inputs; };
modules = config.nixos.hostDefaults.exportedModules ++ defaultHostModules;
modules = config.nixos.hostDefaults.exportedModules ++ defaultHostModules ++ [
internal-modules.nixosDefaults
];
}
(stripNull config.nixos.hostDefaults);
nixosHosts = lib.mapAttrs
@ -84,7 +87,7 @@ let
output = "darwinConfigurations";
builder = darwin.lib.darwinSystem;
# add `self` & `inputs` as specialargs so their libs can be used in imports
# add `self` & `inputs` as specialArgs so their libs can be used in imports
specialArgs = config.darwin.importables // { inherit (config) self inputs; };
modules = config.darwin.hostDefaults.exportedModules ++ defaultHostModules;
}

View File

@ -17,10 +17,6 @@
globalDefaults = { hmUsers }:
{ config, pkgs, self, ... }: {
users.mutableUsers = lib.mkDefault false;
hardware.enableRedistributableFirmware = lib.mkDefault true;
# digga lib can be accessed in modules directly as config.lib.digga
lib = {
inherit (pkgs.lib) digga;
@ -33,7 +29,12 @@
`self.nixosConfigurations`, with the `self` module argument.
'';
};
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
};
nixosDefaults = { self, ... }: {
users.mutableUsers = lib.mkDefault false;
hardware.enableRedistributableFirmware = lib.mkDefault true;
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
};
}