Created
September 5, 2014 11:19
-
-
Save proger/f5f3b2902455aa9df2e0 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
# running this: | |
# % env NIX_REMOTE= INTERNIX_REMOTE=daemon \ | |
# NIX_LOG_DIR=$HOME/tmp/log NIX_CONF_DIR=/var/empty NIX_STORE_DIR=$HOME/tmp/store NIX_STATE_DIR=$HOME/tmp/state NIX_DB_DIR=$HOME/tmp/state/db \ | |
# nix-build internix.nix --show-trace | |
let pkgs = import <nixpkgs> {}; in with pkgs.lib; | |
let | |
system = builtins.currentSystem; | |
builder = ./proxy-bash.sh; | |
PATH = "/usr/bin:/usr/local/bin:/bin:/run/current-system/sw/bin"; | |
preferLocalBuild = true; | |
shell = name: command: derivation { # similar to pkgs.runCommand | |
inherit system builder PATH name preferLocalBuild; | |
args = ["-c" command]; | |
}; | |
nixPackage = attr: shell "nixpkg-${attr}" '' | |
unset NIX_STORE | |
export NIX_PATH=${builtins.getEnv "NIX_PATH"} | |
export NIX_REMOTE=${builtins.getEnv "INTERNIX_REMOTE"} | |
nix-build -A pkgs.${attr} "$(nix-instantiate --eval -E '<nixpkgs>')/default.nix" | |
eval ln -sf $(nix-instantiate --read-write-mode --show-trace --eval --strict -E '(import <nixpkgs> {}).${attr}.outPath') $out | |
''; | |
in | |
let | |
deps = [ "nixUnstable" "bash" "netcat-openbsd" "curl" ]; | |
interpkgs = listToAttrs (map (p: nameValuePair p (nixPackage p)) deps); | |
path = concatStringsSep ":" (map (p: "${p}/bin:${p}/sbin") (attrValues interpkgs)); | |
expr = shell "nix-store-version" '' | |
export PATH=${path} | |
echo $PATH | |
curl --version | |
${interpkgs.nixUnstable}/bin/nix-store --version > $out | |
''; | |
in expr |
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
#!/usr/bin/env bash | |
exec bash "$@" |
Author
proger
commented
Sep 5, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment