From 6dfead1d52f7347fab6cac621e5dd45a67ca56a3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 14 May 2023 13:32:53 -0400 Subject: [PATCH] minimal-bootstrap.derivationWithMeta: Do more conds at eval time Nice to keep run time as simple as possible / embrace phase separations. --- .../linux/minimal-bootstrap/utils.nix | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/utils.nix b/pkgs/os-specific/linux/minimal-bootstrap/utils.nix index ec4bd72b779e..e710c34aa6ae 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/utils.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/utils.nix @@ -40,7 +40,7 @@ rec { , preferLocalBuild ? true }: derivationWithMeta { - inherit name text executable allowSubstitutes preferLocalBuild; + inherit name text allowSubstitutes preferLocalBuild; passAsFile = [ "text" ]; builder = "${kaem}/bin/kaem"; @@ -48,20 +48,18 @@ rec { "--verbose" "--strict" "--file" - (builtins.toFile "write-text-file.kaem" '' + (builtins.toFile "write-text-file.kaem" ('' target=''${out}''${destination} - if match x''${mkdirDestination} x1; then - mkdir -p ''${out}''${destinationDir} - fi + '' + lib.optionalString (builtins.dirOf destination == ".") '' + mkdir -p ''${out}''${destinationDir} + '' + '' cp ''${textPath} ''${target} - if match x''${executable} x1; then - chmod 555 ''${target} - fi - '') + '' + lib.optionalString executable '' + chmod 555 ''${target} + '')) ]; PATH = lib.makeBinPath [ mescc-tools-extra ]; - mkdirDestination = if builtins.dirOf destination == "." then "0" else "1"; destinationDir = builtins.dirOf destination; inherit destination; };