summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2024-02-03 19:53:32 -0500
committerseth <[email protected]>2024-02-03 20:47:55 -0500
commit1ac587856745cddb0f9be4441da57568bb8825b8 (patch)
tree30642cbe409c7bc451b099a0cd9a3049b9d1ce29
parentaf233733f2c7b0b4422cd5c480caeeb1743c017b (diff)
flakeModules/configurations: add global modules
-rw-r--r--configs.nix31
-rw-r--r--modules/flake/configurations.nix43
2 files changed, 45 insertions, 29 deletions
diff --git a/configs.nix b/configs.nix
index a75c7e0..de3cec7 100644
--- a/configs.nix
+++ b/configs.nix
@@ -10,15 +10,6 @@
(lib.attrValues self."${type}Modules")
extra
];
-
- nixosModules = mkModulesFor "nixos" [
- inputs.agenix.nixosModules.default
- inputs.hm.nixosModules.home-manager
- ];
-
- darwinModules = mkModulesFor "darwin" [
- inputs.hm.darwinModules.home-manager
- ];
in {
imports = [
./systems/deploy.nix
@@ -38,19 +29,19 @@ in {
nixos = {
builder = inputs.nixpkgs.lib.nixosSystem;
+ modules = mkModulesFor "nixos" [
+ inputs.agenix.nixosModules.default
+ inputs.hm.nixosModules.home-manager
+ ];
+
systems = {
- glados = {
- modules = nixosModules;
- };
+ glados = {};
- glados-wsl = {
- modules = nixosModules;
- };
+ glados-wsl = {};
atlas = {
builder = inputs.nixpkgs-stable.lib.nixosSystem;
system = "aarch64-linux";
- modules = nixosModules;
};
};
};
@@ -58,10 +49,12 @@ in {
darwin = {
builder = inputs.darwin.lib.darwinSystem;
+ modules = mkModulesFor "darwin" [
+ inputs.hm.darwinModules.home-manager
+ ];
+
systems = {
- caroline = {
- modules = darwinModules;
- };
+ caroline = {};
};
};
};
diff --git a/modules/flake/configurations.nix b/modules/flake/configurations.nix
index 314e85f..04bcf5a 100644
--- a/modules/flake/configurations.nix
+++ b/modules/flake/configurations.nix
@@ -39,16 +39,20 @@
mkSystem = type: name: let
args = cfg.${type}.systems.${name};
in
- args.builder (
- (removeAttrs args ["builder"])
- // {
- modules = args.modules ++ [../../systems/${name} {networking.hostName = name;}];
- specialArgs = {
- inherit inputs;
- secretsDir = ../../secrets/${name};
- };
- }
- );
+ args.builder (lib.recursiveUpdate (removeAttrs args ["builder"]) {
+ modules =
+ [
+ ../../systems/${name}
+ {networking.hostName = name;}
+ ]
+ ++ cfg.${type}.modules
+ ++ args.modules;
+
+ specialArgs = {
+ inherit inputs;
+ secretsDir = ../../secrets/${name};
+ };
+ });
mkUser = name: let
args = cfg.home.users.${name};
@@ -65,6 +69,7 @@
programs.home-manager.enable = true;
}
]
+ ++ cfg.home.modules
++ args.modules;
extraSpecialArgs = {inherit inputs;};
@@ -144,6 +149,15 @@
'';
};
+ modules = mkOption {
+ type = modulesType;
+ default = [];
+ example = literalExpression "[ self.${type}Modules.default ]";
+ description = mdDoc ''
+ List of modules to add to all ${type}Configurations
+ '';
+ };
+
systems = mkOption {
type = types.attrsOf (types.submodule (systemsSubmodule type));
default = {};
@@ -172,6 +186,15 @@ in {
'';
};
+ modules = mkOption {
+ type = modulesType;
+ default = [];
+ example = literalExpression "[ self.homeModules.default ]";
+ description = mdDoc ''
+ List of modules to add to all homeConfigurations
+ '';
+ };
+
pkgs = mkOption {
type = pkgsType;
example = literalExpression "inputs.nixpkgs.legacyPackages.aarch64-linux";