diff options
| -rw-r--r-- | hosts/profiles.nix | 21 | ||||
| -rw-r--r-- | modules/nixos/base/nix.nix | 14 |
2 files changed, 17 insertions, 18 deletions
diff --git a/hosts/profiles.nix b/hosts/profiles.nix index 149c69f..390e793 100644 --- a/hosts/profiles.nix +++ b/hosts/profiles.nix @@ -9,10 +9,12 @@ }; nix = { - registry = with inputs; { - getchoo.flake = getchoo; - nixpkgs.flake = nixpkgs; - }; + registry = + { + n.flake = inputs.nixpkgs; + } + // (builtins.mapAttrs (_: flake: {inherit flake;}) + (inputs.nixpkgs.lib.filterAttrs (n: _: n != "nixpkgs") inputs)); settings = { trusted-substituters = [ @@ -29,10 +31,13 @@ }; }; }; + + specialArgs = inputs // {inherit inputs;}; in { personal = { system = "x86_64-linux"; builder = inputs.nixpkgs.lib.nixosSystem; + inherit specialArgs; modules = with inputs; [ common @@ -58,12 +63,11 @@ in { system.stateVersion = "23.11"; } ]; - - specialArgs = inputs; }; personal-darwin = { builder = inputs.darwin.lib.darwinSystem; + inherit specialArgs; modules = with inputs; [ common home-manager.darwinModules.home-manager @@ -79,12 +83,11 @@ in { system.stateVersion = 4; } ]; - - specialArgs = inputs; }; server = { builder = inputs.nixpkgs-stable.lib.nixosSystem; + inherit specialArgs; modules = with inputs; [ ragenix.nixosModules.default @@ -121,7 +124,5 @@ in { system.stateVersion = "23.05"; } ]; - - specialArgs = inputs; }; } diff --git a/modules/nixos/base/nix.nix b/modules/nixos/base/nix.nix index 3f2bcd3..947f086 100644 --- a/modules/nixos/base/nix.nix +++ b/modules/nixos/base/nix.nix @@ -1,7 +1,7 @@ { config, lib, - pkgs, + inputs, ... }: let cfg = config.getchoo.base.nix-settings; @@ -15,7 +15,8 @@ in { ]; config = let - channelPath = "/etc/nix/channels/nixpkgs"; + channelPath = i: "/etc/nix/channels/${i}"; + mapInputs = fn: builtins.map fn (builtins.attrNames inputs); in mkIf cfg.enable { nix = { @@ -30,13 +31,10 @@ in { experimental-features = ["nix-command" "flakes" "auto-allocate-uids" "repl-flake"]; }; - nixPath = [ - "nixpkgs=${channelPath}" - ]; + nixPath = mapInputs (i: "${i}=${channelPath i}"); }; - systemd.tmpfiles.rules = [ - "L+ ${channelPath} - - - - ${pkgs.path}" - ]; + systemd.tmpfiles.rules = + mapInputs (i: "L+ ${channelPath i} - - - - ${inputs.${i}.outPath}"); }; } |
