1
0

hosts/palladium: Remove services

This commit is contained in:
clerie 2025-03-10 19:18:56 +01:00
parent a8b084628f
commit 9bb1d93db7
2 changed files with 0 additions and 67 deletions

@ -1,44 +0,0 @@
{ pkgs, ... }:
let
cb-mount = pkgs.writeScriptBin "cb-mount" ''
#!${pkgs.bash}/bin/bash
DEVICE=/dev/disk/by-path/pci-0000:00:12.0-ata-2-part1
${pkgs.cryptsetup}/bin/cryptsetup luksOpen ''${DEVICE} external-drive
mkdir -p /mnt/external-drive
mount /dev/mapper/external-drive /mnt/external-drive
mkdir -p /mnt/external-drive/clerie-backup
chown borg:borg -R /mnt/external-drive/clerie-backup
'';
cb-unmount = pkgs.writeScriptBin "cb-unmount" ''
#!${pkgs.bash}/bin/bash
umount /mnt/external-drive
${pkgs.cryptsetup}/bin/cryptsetup luksClose external-drive
'';
cb-prepare = pkgs.writeScriptBin "cb-prepare" ''
echo "Formatting disk"
sgdisk -Z /dev/disk/by-path/pci-0000:00:12.0-ata-2
sgdisk -N 1 /dev/disk/by-path/pci-0000:00:12.0-ata-2
partprobe /dev/disk/by-path/pci-0000:00:12.0-ata-2
echo "Creating encrypted partition"
${pkgs.cryptsetup}/bin/cryptsetup luksFormat -c aes-xts-plain64 --hash=sha256 -s 256 /dev/disk/by-path/pci-0000:00:12.0-ata-2-part1
echo "Opening encrypted partition"
${pkgs.cryptsetup}/bin/cryptsetup luksOpen /dev/disk/by-path/pci-0000:00:12.0-ata-2-part1 external-drive
echo "Creating file system"
mkfs.ext4 /dev/mapper/external-drive
echo "Closing encrypted partition"
${pkgs.cryptsetup}/bin/cryptsetup luksClose external-drive
'';
in {
environment.systemPackages = [ cb-mount cb-unmount cb-prepare ];
}

@ -4,8 +4,6 @@
imports =
[
./hardware-configuration.nix
./backup-scripts.nix
];
boot.loader.systemd-boot.enable = true;
@ -24,27 +22,6 @@
KERNEL=="sd?[0-9]", ENV{ID_MODEL}=="ST1000DM003-1SB102", ACTION=="add", RUN+="${pkgs.hdparm}/sbin/hdparm -S 24 /dev/%k"
'';
services.borgbackup.repos = {
clerie-backup = {
path = "/mnt/palladium/clerie-backup";
authorizedKeysAppendOnly = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFyk716RnbenPMkhLolyIkU8ywUSg8x7hjsXFFQoJx4I root@clerie-backup"
];
};
external-drive = {
path = "/mnt/external-drive/clerie-backup";
authorizedKeysAppendOnly = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPuh74Esdp8JPgIZzM372DaCwtAl2QNtRratnIFG0NRB root@clerie-backup"
];
};
};
# Disable automatic directory creation for external-drive repo
# The directory gets created by the disk formatting script
# Correct permissons will be set right after mounting
# This prevents borg from filling up the root drive when no drive is mounted
systemd.services.borgbackup-repo-external-drive.enable = false;
clerie.monitoring = {
enable = true;
id = "206";