Compare commits

...

2 commits

Author SHA1 Message Date
Bruno BELANYI 5bce2fafde modules: system: nix: override '<nixpkgs>'
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-11 11:04:10 +00:00
Bruno BELANYI 26bf4e3631 modules: system: nix: preprend to 'NIX_PATH'
Instead of appending to the default value.

This makes overriding some values that are defined as the default value easier.
2023-02-11 11:04:10 +00:00

View file

@ -10,6 +10,8 @@ in
addToRegistry = my.mkDisableOption "add inputs and self to registry";
addToNixPath = my.mkDisableOption "add inputs and self to nix path";
overrideNixpkgs = my.mkDisableOption "point nixpkgs to pinned system version";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
@ -29,17 +31,21 @@ in
self.flake = inputs.self;
# Use pinned nixpkgs when using `nix run pkgs#<whatever>`
pkgs.flake = inputs.nixpkgs;
# ... And 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;
};
})
(lib.mkIf cfg.addToNixPath {
nix.nixPath = options.nix.nixPath.default ++ [
nix.nixPath = [
"self=${inputs.self}"
"pkgs=${inputs.nixpkgs}"
"nur=${inputs.nur}"
];
]
++ lib.optional cfg.overrideNixpkgs "nixpkgs=${inputs.nixpkgs}"
++ options.nix.nixPath.default;
})
]);
}