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, ... }:
|
{ config, inputs, lib, options, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.my.home.nix;
|
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
|
in
|
||||||
{
|
{
|
||||||
options.my.home.nix = with lib; {
|
options.my.home.nix = with lib; {
|
||||||
|
@ -24,16 +39,12 @@ in
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf cfg.addToRegistry {
|
(lib.mkIf cfg.addToRegistry {
|
||||||
nix.registry = {
|
nix.registry =
|
||||||
# Allow me to use my custom package using `nix run self#pkg`
|
let
|
||||||
self.flake = inputs.self;
|
makeEntry = v: { flake = v; };
|
||||||
# Use pinned nixpkgs when using `nix run pkgs#<whatever>`
|
makeEntries = lib.mapAttrs (lib.const makeEntry);
|
||||||
pkgs.flake = inputs.nixpkgs;
|
in
|
||||||
# ... And also with `nix run nixpkgs#<whatever>`
|
makeEntries channels;
|
||||||
nixpkgs.flake = lib.mkIf cfg.overrideNixpkgs inputs.nixpkgs;
|
|
||||||
# Add NUR to run some packages that are only present there
|
|
||||||
nur.flake = inputs.nur;
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue