Recursively include inputs for all inputs in disko closure.

This commit is contained in:
Tom Alexander
2025-11-21 20:07:46 -05:00
parent 3348feb613
commit 39997dc4d4
11 changed files with 176 additions and 37 deletions

View File

@@ -7,32 +7,49 @@
...
}:
let
flakeOutPaths =
let
collector =
parent:
map (
child:
[ child.outPath ] ++ (if child ? inputs && child.inputs != { } then (collector child) else [ ])
) (lib.attrValues parent.inputs);
in
lib.unique (lib.flatten (collector self));
dependencies = [
this_nixos_config.pkgs.stdenv.drvPath
(this_nixos_config.pkgs.closureInfo { rootPaths = [ ]; }).drvPath
# let
# flakeOutPaths =
# let
# collector =
# parent:
# map (
# child:
# [ child.outPath ] ++ (if child ? inputs && child.inputs != { } then (collector child) else [ ])
# ) (lib.attrValues parent.inputs);
# in
# lib.unique (lib.flatten (collector self));
# dependencies = [
# this_nixos_config.pkgs.stdenv.drvPath
# (this_nixos_config.pkgs.closureInfo { rootPaths = [ ]; }).drvPath
# https://github.com/NixOS/nixpkgs/blob/f2fd33a198a58c4f3d53213f01432e4d88474956/nixos/modules/system/activation/top-level.nix#L342
this_nixos_config.pkgs.perlPackages.ConfigIniFiles
this_nixos_config.pkgs.perlPackages.FileSlurp
# # https://github.com/NixOS/nixpkgs/blob/f2fd33a198a58c4f3d53213f01432e4d88474956/nixos/modules/system/activation/top-level.nix#L342
# this_nixos_config.pkgs.perlPackages.ConfigIniFiles
# this_nixos_config.pkgs.perlPackages.FileSlurp
this_nixos_config.config.system.build.toplevel
this_nixos_config.config.system.build.diskoScript
]
++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
# ++ flakeOutPaths;
closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
in
# this_nixos_config.config.system.build.toplevel
# # this_nixos_config.config.system.build.toplevel.drvPath
# this_nixos_config.config.system.build.diskoScript
# this_nixos_config.config.system.build.diskoScript.drvPath
# this_nixos_config.config.system.build.destroyScript.drvPath
# this_nixos_config.config.system.build.formatScript.drvPath
# this_nixos_config.config.system.build.mountScript.drvPath
# this_nixos_config.config.system.build.destroyScript
# this_nixos_config.config.system.build.formatScript
# this_nixos_config.config.system.build.mountScript
# # config.system.build.diskoScript
# # config.system.build.diskoScript.drvPath
# # config.system.build.destroyScript.drvPath
# # config.system.build.formatScript.drvPath
# # config.system.build.mountScript.drvPath
# # config.system.build.destroyScript
# # config.system.build.formatScript
# # config.system.build.mountScript
# ]
# ++ flakeOutPaths;
# closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
# in
{
imports = [ ];
@@ -60,17 +77,27 @@ in
];
}
(lib.mkIf config.me.disko.offline.enable {
# exec ${pkgs.disko}/bin/disko-install --flake '${self}#${config.networking.hostName}' --disk main '/dev/nvme0n1' --write-efi-boot-entries
#${pkgs.disko}/bin/disko --mode destroy,format,mount '${self}/hosts/${config.networking.hostName}/disk-config.nix'
environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "install-nixos-unattended" ''
set -xeuo pipefail
IFS=$'\n\t'
# exec ${pkgs.disko}/bin/disko-install --flake '${self}#${config.networking.hostName}' --disk main '/dev/nvme0n1' --write-efi-boot-entries
${pkgs.disko}/bin/disko --mode destroy,format,mount '${self}/hosts/${config.networking.hostName}/disk-config.nix'
${pkgs.nixos-install}/bin/nixos-install --substituters "http://10.0.2.2:8080?trusted=1 https://cache.nixos.org/" --no-channel-copy --no-root-password --flake '${self}#${config.networking.hostName}'
#${this_nixos_config.config.system.build.destroyScript}
#${this_nixos_config.config.system.build.formatScript}
${this_nixos_config.config.system.build.mountScript}
${pkgs.nixos-install}/bin/nixos-install --substituters "" --no-channel-copy --no-root-password --flake '${self}#${config.networking.hostName}'
#${pkgs.nixos-install}/bin/nixos-install --substituters "" --no-channel-copy --no-root-password --system '${this_nixos_config.config.system.build.toplevel}'
'')
];
environment.etc."install-closure".source = "${closureInfo}/store-paths";
# environment.etc."install-closure".source = "${closureInfo}/store-paths";
})
]
);