Check nixpkgs/pkgs/build-support/trivial-builders.nix for more information about:
- runCommand / runCommandCC
- writeTextFile / writeTextDir
- writeScript / writeScriptBin
- writeShellScript / writeshellScriptBin
- writeShellApplication
- ...
Check nixpkgs/pkgs/build-support/trivial-builders.nix for more information about:
# cat $(nix-build)/bin/date/today.txt | |
{ nixpkgs ? import <nixpkgs> {}}: | |
nixpkgs.runCommand "print-date" { | |
nativeBuildInputs = [ nixpkgs.coreutils ]; | |
} '' | |
# line 5 in nix file = line 1 in bash script -> offset 4 | |
PS4='+ Line $(expr $LINENO + 4): ' | |
set -o xtrace # print commands | |
mkdir -p $out/date/ | |
date > $out/date/today.txt | |
set +o xtrace # hide commands | |
'' |
# $(nix-build)/bin/test | |
# cat response.json | |
{ nixpkgs ? import <nixpkgs> {}}: | |
nixpkgs.writeShellApplication { | |
name = "test"; | |
runtimeInputs = with nixpkgs; [ curl w3m ]; | |
text = '' | |
curl -XPOST httpbin.org/post > response.json | |
''; | |
} |