summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Hamon <and.ham95@gmail.com>2023-03-19 21:00:18 -0700
committerAndrew Hamon <and.ham95@gmail.com>2023-04-02 14:36:32 -0700
commite929a99848b67822e69522d6895c91688c2b7cca (patch)
tree4c7859c8f6e14e00b48b2bbe38fe545ffb8a06b7
parent51f46244768b1d203d9029c41cb672b7b0d5d6d5 (diff)
downloadnixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.tar
nixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.tar.gz
nixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.tar.bz2
nixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.tar.lz
nixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.tar.xz
nixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.tar.zst
nixpkgs-e929a99848b67822e69522d6895c91688c2b7cca.zip
writeShellApplication: allow substitutions and remote building.
Unlike most other trivial builders, writeShellApplication has a
relatively heavy checkphase that invokes shellcheck. On my system,
a small writeShellApplication takes over 1 second to build.

This PR allows substitutions and stops preferring local builds for
writeShellApplication.
-rw-r--r--pkgs/build-support/trivial-builders.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix
index e4c2ffb7034..2a4e93f82df 100644
--- a/pkgs/build-support/trivial-builders.nix
+++ b/pkgs/build-support/trivial-builders.nix
@@ -132,13 +132,12 @@ rec {
     , destination ? ""   # relative path appended to $out eg "/bin/foo"
     , checkPhase ? ""    # syntax checks, e.g. for scripts
     , meta ? { }
+    , allowSubstitutes ? false
+    , preferLocalBuild ? true
     }:
     runCommand name
-      { inherit text executable checkPhase meta;
+      { inherit text executable checkPhase meta allowSubstitutes preferLocalBuild;
         passAsFile = [ "text" ];
-        # Pointless to do this on a remote machine.
-        preferLocalBuild = true;
-        allowSubstitutes = false;
       }
       ''
         target=$out${lib.escapeShellArg destination}
@@ -324,6 +323,8 @@ rec {
       inherit name;
       executable = true;
       destination = "/bin/${name}";
+      allowSubstitutes = true;
+      preferLocalBuild = false;
       text = ''
         #!${runtimeShell}
         set -o errexit