diff --git a/flake.nix b/flake.nix index b09a986..771f21e 100644 --- a/flake.nix +++ b/flake.nix @@ -79,6 +79,11 @@ stableNixosConfig = nixosConfig nixpkgs; unstableNixosConfig = nixosConfig nixpkgs-unstable; in { + bakke = stableNixosConfig "bakke" { + modules = [ + disko.nixosModules.disko + ]; + }; bicep = stableNixosConfig "bicep" { modules = [ inputs.matrix-next.nixosModules.default diff --git a/hosts/bakke/configuration.nix b/hosts/bakke/configuration.nix new file mode 100644 index 0000000..1aa2b9e --- /dev/null +++ b/hosts/bakke/configuration.nix @@ -0,0 +1,26 @@ +{ config, pkgs, values, ... }: +{ + imports = [ + ./hardware-configuration.nix + ../../base + ../../misc/metrics-exporters.nix + ./filesystems.nix + ]; + + sops.defaultSopsFile = ../../secrets/bakke/bakke.yaml; + sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; + sops.age.keyFile = "/var/lib/sops-nix/key.txt"; + sops.age.generateKey = true; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "bakke"; + networking.hostId = "99609ffc"; + systemd.network.networks."30-enp2s0" = values.defaultNetworkConfig // { + matchConfig.Name = "enp2s0"; + address = with values.hosts.bakke; [ (ipv4 + "/25") (ipv6 + "/64") ]; + }; + + system.stateVersion = "24.05"; +} diff --git a/hosts/bakke/disks.nix b/hosts/bakke/disks.nix new file mode 100644 index 0000000..e7d1a5b --- /dev/null +++ b/hosts/bakke/disks.nix @@ -0,0 +1,83 @@ +{ + # https://github.com/nix-community/disko/blob/master/example/boot-raid1.nix + # Note: Disko was used to create the initial md raid, but is no longer in active use on this host. + disko.devices = { + disk = { + one = { + type = "disk"; + device = "/dev/disk/by-id/ata-WDC_WD40EFRX-68WT0N0_WD-WCC4E2EER6N6"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "500M"; + type = "EF00"; + content = { + type = "mdraid"; + name = "boot"; + }; + }; + mdadm = { + size = "100%"; + content = { + type = "mdraid"; + name = "raid1"; + }; + }; + }; + }; + }; + two = { + type = "disk"; + device = "/dev/disk/by-id/ata-WDC_WD40EFRX-68WT0N0_WD-WCC4E7LPLU71"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "500M"; + type = "EF00"; + content = { + type = "mdraid"; + name = "boot"; + }; + }; + mdadm = { + size = "100%"; + content = { + type = "mdraid"; + name = "raid1"; + }; + }; + }; + }; + }; + }; + mdadm = { + boot = { + type = "mdadm"; + level = 1; + metadata = "1.0"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + raid1 = { + type = "mdadm"; + level = 1; + content = { + type = "gpt"; + partitions.primary = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/bakke/filesystems.nix b/hosts/bakke/filesystems.nix new file mode 100644 index 0000000..9312a0c --- /dev/null +++ b/hosts/bakke/filesystems.nix @@ -0,0 +1,26 @@ +{ config, pkgs, lib, ... }: +{ + # Boot drives: + boot.swraid.enable = true; + + # ZFS Data pool: + environment.systemPackages = with pkgs; [ zfs ]; + boot = { + zfs = { + extraPools = [ "tank" ]; + requestEncryptionCredentials = false; + }; + supportedFilesystems = [ "zfs" ]; + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + }; + services.zfs.autoScrub = { + enable = true; + interval = "Wed *-*-8..14 00:00:00"; + }; + + # NFS Exports: + #TODO + + # NFS Import mounts: + #TODO +} diff --git a/hosts/bakke/hardware-configuration.nix b/hosts/bakke/hardware-configuration.nix new file mode 100644 index 0000000..3ada267 --- /dev/null +++ b/hosts/bakke/hardware-configuration.nix @@ -0,0 +1,33 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/873e1891-d9f8-470f-9c57-e1b4c8b7bf0e"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-id/ata-WDC_WD40EFRX-68WT0N0_WD-WCC4E7LPLU71-part1"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + networking.useDHCP = lib.mkDefault false; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/values.nix b/values.nix index 2e9d266..7ccf30b 100644 --- a/values.nix +++ b/values.nix @@ -27,6 +27,10 @@ in rec { gateway = pvv-ipv4 129; gateway6 = pvv-ipv6 1; + bakke = { + ipv4 = pvv-ipv4 173; + ipv6 = pvv-ipv6 173; + }; bekkalokk = { ipv4 = pvv-ipv4 168; ipv6 = pvv-ipv6 168;