diff options
author | Soispha <soispha@vhack.eu> | 2023-04-22 12:07:54 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-05-09 19:31:20 +0200 |
commit | 3fc2c8d0c8c4a3c839fc12abad94ca83f4d21870 (patch) | |
tree | c0172a350b9f4bb0e3448b3f20c228c1403dbe0d /flake/nixosConfigurations/default.nix | |
parent | Fix(hosts): Rename spawn to marduk to comply with scheme (diff) | |
download | nixos-config-3fc2c8d0c8c4a3c839fc12abad94ca83f4d21870.tar.gz nixos-config-3fc2c8d0c8c4a3c839fc12abad94ca83f4d21870.zip |
Feat(flake): Modularize
Diffstat (limited to 'flake/nixosConfigurations/default.nix')
-rw-r--r-- | flake/nixosConfigurations/default.nix | 108 |
1 files changed, 17 insertions, 91 deletions
diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix index 173882b7..0698da76 100644 --- a/flake/nixosConfigurations/default.nix +++ b/flake/nixosConfigurations/default.nix @@ -4,6 +4,9 @@ pkgs, nixpkgs, sysLib, + # configs + defaultModules, + defaultSpecialArgs, # bins video_pause, yambar_cpu, @@ -23,96 +26,19 @@ agenix, ... }: let - homeManagerConfig = { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.soispha = import ../../home-manager; - extraSpecialArgs = { - inherit - pkgs - sysLib - # extra information - - system - # bins - - video_pause - yambar_cpu - yambar_memory - strip_js_comments - river_init_lesser - grades - shell-library - # external deps - - user_js - neovim_config - snap-sync - # modules - - impermanence - ; - }; + generateHost = name: { + name = "${name}"; + value = nixpkgs.lib.nixosSystem { + inherit system pkgs; + specialArgs = defaultSpecialArgs; + modules = + [ + ../../hosts/${name} + ] + ++ defaultModules; }; }; - ageConfig = import ../../secrets; - impermanenceConfig = import ../../system/impermanence; - defaultModules = [ - agenix.nixosModules.default - ageConfig - - home-manager.nixosModules.home-manager - - homeManagerConfig - - impermanence.nixosModules.impermanence - impermanenceConfig - ]; - defaultSpecialArgs = { - nixpkgs-as-input = nixpkgs; - inherit templates sysLib; - }; -in { - tiamat = nixpkgs.lib.nixosSystem { - inherit system pkgs; - specialArgs = defaultSpecialArgs; - modules = - [ - ../../hosts/tiamat/configuration.nix - ] - ++ defaultModules; - }; - - mammun = nixpkgs.lib.nixosSystem { - inherit system pkgs; - specialArgs = defaultSpecialArgs; - modules = - [ - ../../hosts/mammun/configuration.nix - ] - ++ defaultModules; - }; - lahmu = nixpkgs.lib.nixosSystem { - inherit system pkgs; - specialArgs = defaultSpecialArgs; - modules = - [ - ../../hosts/lahmu/configuration.nix - ] - ++ defaultModules; - }; - apzu = nixpkgs.lib.nixosSystem { - inherit system pkgs; - specialArgs = defaultSpecialArgs; - modules = - [ - ../../hosts/apzu/configuration.nix - ] - ++ defaultModules; - }; - spawn = nixpkgs.lib.nixosSystem { - specialArgs = defaultSpecialArgs; - modules = [../../hosts/spawn/configuration.nix]; - }; -} + hosts = ["tiamat" "mammun" "apzu" "lahmu"]; + generatedHosts = builtins.listToAttrs (builtins.map generateHost hosts); +in + generatedHosts |