Created
April 7, 2019 16:40
-
-
Save Profpatsch/bebada9cb0baf418939e3b1522eb0ad6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let nixBin = "${pkgs.nix}/bin"; in | |
runCommand "foo" {} | |
'' | |
set -e | |
datadir="${pkgs.nix}/share" | |
export TEST_ROOT=$(pwd)/test-tmp | |
export NIX_BUILD_HOOK= | |
export NIX_CONF_DIR=$TEST_ROOT/etc | |
export NIX_DB_DIR=$TEST_ROOT/db | |
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var | |
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix | |
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests | |
export NIX_STATE_DIR=$TEST_ROOT/var/nix | |
export NIX_STORE_DIR=$TEST_ROOT/store | |
export PAGER=cat | |
cacheDir=$TEST_ROOT/binary-cache | |
${nix}/bin/nix-store --init | |
cat > drv.nix <<EOF | |
derivation { | |
name = "foo"; | |
system = ${pkgs.lib.strings.escapeNixString system}; | |
# /bin/sh is magically accessible to nix, | |
# it is added to the build sandbox (with all runtime deps). | |
builder = "/bin/sh"; | |
args = [ "-c" "echo $love && echo foo > \$out" ]; | |
} | |
EOF | |
${nixBin}/nix-instantiate drv.nix > drv | |
output=$(${nixBin}/nix-store --realize $(<drv)) | |
touch $out | |
'' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment