Guest User

Proto-Nixops Makefile

a guest
Jun 8th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.55 KB | None | 0 0
  1. .PHONY: hostname
  2. hostname:
  3.     drv=$$(nix-build --no-out-link --expr "\
  4.        let \
  5.            nixos = import <nixpkgs/nixos> { configuration = \
  6.                import host/$@/configuration.nix; }; \
  7.        in nixos.system") && \
  8.         nix-copy-closure --use-substitutes --to "$@" "$${drv}" && \
  9.         ssh -t "$@" "trap '' HUP && sudo sh -c \
  10.            'nix-env -p /nix/var/nix/profiles/system --set "$${drv}" && \
  11.            "$${drv}"/bin/switch-to-configuration switch'"
  12.     ssh "$@" readlink -f /run/{booted,current}-system{,/kernel}
Add Comment
Please, Sign In to add comment