From 3fc2c8d0c8c4a3c839fc12abad94ca83f4d21870 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 22 Apr 2023 12:07:54 +0200 Subject: Feat(flake): Modularize --- flake/nixosConfigurations/default.nix | 108 ++++++---------------------------- 1 file changed, 17 insertions(+), 91 deletions(-) (limited to 'flake/nixosConfigurations') 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 -- cgit 1.4.1