Skip to content

Commit 4767d88

Browse files
committed
save full closure of flake inputs
1 parent 37d9b4e commit 4767d88

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

libFunc/flakeClosureRef.nix

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{ lib, pkgs, ... }:
2+
let
3+
inherit (builtins) concatMap attrValues concatStringsSep;
4+
inherit (lib) unique;
5+
6+
flakesClosure = flakes: if flakes == [] then [] else unique (flakes ++ flakesClosure (concatMap (flake: if flake ? inputs then attrValues flake.inputs else []) flakes));
7+
flakeClosureRef = flake: pkgs.writeText "flake-closure" (concatStringsSep "\n" (flakesClosure [ flake ]) + "\n");
8+
in flakeClosureRef

nixosConfigurations/tejingdesk/registry.nix

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@ let
44
inherit (inputs) nixpkgs home-manager self;
55
inherit (lib) mkIf;
66
inherit (lib.strings) escapeNixIdentifier;
7-
inherit (my.lib) mkFlake repoLockedTestResult;
7+
inherit (my.lib) mkFlake repoLockedTestResult flakeClosureRef;
88
in
99
{
1010
# Let 'nixos-version --json' know about the Git revision
1111
# of this flake.
1212
system.configurationRevision = mkIf (self ? rev) self.rev;
1313

14-
# Save our single IFD derivation so we don't usually have to rebuild
15-
# it
16-
system.extraDependencies = [ repoLockedTestResult ];
14+
system.extraDependencies = [
15+
16+
# Save our single IFD derivation so we don't usually have to
17+
# rebuild it
18+
repoLockedTestResult
19+
20+
# Save the whole input closure of this flake, so we have all the
21+
# nix code necessary to rebuild this system
22+
(flakeClosureRef self)
23+
24+
];
1725

1826
# Indirect our NIX_PATH through /etc so that it updates without a
1927
# relog

0 commit comments

Comments
 (0)