From f64ab1525b34d5d9202f5801db36f364075abde1 Mon Sep 17 00:00:00 2001 From: diffy Date: Mon, 4 Aug 2025 23:22:48 +1000 Subject: [PATCH] docs: add recursive method for fetching flake input out paths The previous example would not work for flakes that have inputs with inputs of their own, leading to installation failures when attempting to install without internet access --- docs/disko-install.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/disko-install.md b/docs/disko-install.md index 7abaff9..c19536a 100644 --- a/docs/disko-install.md +++ b/docs/disko-install.md @@ -197,8 +197,19 @@ Add this to your flake.nix output: ```nix # `self` here is referring to the flake `self`, you may need to pass it using `specialArgs` or define your NixOS installer configuration # in the flake.nix itself to get direct access to the `self` flake variable. -{ pkgs, self, ... }: +{ lib, pkgs, self, ... }: 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 = [ self.nixosConfigurations.your-machine.config.system.build.toplevel self.nixosConfigurations.your-machine.config.system.build.diskoScript @@ -210,7 +221,7 @@ let self.nixosConfigurations.your-machine.pkgs.perlPackages.FileSlurp (self.nixosConfigurations.your-machine.pkgs.closureInfo { rootPaths = [ ]; }).drvPath - ] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); + ] ++ flakeOutPaths; closureInfo = pkgs.closureInfo { rootPaths = dependencies; }; in