Commit 6dfead1d authored by John Ericson's avatar John Ericson
Browse files

minimal-bootstrap.derivationWithMeta: Do more conds at eval time

Nice to keep run time as simple as possible / embrace phase separations.
parent 0c7631d3
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -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
        '' + lib.optionalString (builtins.dirOf destination == ".") ''
          mkdir -p ''${out}''${destinationDir}
          fi
        '' + ''
          cp ''${textPath} ''${target}
          if match x''${executable} x1; then
        '' + lib.optionalString executable ''
          chmod 555 ''${target}
          fi
        '')
        ''))
      ];

      PATH = lib.makeBinPath [ mescc-tools-extra ];
      mkdirDestination = if builtins.dirOf destination == "." then "0" else "1";
      destinationDir = builtins.dirOf destination;
      inherit destination;
    };