forked from Fachschaft/nixConfig
Create backuphost Bragi
This commit is contained in:
parent
4a65723e05
commit
e50b44147e
5 changed files with 171 additions and 2 deletions
15
nixos/machines/bragi/configuration.nix
Normal file
15
nixos/machines/bragi/configuration.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
../../roles
|
||||||
|
../../roles/hardware.nix
|
||||||
|
./network.nix
|
||||||
|
../../modules/borgbackup.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
services.mathebau-borgbackup.enable = true;
|
||||||
|
|
||||||
|
# System configuration here
|
||||||
|
networking.hostName = "bragi";
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
}
|
36
nixos/machines/bragi/hardware-configuration.nix
Normal file
36
nixos/machines/bragi/hardware-configuration.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{lib, ...}: {
|
||||||
|
imports = [];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "gha-root";
|
||||||
|
fsType = "tmpfs";
|
||||||
|
options = ["size=1G" "mode=755"];
|
||||||
|
};
|
||||||
|
fileSystems."/persist" = {
|
||||||
|
device = "/dev/disk/by-uuid/b75e52a1-deee-45d4-b958-086bdaeb4fa4";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=persist"];
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/6b86ec51-b854-4227-9b05-c8e15f7b2e62";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = "/dev/disk/by-uuid/b75e52a1-deee-45d4-b958-086bdaeb4fa4";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=nix"];
|
||||||
|
};
|
||||||
|
fileSystems."/var/lib/backups" = {
|
||||||
|
device = "/dev/disk/by-label/backups";
|
||||||
|
fsType = "btrfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# swapDevices = [{device = "/dev/disk/by-uuid/";}]; #TODO
|
||||||
|
|
||||||
|
boot.loader.grub.device = "/dev/sda";
|
||||||
|
|
||||||
|
nix.settings.max-jobs = lib.mkDefault 4;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
}
|
16
nixos/machines/bragi/network.nix
Normal file
16
nixos/machines/bragi/network.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# We sohuld put that config somewhere in roles and give it a parameter or something,
|
||||||
|
# everyone gets the same nameserver and the same prefixLength and address vs defaultGateway alsways
|
||||||
|
# depend on the same thing
|
||||||
|
{
|
||||||
|
imports = [];
|
||||||
|
networking = {
|
||||||
|
interfaces.enp0s25.ipv4.addresses = [
|
||||||
|
{
|
||||||
|
address = "192.168.1.11";
|
||||||
|
prefixLength = 24;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
defaultGateway = "192.168.1.137";
|
||||||
|
nameservers = ["130.83.2.22" "130.83.56.60" "130.83.22.60" "130.82.22.63"];
|
||||||
|
};
|
||||||
|
}
|
102
nixos/modules/borgbackup.nix
Normal file
102
nixos/modules/borgbackup.nix
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit
|
||||||
|
(lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
;
|
||||||
|
cfg = config.services.mathebau-borgbackup;
|
||||||
|
in {
|
||||||
|
imports = [];
|
||||||
|
|
||||||
|
options.services.mathebau-borgbackup = {
|
||||||
|
enable = mkEnableOption "mathebau borgbackup service";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.borgbackup = {
|
||||||
|
repos = {
|
||||||
|
aphoom-zhah = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA8pI6uinXezAMH4vG2yEbu/yOYU5vXcsZN74tYgV+Wj Aphoom-Zhah Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/aphoom-zhah";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
azathoth = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGBEwllQ77ktoirXX6dJ6ET8TfK4lzq0aaq+X4rrX2Vk Azathoth Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/azathoth";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
cthulhu = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSJl1MvabUADTdOCgufsBzn1tIIpxMq4iDcYZsaW1lV Cthulhu Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/cthulhu";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
dagon = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJaTBennwqT9eB43gVD1nM1os3dMPZ8RWwIKPEjqMK5V Dagon Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/dagon";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
eihort = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLoDxtY4Tp6NKxLt9oHmWT6w4UpU6eA1TnPU2Ut83BN Eihort Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/eihort";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
hastur = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeDvTyOUdIPARatX0PPhHgrV1gjERWLt2Twa8E2GETb Hastur Backupsystem"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/hastur";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
ithaqua = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJmBf8cz3FTDdeuxWbp1MO2yPT5rvH8ZIGUzfogjpXi Ithaqua Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/ithaqua";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
sanctamariamaterdei = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH9Le5OI4ympQ0mQKYHmxgxGF598rzpD5VVpWK1mGfd8 Sanctamariamaterdei Backupsystem"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/sanctamariamaterdei";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
tsathoggua = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKS9/1lFOhv+3sNuGcysM3TYh2xRrjMeAZX3K7CBx0QW Tsathoggua Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/tsathoggua";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
uvhash = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB8DjIqgFgmYhQnTLpbqL0r7xBPb8TPy6SO5RhQ31OGj Uvhash Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/uvhash";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
yibb-tstll = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINlnGOV58Ks9lu+WTI4F7QAHtDrJq2jY8ZocITZG8K0+ Yibb-Tstll Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/backups/yibb-tstll";
|
||||||
|
allowSubRepos = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
# Bootloader
|
# Bootloader
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
# boot.loader.efi.canTouchEfiVariables = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue