-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite sources.nix to support several use cases
sources.nix now supports the following use cases: - nixpkgs is not set in the NIX_PATH - nixpkgs is set to ./. - sources.nix is evaluated with the restricted mode (no builtins)
- Loading branch information
Showing
2 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash | ||
#!nix-shell -I nixpkgs=./nix | ||
#!nix-shell -p nix | ||
#!nix-shell --pure | ||
|
||
set -euo pipefail | ||
|
||
echo "*** Building Niv" | ||
NIV=$(nix-build -A niv)/bin/niv | ||
|
||
echo "*** Running niv init" | ||
TEMPDIR=$(mktemp -d) | ||
pushd $TEMPDIR | ||
$NIV init | ||
|
||
echo "*** Fetching niv sources: classical" | ||
echo " - nixpkgs is not in the NIX_PATH" | ||
echo " - nixpkgs in sources.json" | ||
nix-build nix/sources.nix -A niv | ||
|
||
echo "*** Fetching niv sources: restricted evaluation mode" | ||
echo " - nixpkgs is not in the NIX_PATH" | ||
echo " - nixpkgs in sources.json" | ||
echo " - restrict-eval is true" | ||
export NIX_PATH=./ | ||
nix-build nix/sources.nix -A niv \ | ||
--option restrict-eval true \ | ||
--option allowed-uris https://github.com | ||
|
||
echo "*** Fetching niv sources: only builtins" | ||
echo " - nixpkgs is not in the NIX_PATH" | ||
echo " - nixpkgs not in sources.json" | ||
$NIV drop nixpkgs | ||
nix-build nix/sources.nix -A niv | ||
|
||
echo "*** Tear down" | ||
rm -rf $TEMPDIR |