Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nbcall(){
- nixExpressionPath="$1"
- if [[ -z "$nixExpressionPath" ]]; then
- nixExpressionPath="./default.nix"
- else
- pathHadToBeCorrected=false
- if [[ ! $nixExpressionPath == *.nix ]]; then
- nixExpressionPath="$nixExpressionPath.nix"
- pathHadToBeCorrected=true
- fi
- if [[ ! $nixExpressionPath == ./* ]] && [[ ! $nixExpressionPath == /* ]]; then
- nixExpressionPath="./$nixExpressionPath"
- pathHadToBeCorrected=true
- fi
- if $pathHadToBeCorrected; then
- echo "The path was autocorrected from '$1' to '$nixExpressionPath'"
- fi
- if [[ ! -f "$nixExpressionPath" ]]; then
- echo "WARNING: The path '$nixExpressionPath' is not a file. Please make sure you gave a valid path. Expecting \`nix-build\` to fail."
- fi
- fi
- nix-build -E "with import <nixpkgs> {}; callPackage $nixExpressionPath {}"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement