diff --git a/justfile b/justfile index b041769..f4490e9 100644 --- a/justfile +++ b/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' diff --git a/modules/system/actualbudget/backups.nix b/modules/system/actualbudget/backups.nix index 4f0a2b2..5e33188 100644 --- a/modules/system/actualbudget/backups.nix +++ b/modules/system/actualbudget/backups.nix @@ -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 + " ''; }) ]; diff --git a/modules/system/hedgedoc/backups.nix b/modules/system/hedgedoc/backups.nix index f20ed80..7d0d17f 100644 --- a/modules/system/hedgedoc/backups.nix +++ b/modules/system/hedgedoc/backups.nix @@ -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 + " ''; }) ]; diff --git a/modules/system/nextcloud/backups.nix b/modules/system/nextcloud/backups.nix index fb3aebe..4aac19b 100644 --- a/modules/system/nextcloud/backups.nix +++ b/modules/system/nextcloud/backups.nix @@ -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 + " ''; }) ];