flake.nix: specify modules and extra config per nixos config

This commit is contained in:
Oystein Kristoffer Tveit 2024-06-29 13:48:06 +02:00
parent 34f127c9a1
commit 6a2057f531
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 63 additions and 54 deletions

117
flake.nix
View File

@ -162,66 +162,75 @@
}; };
nixosConfigurations = let nixosConfigurations = let
nixSys = name: nixSys = name: extraConfig:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem
inherit system; ({
inherit pkgs; inherit system;
inherit (pkgs) lib; inherit pkgs;
modules = [ inherit (pkgs) lib;
"${home-manager}/nixos"
./modules/machineVars.nix
./modules/socketActivation.nix
./hosts/common
./hosts/${name}/configuration.nix
matrix-synapse-next.nixosModules.default specialArgs = {
osuchan.outputs.nixosModules.default inherit inputs;
secrets.outputs.nixos-config inherit unstable-pkgs;
sops-nix.nixosModules.sops inherit (self) extendedLib;
vscode-server.nixosModules.default secrets = secrets.outputs.settings;
maunium-stickerpicker.nixosModules.default } // (extraConfig.specialArgs or { });
(args: import minecraft.outputs.nixosModules.minecraft-servers (args // { modules = [
pkgs = unstable-pkgs; "${home-manager}/nixos"
lib = unstable-pkgs.lib;
}))
{ ./hosts/common
config._module.args = { ./hosts/${name}/configuration.nix
inherit inputs;
inherit unstable-pkgs;
inherit (self) extendedLib;
secrets = secrets.outputs.settings;
};
}
({ config, ... }: ./modules/machineVars.nix
{ ./modules/socketActivation.nix
home-manager = {
useGlobalPkgs = true; secrets.outputs.nixos-config
extraSpecialArgs = { sops-nix.nixosModules.sops
inherit inputs;
inherit (self) extendedLib; ({ config, ... }:
inherit (config) machineVars; {
hostname = name; home-manager = {
secrets = secrets.outputs.settings; useGlobalPkgs = true;
extraSpecialArgs = {
inherit inputs;
inherit (self) extendedLib;
inherit (config) machineVars;
hostname = name;
secrets = secrets.outputs.settings;
};
sharedModules = [
inputs.sops-nix.homeManagerModules.sops
];
users.h7x4.imports = [ ./home/home.nix ];
}; };
})
sharedModules = [ ] ++ (extraConfig.modules or [ ]);
inputs.sops-nix.homeManagerModules.sops }
]; //
(builtins.removeAttrs extraConfig [
users.h7x4 = { "modules"
imports = [ ./home/home.nix ]; "specialArgs"
}; ]));
};
})
];
};
in { in {
tsuki = nixSys "tsuki"; dosei = nixSys "dosei" { };
kasei = nixSys "kasei"; kasei = nixSys "kasei" { };
dosei = nixSys "dosei"; tsuki = nixSys "tsuki" {
modules = [
matrix-synapse-next.nixosModules.default
osuchan.outputs.nixosModules.default
sops-nix.nixosModules.sops
vscode-server.nixosModules.default
maunium-stickerpicker.nixosModules.default
(args: import minecraft.outputs.nixosModules.minecraft-servers (args // {
pkgs = unstable-pkgs;
lib = unstable-pkgs.lib;
}))
];
};
}; };
}; };
} }