diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support/trivial-builders/test')
-rw-r--r-- | nixpkgs/pkgs/build-support/trivial-builders/test/default.nix | 1 | ||||
-rw-r--r-- | nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix b/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix index 683f4b9fd04f..cbd1b388ef66 100644 --- a/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix +++ b/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix @@ -25,6 +25,7 @@ recurseIntoAttrs { then callPackage ./references.nix {} else null; writeCBin = callPackage ./writeCBin.nix {}; + writeShellApplication = callPackage ./writeShellApplication.nix {}; writeScriptBin = callPackage ./writeScriptBin.nix {}; writeShellScript = callPackage ./write-shell-script.nix {}; writeShellScriptBin = callPackage ./writeShellScriptBin.nix {}; diff --git a/nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix b/nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix new file mode 100644 index 000000000000..6ce6f0720fcf --- /dev/null +++ b/nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix @@ -0,0 +1,29 @@ +/* + Run with: + + cd nixpkgs + nix-build -A tests.trivial-builders.writeShellApplication +*/ + +{ lib, writeShellApplication, runCommand }: +let + pkg = writeShellApplication { + name = "test-script"; + excludeShellChecks = [ "SC2016" ]; + text = '' + echo -e '#!/usr/bin/env bash\n' \ + 'echo "$SHELL"' > /tmp/something.sh # this line would normally + # ...cause shellcheck error + ''; + }; +in + assert pkg.meta.mainProgram == "test-script"; + runCommand "test-writeShellApplication" { } '' + + echo Testing if writeShellApplication builds without shellcheck error... + + target=${lib.getExe pkg} + + touch $out + '' + |