mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2025-06-05 21:25:22 +02:00
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.
This commit is contained in:
parent
1caa0cc7be
commit
da7cb17f9e
17
base/nix.nix
17
base/nix.nix
@ -1,4 +1,4 @@
|
|||||||
{ inputs, ... }:
|
{ lib, config, inputs, ... }:
|
||||||
{
|
{
|
||||||
nix = {
|
nix = {
|
||||||
gc = {
|
gc = {
|
||||||
@ -21,11 +21,16 @@
|
|||||||
** use the same channel the system
|
** use the same channel the system
|
||||||
** was built with
|
** was built with
|
||||||
*/
|
*/
|
||||||
registry = {
|
registry = lib.mkMerge [
|
||||||
"nixpkgs".flake = inputs.nixpkgs;
|
{
|
||||||
"nixpkgs-unstable".flake = inputs.nixpkgs-unstable;
|
"nixpkgs".flake = inputs.nixpkgs;
|
||||||
"pvv-nix".flake = inputs.self;
|
"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 = [
|
nixPath = [
|
||||||
"nixpkgs=${inputs.nixpkgs}"
|
"nixpkgs=${inputs.nixpkgs}"
|
||||||
"unstable=${inputs.nixpkgs-unstable}"
|
"unstable=${inputs.nixpkgs-unstable}"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ inputs, pkgs, lib, ... }:
|
{ config, inputs, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inputUrls = lib.mapAttrs (input: value: value.url) (import "${inputs.self}/flake.nix").inputs;
|
inputUrls = lib.mapAttrs (input: value: value.url) (import "${inputs.self}/flake.nix").inputs;
|
||||||
@ -26,12 +26,14 @@ in
|
|||||||
|
|
||||||
# workaround for https://github.com/NixOS/nix/issues/6895
|
# workaround for https://github.com/NixOS/nix/issues/6895
|
||||||
# via https://git.lix.systems/lix-project/lix/issues/400
|
# via https://git.lix.systems/lix-project/lix/issues/400
|
||||||
environment.etc."current-system-flake-inputs.json".source
|
environment.etc = lib.mkIf (!config.virtualisation.isVmVariant) {
|
||||||
= pkgs.writers.writeJSON "flake-inputs.json" (
|
"current-system-flake-inputs.json".source
|
||||||
lib.flip lib.mapAttrs inputs (name: input:
|
= pkgs.writers.writeJSON "flake-inputs.json" (
|
||||||
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like a derivation
|
lib.flip lib.mapAttrs inputs (name: input:
|
||||||
lib.removeAttrs (input.sourceInfo or {}) [ "outPath" ]
|
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like a derivation
|
||||||
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
|
lib.removeAttrs (input.sourceInfo or {}) [ "outPath" ]
|
||||||
)
|
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user