Skip to content

Instantly share code, notes, and snippets.

@kojiromike
Last active June 6, 2017 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kojiromike/fed8f2801e3a6dfd8bdb07cf230987b5 to your computer and use it in GitHub Desktop.
Save kojiromike/fed8f2801e3a6dfd8bdb07cf230987b5 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
with pkgs.python27Packages;
##
# Hypothesis: The paths from build-sandbox-paths in /etc/nix/nix.conf
# always get added to the PATH when running nix-shell.
#
# Experiment:
#
# Step 1: Produce a file containing your build-sandbox-paths:
# `awk '$1=="build-sandbox-paths"{
# for (n=3;n<=NF;n++) {
# sub(/[^=]*=/, "", $n);
# print $n;
# }
# }' /etc/nix/nix.conf > ~/build-sandbox-paths.txt`
#
# Step 2: Output your PATH in a user environment
# outside of nix-shell, like so:
# `echo "${PATH//:/$'\n'}" > ~/normal-paths.txt`
#
# Step 3: Verify that the build-sandbox-paths are not
# in that PATH.
# `grep -xoFf ~/build-sandbox-paths.txt ~/normal-paths.txt`
# (The output should be empty.)
#
# Step 4: Enter a very simple nix-shell, using this file as default.nix
#
# Step 5: Output your PATH inside the nix-shell:
# `echo "${PATH//:/$'\n'}" > ~/nix-shell-paths.txt`
#
# Step 6: Exit the nix-shell
#
# Step 7: Verify that the build-sandbox-paths are
# in the nix-shell-paths:
# `grep -xoFf ~/build-sandbox-paths.txt ~/nix-shell-paths.txt`
#
# Analysis: If the output of the command in step 7 contains all the build-sandbox-paths
# then the hypothesis is not disproven.
#
# If the output of the command in step 7 contains anything else, then the
# hypothesis is disproven.
#
# But if the output of the command in step 7 is not empty, then further analysis
# is needed.
stdenv.mkDerivation {
name = "test";
buildInputs = [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment