diff --git a/flake.nix b/flake.nix index 1b72c2a..7964e7c 100644 --- a/flake.nix +++ b/flake.nix @@ -66,6 +66,13 @@ }; # servers + db-01 = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + specialArgs = { inherit inputs outputs; }; + modules = [ + ./hosts/db-01 + ]; + }; hosting-01 = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; specialArgs = { inherit inputs outputs; }; diff --git a/hosts/db-01/default.nix b/hosts/db-01/default.nix new file mode 100644 index 0000000..c149256 --- /dev/null +++ b/hosts/db-01/default.nix @@ -0,0 +1,26 @@ +{ + inputs, + config, + ... +}: +{ + imports = [ + ./disk-config.nix + { + _module.args.disks = [ "/dev/sda" ]; + } + + ../common/servers + ]; + + time.timeZone = "Europe/Berlin"; + + networking.hostName = "db-01"; + networking.nameservers = [ "8.8.8.8" ]; + + services.postgresql = { + enable = true; + }; + + system.stateVersion = "25.05"; +} diff --git a/hosts/db-01/disk-config.nix b/hosts/db-01/disk-config.nix new file mode 100644 index 0000000..aa2e1fa --- /dev/null +++ b/hosts/db-01/disk-config.nix @@ -0,0 +1,52 @@ +{ + lib, + disks ? [ "/dev/sda" ], + ... +}: +{ + disko.devices = { + disk = lib.genAttrs disks (disk: { + device = disk; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "256M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + main = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # override existing partition + subvolumes = { + "/" = { + mountOptions = [ "compress=zstd" ]; + mountpoint = "/"; + }; + "/home" = { + mountOptions = [ "compress=zstd" ]; + mountpoint = "/home"; + }; + "/nix" = { + mountOptions = [ + "compress=zstd" + "noatime" + ]; + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + }); + }; +}