From 4913b22ab9c4afef4b98d1f9bacd14ff6976ff9d Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 15 Sep 2024 20:22:07 +0200 Subject: [PATCH] auto-upgrade: store flake input refs --- base/services/auto-upgrade.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/base/services/auto-upgrade.nix b/base/services/auto-upgrade.nix index 7bfe0ab..7e8e982 100644 --- a/base/services/auto-upgrade.nix +++ b/base/services/auto-upgrade.nix @@ -1,4 +1,4 @@ -{ ... }: +{ inputs, pkgs, lib, ... }: { system.autoUpgrade = { enable = true; @@ -12,4 +12,15 @@ "--no-write-lock-file" ]; }; -} \ No newline at end of file + + # workaround for https://github.com/NixOS/nix/issues/6895 + # via https://git.lix.systems/lix-project/lix/issues/400 + environment.etc."current-system-flake-inputs.json".source + = pkgs.writers.writeJSON "flake-inputs.json" ( + lib.flip lib.mapAttrs inputs (name: input: + # inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like a derivation + 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 + ) + ); +} -- 2.44.2