forked from Fachschaft/nixConfig
Create backuphost Bragi
This commit is contained in:
parent
45d0ef262f
commit
3b4272bba9
4 changed files with 92 additions and 0 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";
|
||||||
|
}
|
30
nixos/machines/bragi/hardware-configuration.nix
Normal file
30
nixos/machines/bragi/hardware-configuration.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{lib, ...}: {
|
||||||
|
imports = [];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "gha-root";
|
||||||
|
fsType = "tmpfs";
|
||||||
|
options = ["size=1G" "mode=755"];
|
||||||
|
};
|
||||||
|
fileSystems."/persist" = {
|
||||||
|
device = "/dev/disk/by-uuid/c5f16a0f-da17-410c-8f3b-af8617a87e51"; #TODO
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=persist"];
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/D35C-0683"; #TODO
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = "/dev/disk/by-uuid/c5f16a0f-da17-410c-8f3b-af8617a87e51"; #TODO
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=nix"];
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [{device = "/dev/disk/by-uuid/";}]; #TODO
|
||||||
|
|
||||||
|
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.enp4s0f1.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"];
|
||||||
|
};
|
||||||
|
}
|
31
nixos/modules/borgbackup.nix
Normal file
31
nixos/modules/borgbackup.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
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 = {
|
||||||
|
cthulhu = {
|
||||||
|
authorizedKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSJl1MvabUADTdOCgufsBzn1tIIpxMq4iDcYZsaW1lV Cthulhu Backup"
|
||||||
|
];
|
||||||
|
path = "/var/lib/cthulhu";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue