refactor: modified mkSystem and default configs to remove duplication
This commit is contained in:
parent
94c6491bdb
commit
5801291520
2 changed files with 31 additions and 41 deletions
|
|
@ -6,10 +6,6 @@
|
||||||
inherit (inputs.home-manager.lib) homeManagerConfiguration;
|
inherit (inputs.home-manager.lib) homeManagerConfiguration;
|
||||||
secrets = builtins.fromJSON (builtins.readFile "${self}/secrets/crypt/secrets.json");
|
secrets = builtins.fromJSON (builtins.readFile "${self}/secrets/crypt/secrets.json");
|
||||||
|
|
||||||
specialArgs = hostName: {
|
|
||||||
inherit inputs self secrets hostName;
|
|
||||||
};
|
|
||||||
|
|
||||||
homeImports = {
|
homeImports = {
|
||||||
"c4patino@arisu" = [../. ./arisu];
|
"c4patino@arisu" = [../. ./arisu];
|
||||||
"c4patino@chibi" = [../. ./chibi];
|
"c4patino@chibi" = [../. ./chibi];
|
||||||
|
|
@ -17,33 +13,36 @@
|
||||||
"c4patino@shiori" = [../. ./shiori];
|
"c4patino@shiori" = [../. ./shiori];
|
||||||
"nixos@hikari" = [../. ./hikari];
|
"nixos@hikari" = [../. ./hikari];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
specialArgs = hostName: {
|
||||||
|
inherit inputs self secrets hostName;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkHomeManager = {
|
||||||
|
hostname,
|
||||||
|
username ? "c4patino",
|
||||||
|
system ? "x86_64-linux",
|
||||||
|
}:
|
||||||
|
homeManagerConfiguration {
|
||||||
|
modules = homeImports."${username}@${hostname}";
|
||||||
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
|
extraSpecialArgs = specialArgs hostname;
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
_module.args = {inherit homeImports;};
|
_module.args = {inherit homeImports;};
|
||||||
flake.homeConfigurations = {
|
flake.homeConfigurations = {
|
||||||
"c4patino@arisu" = homeManagerConfiguration {
|
"c4patino@arisu" = mkHomeManager {hostname = "arisu";};
|
||||||
modules = homeImports."c4patino@arisu";
|
"c4patino@kokoro" = mkHomeManager {hostname = "kokoro";};
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
"c4patino@shiori" = mkHomeManager {hostname = "shiori";};
|
||||||
extraSpecialArgs = specialArgs "arisu";
|
|
||||||
|
"c4patino@chibi" = mkHomeManager {
|
||||||
|
hostname = "chibi";
|
||||||
|
system = "aarch64-linux";
|
||||||
};
|
};
|
||||||
"c4patino@kokoro" = homeManagerConfiguration {
|
|
||||||
modules = homeImports."c4patino@kokoro";
|
"nixos@hikari" = mkHomeManager {
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
hostname = "hikari";
|
||||||
extraSpecialArgs = specialArgs "kokoro";
|
username = "nixos";
|
||||||
};
|
|
||||||
"c4patino@chibi" = homeManagerConfiguration {
|
|
||||||
modules = homeImports."c4patino@chibi";
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.aarch64-linux;
|
|
||||||
extraSpecialArgs = specialArgs "chibi";
|
|
||||||
};
|
|
||||||
"c4patino@shiori" = homeManagerConfiguration {
|
|
||||||
modules = homeImports."c4patino@shiori";
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
extraSpecialArgs = specialArgs "shiori";
|
|
||||||
};
|
|
||||||
"nixos@hikari" = homeManagerConfiguration {
|
|
||||||
modules = homeImports."nixos@hikari";
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
extraSpecialArgs = specialArgs "hikari";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
mkSystem = {
|
mkSystem = {
|
||||||
hostname,
|
hostname,
|
||||||
system,
|
|
||||||
username ? "c4patino",
|
username ? "c4patino",
|
||||||
|
system ? "x86_64-linux",
|
||||||
}:
|
}:
|
||||||
nixosSystem {
|
nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
@ -38,26 +38,17 @@
|
||||||
modules = [../. ./${hostname}] ++ homeManager {inherit hostname username;};
|
modules = [../. ./${hostname}] ++ homeManager {inherit hostname username;};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
arisu = mkSystem {
|
arisu = mkSystem {hostname = "arisu";};
|
||||||
hostname = "arisu";
|
kokoro = mkSystem {hostname = "kokoro";};
|
||||||
system = "x86_64-linux";
|
shiori = mkSystem {hostname = "shiori";};
|
||||||
};
|
|
||||||
kokoro = mkSystem {
|
|
||||||
hostname = "kokoro";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
};
|
|
||||||
chibi = mkSystem {
|
chibi = mkSystem {
|
||||||
hostname = "chibi";
|
hostname = "chibi";
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
};
|
};
|
||||||
shiori = mkSystem {
|
|
||||||
hostname = "shiori";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
};
|
|
||||||
|
|
||||||
hikari = mkSystem {
|
hikari = mkSystem {
|
||||||
hostname = "hikari";
|
hostname = "hikari";
|
||||||
system = "x86_64-linux";
|
|
||||||
username = "nixos";
|
username = "nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue