rewrite scripts from xonsh to bash
This commit is contained in:
parent
190b949585
commit
fb3b288e3f
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
nix-shell '<home-manager>' -A install
|
nix-shell '<home-manager>' -A install
|
||||||
rm ~/.config/nixpkgs/home.nix
|
rm ~/.config/nixpkgs/home.nix
|
||||||
ln -s $(pwd)/.nixos/flake.nix /home/$USER/.config/nixpkgs/flake.nix
|
ln -s $(pwd)/.nixos/flake.nix /home/$USER/.config/nixpkgs/flake.nix
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
read -e -p "Enter a config you want to deploy: " flake
|
||||||
|
|
||||||
|
server="nixos@nixos.2li.local"
|
||||||
|
download_command="curl https://git.2li.ch/Nebucatnetzer/nixos/archive/master.tar.gz | tar xz"
|
||||||
|
install_command="cd ~/nixos && ./scripts/install_vm.sh $flake"
|
||||||
|
rsa_key="~/.ssh/id_rsa"
|
||||||
|
|
||||||
|
ssh-copy-id $server
|
||||||
|
ssh -i $rsa_key -t $server $download_command
|
||||||
|
ssh -i $rsa_key -t $server $install_command
|
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env xonsh
|
|
||||||
|
|
||||||
flake = input("Enter a config you want to deploy: ")
|
|
||||||
|
|
||||||
server = "nixos@nixos.2li.local"
|
|
||||||
download_command = "curl https://git.2li.ch/Nebucatnetzer/nixos/archive/master.tar.gz | tar xz"
|
|
||||||
install_command = "cd ~/nixos && ./scripts/install_vm.sh " + flake
|
|
||||||
rsa_key = "~/.ssh/id_rsa"
|
|
||||||
|
|
||||||
ssh-copy-id @(server)
|
|
||||||
ssh -i @(rsa_key) -t @(server) @(download_command)
|
|
||||||
ssh -i @(rsa_key) -t @(server) @(install_command)
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
hosts = (
|
||||||
|
"nixos-management"
|
||||||
|
"grav"
|
||||||
|
"git"
|
||||||
|
"heimdall"
|
||||||
|
"mail"
|
||||||
|
"plex"
|
||||||
|
"proxy"
|
||||||
|
"rss-bridge"
|
||||||
|
"ttrss"
|
||||||
|
)
|
||||||
|
|
||||||
|
rsa_key="~/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
||||||
|
$NIX_SSHOPTS="-t -i $rsa_key"
|
||||||
|
|
||||||
|
for host in $hosts do
|
||||||
|
fqdn="$host.2li.local"
|
||||||
|
echo $fqdn
|
||||||
|
nixos-rebuild switch --use-remote-sudo --build-host localhost --target-host $fqdn --flake ".#$host"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
done
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/env xonsh
|
|
||||||
|
|
||||||
hosts = [
|
|
||||||
"nixos-management",
|
|
||||||
"grav",
|
|
||||||
#"git",
|
|
||||||
"heimdall",
|
|
||||||
"mail",
|
|
||||||
"plex",
|
|
||||||
"proxy",
|
|
||||||
"rss-bridge",
|
|
||||||
"ttrss",
|
|
||||||
]
|
|
||||||
|
|
||||||
rsa_key = "~/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
|
||||||
$NIX_SSHOPTS="-t -i " + rsa_key
|
|
||||||
|
|
||||||
for host in hosts:
|
|
||||||
fqdn = "{}.2li.local".format(host)
|
|
||||||
print(fqdn)
|
|
||||||
print("-" * len(fqdn))
|
|
||||||
nixos-rebuild switch --use-remote-sudo --build-host localhost --target-host @(fqdn) --flake @(".#" + host)
|
|
||||||
#echo @(fqdn) @(".#" + host)
|
|
||||||
print("")
|
|
||||||
print("")
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env xonsh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
find ./secrets -type d -print0 | xargs -0 chmod 700
|
find ./secrets -type d -print0 | xargs -0 chmod 700
|
||||||
find ./secrets -type f -print0 | xargs -0 chmod 600
|
find ./secrets -type f -print0 | xargs -0 chmod 600
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
hosts = (
|
||||||
|
"nixos-management"
|
||||||
|
"grav"
|
||||||
|
"heimdall"
|
||||||
|
"mail"
|
||||||
|
"plex"
|
||||||
|
"proxy"
|
||||||
|
"rss-bridge"
|
||||||
|
"ttrss"
|
||||||
|
)
|
||||||
|
|
||||||
|
update_command='tmux new -s updates "cd ~/.nixos && git pull && sudo nixos-rebuild -j auto switch || bash;"'
|
||||||
|
rsa_key="~/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
||||||
|
|
||||||
|
for host in $hosts do
|
||||||
|
fqdn="$host.2li.local"
|
||||||
|
echo $fqdn
|
||||||
|
ssh -i $rsa_key -t $fqdn $update_command
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
done
|
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env xonsh
|
|
||||||
|
|
||||||
hosts = [
|
|
||||||
"nixos-management",
|
|
||||||
"grav",
|
|
||||||
"heimdall",
|
|
||||||
"mail",
|
|
||||||
"plex",
|
|
||||||
"proxy",
|
|
||||||
"rss-bridge",
|
|
||||||
"ttrss",
|
|
||||||
]
|
|
||||||
|
|
||||||
update_command = 'tmux new -s updates "cd ~/.nixos && git pull && sudo nixos-rebuild -j auto switch || bash;"'
|
|
||||||
rsa_key = "~/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
|
||||||
|
|
||||||
for host in hosts:
|
|
||||||
fqdn = "{}.2li.local".format(host)
|
|
||||||
print(fqdn)
|
|
||||||
print("-" * len(fqdn))
|
|
||||||
ssh -i @(rsa_key) -t @(fqdn) @(update_command)
|
|
||||||
print("")
|
|
||||||
print("")
|
|
Loading…
Reference in New Issue