pvv-nixos-config/base/nix.nix
Peder Bergebakken Sundt da7cb17f9e base: stabilize system.build.toplevel.outPath for vmVariant
This is done by not depending on the flake itself, allowing the bits of a dirty tree to not affect the hash.
This enables equivalence testing with `just eval-vm bob` and checking if the system closure hash changes or not.
2025-05-31 19:13:33 +02:00

40 lines
1008 B
Nix

{ lib, config, inputs, ... }:
{
nix = {
gc = {
automatic = true;
options = "--delete-older-than 2d";
};
optimise.automatic = true;
settings = {
allow-dirty = true;
builders-use-substitutes = true;
experimental-features = [ "nix-command" "flakes" ];
log-lines = 50;
use-xdg-base-directories = true;
};
/* This makes commandline tools like
** nix run nixpkgs#hello
** and nix-shell -p hello
** use the same channel the system
** was built with
*/
registry = lib.mkMerge [
{
"nixpkgs".flake = inputs.nixpkgs;
"nixpkgs-unstable".flake = inputs.nixpkgs-unstable;
}
# We avoid the reference to self in vmVariant to get a stable system .outPath for equivalence testing
(lib.mkIf (!config.virtualisation.isVmVariant) {
"pvv-nix".flake = inputs.self;
})
];
nixPath = [
"nixpkgs=${inputs.nixpkgs}"
"unstable=${inputs.nixpkgs-unstable}"
];
};
}