diff --git a/flake.nix b/flake.nix index 9688c4b..1000b92 100644 --- a/flake.nix +++ b/flake.nix @@ -36,11 +36,6 @@ sops-nix, }@inputs: let - homeRoles = [ - "desktop" - "minimal" - "server" - ]; outputs = inputs.self; overlays = [ apple-silicon.overlays.apple-silicon-overlay @@ -74,23 +69,35 @@ }; }; homeManagerModules = import ./modules/home-manager; - homeConfigurations = nixpkgs.lib.foldl' (c: e: - c // { - "irl-${e.role}-${e.system}" = home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { - inherit overlays; - system = e.system; - }; - extraSpecialArgs = { - inherit outputs; - }; - modules = [ - ./home-manager/irl.nix - { role = "${e.role}"; } - ]; - }; + homeConfigurations = + { + role = [ + "desktop" + "minimal" + "server" + ]; + system = supportedSystems; } - ) { } (nixpkgs.lib.cartesianProduct { role = homeRoles; system = supportedSystems; }); + |> nixpkgs.lib.cartesianProduct + |> nixpkgs.lib.foldl' ( + c: e: + c + // { + "irl-${e.role}-${e.system}" = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + inherit overlays; + system = e.system; + }; + extraSpecialArgs = { + inherit outputs; + }; + modules = [ + ./home-manager/irl.nix + { role = "${e.role}"; } + ]; + }; + } + ) { }; } // flake-utils.lib.eachSystem supportedSystems (system: { formatter = nixpkgs.legacyPackages.${system}.nixfmt-tree; diff --git a/home-manager/irl.nix b/home-manager/irl.nix index 4e31fe9..5447f03 100644 --- a/home-manager/irl.nix +++ b/home-manager/irl.nix @@ -11,26 +11,48 @@ options.role = lib.mkOption { description = "Home role to set up"; default = "minimal"; - type = with lib.types; enum ["desktop" "minimal" "server"]; + type = + with lib.types; + enum [ + "desktop" + "minimal" + "server" + ]; }; config = { - feature.cli.enable = builtins.elem config.role ["desktop" "minimal" "server"]; + feature.cli.enable = builtins.elem config.role [ + "desktop" + "minimal" + "server" + ]; feature.firefox.enable = config.role == "desktop"; - feature.git.enable = builtins.elem config.role ["desktop" "server"]; + feature.git.enable = builtins.elem config.role [ + "desktop" + "server" + ]; feature.ops.enable = config.role == "desktop"; - feature.tmux.enable = builtins.elem config.role ["desktop" "server"]; - feature.vim.enable = builtins.elem config.role ["desktop" "minimal" "server"]; + feature.tmux.enable = builtins.elem config.role [ + "desktop" + "server" + ]; + feature.vim.enable = builtins.elem config.role [ + "desktop" + "minimal" + "server" + ]; home.username = "irl"; home.homeDirectory = if lib.strings.hasSuffix "darwin" pkgs.system then "/Users/irl" else "/home/irl"; + home.file.".config/nix/nix.conf".text = '' + experimental-features = nix-command flakes pipe-operators + ''; home.packages = with pkgs; [ neofetch ]; home.shellAliases = { - hms = - "home-manager switch --flake ~/.config/nix-configs#irl-${config.role}-${pkgs.system}"; + hms = "home-manager switch --flake ~/.config/nix-configs#irl-${config.role}-${pkgs.system}"; drs = "sudo darwin-rebuild switch --flake ~/.config/nix-configs"; }; home.stateVersion = "25.05";