mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01: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
|
||||
|
||||
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 'mkdir -p /mnt/etc/ssh'
|
||||
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'
|
||||
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
|
||||
ssh -o StrictHostKeyChecking=no root@installer 'nixos-install --flake github:SebastianStork/nixos-config/61083d4359d379981d4bd838998820199c5d8bb9#{{ host }}'
|
||||
ssh -o StrictHostKeyChecking=no root@installer 'reboot'
|
||||
ssh -o StrictHostKeyChecking=no root@installer 'nixos-install --flake github:SebastianStork/nixos-config/61083d4359d379981d4bd838998820199c5d8bb9#{{ host }} && reboot'
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@
|
|||
(pkgs.writeShellApplication {
|
||||
name = "actual-restore";
|
||||
text = ''
|
||||
sudo systemctl stop actual.service
|
||||
sudo restic-actual restore latest --target /
|
||||
sudo systemctl start actual.service
|
||||
sudo bash -c "
|
||||
systemctl stop actual.service
|
||||
restic-actual restore latest --target /
|
||||
systemctl start actual.service
|
||||
"
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@
|
|||
(pkgs.writeShellApplication {
|
||||
name = "hedgedoc-restore";
|
||||
text = ''
|
||||
sudo systemctl stop hedgedoc.service
|
||||
sudo restic-hedgedoc restore latest --target /
|
||||
sudo systemctl start hedgedoc.service
|
||||
sudo bash -c "
|
||||
systemctl stop hedgedoc.service
|
||||
restic-hedgedoc restore latest --target /
|
||||
systemctl start hedgedoc.service
|
||||
"
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
|
|
|||
|
|
@ -40,10 +40,12 @@ in
|
|||
(pkgs.writeShellApplication {
|
||||
name = "nextcloud-restore";
|
||||
text = ''
|
||||
sudo --user=${user} ${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||
sudo --user=${user} restic-nextcloud restore latest --target /
|
||||
sudo --user=${user} pg_restore --clean --if-exists --dbname nextcloud ${cfg.dataDir}/backup/db.dump
|
||||
sudo --user=${user} ${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --off
|
||||
sudo --user=${user} bash -c "
|
||||
${lib.getExe' config.services.nextcloud.occ "nextcloud-occ"} maintenance:mode --on
|
||||
restic-nextcloud restore latest --target /
|
||||
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