mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
Refactor scripts
This commit is contained in:
parent
e558859799
commit
da7a7b7328
4 changed files with 18 additions and 14 deletions
6
justfile
6
justfile
|
|
@ -20,9 +20,7 @@ dev shell='default':
|
||||||
nix develop .#{{ shell }} --command zsh
|
nix develop .#{{ shell }} --command zsh
|
||||||
|
|
||||||
install host:
|
install host:
|
||||||
ssh -o StrictHostKeyChecking=no root@installer 'disko --mode destroy,format,mount --yes-wipe-all-disks --flake github:SebastianStork/nixos-config/61083d4359d379981d4bd838998820199c5d8bb9#{{ host }}'
|
ssh -o StrictHostKeyChecking=no root@installer 'disko --mode destroy,format,mount --yes-wipe-all-disks --flake github:SebastianStork/nixos-config/61083d4359d379981d4bd838998820199c5d8bb9#{{ host }} && mkdir -p /mnt/etc/ssh'
|
||||||
ssh -o StrictHostKeyChecking=no root@installer 'mkdir -p /mnt/etc/ssh'
|
|
||||||
scp -o StrictHostKeyChecking=no ~/.ssh/{{ host }} root@installer:/mnt/etc/ssh/ssh_host_ed25519_key
|
scp -o StrictHostKeyChecking=no ~/.ssh/{{ host }} root@installer:/mnt/etc/ssh/ssh_host_ed25519_key
|
||||||
scp -o StrictHostKeyChecking=no ~/.ssh/{{ host }}.pub root@installer:/mnt/etc/ssh/ssh_host_ed25519_key.pub
|
scp -o StrictHostKeyChecking=no ~/.ssh/{{ host }}.pub root@installer:/mnt/etc/ssh/ssh_host_ed25519_key.pub
|
||||||
ssh -o StrictHostKeyChecking=no root@installer 'nixos-install --flake github:SebastianStork/nixos-config/61083d4359d379981d4bd838998820199c5d8bb9#{{ host }}'
|
ssh -o StrictHostKeyChecking=no root@installer 'nixos-install --flake github:SebastianStork/nixos-config/61083d4359d379981d4bd838998820199c5d8bb9#{{ host }} && reboot'
|
||||||
ssh -o StrictHostKeyChecking=no root@installer 'reboot'
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,11 @@
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "actual-restore";
|
name = "actual-restore";
|
||||||
text = ''
|
text = ''
|
||||||
sudo systemctl stop actual.service
|
sudo bash -c "
|
||||||
sudo restic-actual restore latest --target /
|
systemctl stop actual.service
|
||||||
sudo systemctl start actual.service
|
restic-actual restore latest --target /
|
||||||
|
systemctl start actual.service
|
||||||
|
"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,11 @@
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "hedgedoc-restore";
|
name = "hedgedoc-restore";
|
||||||
text = ''
|
text = ''
|
||||||
sudo systemctl stop hedgedoc.service
|
sudo bash -c "
|
||||||
sudo restic-hedgedoc restore latest --target /
|
systemctl stop hedgedoc.service
|
||||||
sudo systemctl start hedgedoc.service
|
restic-hedgedoc restore latest --target /
|
||||||
|
systemctl start hedgedoc.service
|
||||||
|
"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,12 @@ in
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "nextcloud-restore";
|
name = "nextcloud-restore";
|
||||||
text = ''
|
text = ''
|
||||||
sudo --user=${user} ${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
sudo --user=${user} bash -c "
|
||||||
sudo --user=${user} restic-nextcloud restore latest --target /
|
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||||
sudo --user=${user} pg_restore --clean --if-exists --dbname nextcloud ${cfg.dataDir}/backup/db.dump
|
restic-nextcloud restore latest --target /
|
||||||
sudo --user=${user} ${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
pg_restore --clean --if-exists --dbname nextcloud ${cfg.dataDir}/backup/db.dump
|
||||||
|
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
||||||
|
"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue