home: nix: refactor module
This keeps it in line with the NixOS one.
This commit is contained in:
parent
58d03d5892
commit
ca1e2df1e9
|
@ -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#<whatever>`
|
||||
pkgs = inputs.nixpkgs;
|
||||
}
|
||||
(lib.optionalAttrs cfg.overrideNixpkgs {
|
||||
# ... And with `nix run nixpkgs#<whatever>`
|
||||
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#<whatever>`
|
||||
pkgs.flake = inputs.nixpkgs;
|
||||
# ... And also with `nix run nixpkgs#<whatever>`
|
||||
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;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue