Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. in runCommand "util-1" {} ''
  2. mkdir -pv $out/bin
  3.  
  4. cat << EOF > $out/bin/loginto
  5. #!$SHELL
  6. exec ${xterm}/bin/xterm -e ssh \$1 -t screen -xRRU
  7. EOF
  8. chmod +x $out/bin/loginto
  9.  
  10. cat << EOF > $out/bin/showsize
  11. #!$SHELL
  12. nix-store --query --tree "\$1" | sed 's,[-+| ]*/,/,' | awk '{print \$1}' | sort | uniq | xargs nix-store --query --size | paste -sd+ | ( echo -n '( ';sed 's,+, + ,g';echo ' ) / 1024 / 1024' ) | xargs expr
  13. EOF
  14. chmod +x $out/bin/showsize
  15.  
  16. cat << EOF > $out/bin/nix-lookup
  17. #!$SHELL
  18. local USAGE
  19. USAGE="$USAGE Usage: nix-lookup <expression-path-under-pkgs>"
  20. USAGE="$USAGE Shows the directory for the given attribute path."
  21. if [ $# -ne 1 ]; then echo "$USAGE"; return -1; fi
  22. nix-instantiate --eval -E "\"\''${(import <nixpkgs> {}).pkgs.$1}\"" | sed 's:"::g'
  23. EOF
  24. chmod +x $out/bin/nix-lookup
  25. ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement