avoid repeating code and add common modules in function

This commit is contained in:
Anthony Rodriguez 2024-08-25 22:58:58 +02:00
parent 1f69c17ae2
commit 0ec0ecec20
Signed by: nezia
GPG key ID: EE3BE97C040A86CE

View file

@ -23,15 +23,9 @@
outputs = { nixpkgs, home-manager, nixvim, sops-nix, shells, ... }@inputs: outputs = { nixpkgs, home-manager, nixvim, sops-nix, shells, ... }@inputs:
let let
username = "nezia"; username = "nezia";
in {
nixosConfigurations = {
vamos =
let hostname = "vamos";
in nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ commonModules = hostname: [
./hosts/${hostname} ./hosts/${hostname}
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -39,29 +33,27 @@
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.sharedModules = [ nixvim.homeManagerModules.nixvim ]; home-manager.sharedModules = [ nixvim.homeManagerModules.nixvim ];
home-manager.users.nezia = import ./home/laptop;
home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.extraSpecialArgs = { inherit inputs; };
} }
{ _module.args = { inherit hostname username; }; } { _module.args = { inherit hostname username; }; }
]; ];
in {
nixosConfigurations = {
vamos =
let hostname = "vamos";
in nixpkgs.lib.nixosSystem {
system = system;
modules = commonModules hostname ++ [
{ home-manager.users.nezia = import ./home/laptop; }
];
}; };
solaire = let solaire = let
hostname = "solaire"; hostname = "solaire";
in nixpkgs.lib.nixosSystem { in nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = system;
modules = [ modules = commonModules hostname ++ [
./hosts/${hostname} { home-manager.users.nezia = import ./home/desktop; }
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [ nixvim.homeManagerModules.nixvim ];
home-manager.users.nezia = import ./home/desktop;
home-manager.extraSpecialArgs = { inherit inputs; };
}
{ _module.args = { inherit hostname username; }; }
]; ];
}; };
}; };