Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. nbcall(){
  2. nixExpressionPath="$1"
  3.  
  4. if [[ -z "$nixExpressionPath" ]]; then
  5. nixExpressionPath="./default.nix"
  6. else
  7. pathHadToBeCorrected=false
  8. if [[ ! $nixExpressionPath == *.nix ]]; then
  9. nixExpressionPath="$nixExpressionPath.nix"
  10. pathHadToBeCorrected=true
  11. fi
  12. if [[ ! $nixExpressionPath == ./* ]] && [[ ! $nixExpressionPath == /* ]]; then
  13. nixExpressionPath="./$nixExpressionPath"
  14. pathHadToBeCorrected=true
  15. fi
  16.  
  17. if $pathHadToBeCorrected; then
  18. echo "The path was autocorrected from '$1' to '$nixExpressionPath'"
  19. fi
  20.  
  21. if [[ ! -f "$nixExpressionPath" ]]; then
  22. echo "WARNING: The path '$nixExpressionPath' is not a file. Please make sure you gave a valid path. Expecting \`nix-build\` to fail."
  23. fi
  24. fi
  25.  
  26.  
  27. nix-build -E "with import <nixpkgs> {}; callPackage $nixExpressionPath {}"
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement