diff --git a/home/nix/default.nix b/home/nix/default.nix index ddefddb..b05a1d0 100644 --- a/home/nix/default.nix +++ b/home/nix/default.nix @@ -2,6 +2,21 @@ { config, inputs, lib, options, pkgs, ... }: let cfg = config.my.home.nix; + + channels = lib.my.merge [ + { + # Allow me to use my custom package using `nix run self#pkg` + self = inputs.self; + # Add NUR to run some packages that are only present there + nur = inputs.nur; + # Use pinned nixpkgs when using `nix run pkgs#` + pkgs = inputs.nixpkgs; + } + (lib.optionalAttrs cfg.overrideNixpkgs { + # ... And with `nix run nixpkgs#` + nixpkgs = inputs.nixpkgs; + }) + ]; in { options.my.home.nix = with lib; { @@ -24,16 +39,12 @@ in } (lib.mkIf cfg.addToRegistry { - nix.registry = { - # Allow me to use my custom package using `nix run self#pkg` - self.flake = inputs.self; - # Use pinned nixpkgs when using `nix run pkgs#` - pkgs.flake = inputs.nixpkgs; - # ... And also with `nix run nixpkgs#` - nixpkgs.flake = lib.mkIf cfg.overrideNixpkgs inputs.nixpkgs; - # Add NUR to run some packages that are only present there - nur.flake = inputs.nur; - }; + nix.registry = + let + makeEntry = v: { flake = v; }; + makeEntries = lib.mapAttrs (lib.const makeEntry); + in + makeEntries channels; }) ]); }