aboutsummaryrefslogtreecommitdiff
path: root/nixops/scripts/setup
diff options
context:
space:
mode:
Diffstat (limited to 'nixops/scripts/setup')
-rwxr-xr-xnixops/scripts/setup41
1 files changed, 0 insertions, 41 deletions
diff --git a/nixops/scripts/setup b/nixops/scripts/setup
index 1586265..58dbf55 100755
--- a/nixops/scripts/setup
+++ b/nixops/scripts/setup
@@ -80,47 +80,6 @@ for key in $gpg_keys; do
80 fi 80 fi
81done 81done
82 82
83nix_group=$(stat -c %G /nix/store)
84if [ "$nix_group" = "nixbld" ]; then
85 nix_user="nixbld1"
86else
87 nix_user="$(stat -c %U /nix/store)"
88fi
89
90if [ ! -f /etc/ssh/ssh_rsa_key_nixops ]; then
91 cat <<-EOF
92 The key to access private git repositories (websites hosted by the
93 server) needs to be accessible to nix builders. It will be put in
94 /etc/ssh/ssh_rsa_key_nixops (sudo right is needed for that)
95 > pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/SshKey | sudo tee /etc/ssh/ssh_rsa_key_nixops > /dev/null
96 > pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/SshKey.pub | sudo tee /etc/ssh/ssh_rsa_key_nixops.pub > /dev/null
97 > sudo chmod u=r,go-rwx /etc/ssh/ssh_rsa_key_nixops
98 > sudo chown $nix_user:$nix_group /etc/ssh/ssh_rsa_key_nixops /etc/ssh/ssh_rsa_key_nixops.pub
99 Continue? [y/N]
100 EOF
101 read y
102 if [ "$y" = "y" -o "$y" = "Y" ]; then
103 if ! id -u $nix_user 2>/dev/null >/dev/null; then
104 echo "User $nix_user seems inexistant, did you install nix?"
105 exit 1
106 fi
107 mask=$(umask)
108 umask 0777
109 # Don’t forward it directly to tee, it would break ncurse pinentry
110 key=$(pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/SshKey)
111 echo "$key" | sudo tee /etc/ssh/ssh_rsa_key_nixops > /dev/null
112 sudo chmod u=r,go=- /etc/ssh/ssh_rsa_key_nixops
113 pubkey=$(pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/SshKey.pub)
114 echo "$pubkey" | sudo tee /etc/ssh/ssh_rsa_key_nixops.pub > /dev/null
115 sudo chmod a=r /etc/ssh/ssh_rsa_key_nixops.pub
116 sudo chown $nix_user:$nix_group /etc/ssh/ssh_rsa_key_nixops /etc/ssh/ssh_rsa_key_nixops.pub
117 umask $mask
118 else
119 echo "Aborting"
120 exit 1
121 fi
122fi
123
124if nix show-config --json | jq -e '.sandbox.value == "true"' >/dev/null; then 83if nix show-config --json | jq -e '.sandbox.value == "true"' >/dev/null; then
125 cat <<-EOF 84 cat <<-EOF
126 There are some impure derivations in the repo currently (grep __noChroot), please put 85 There are some impure derivations in the repo currently (grep __noChroot), please put