diff options
Diffstat (limited to '')
-rw-r--r-- | hosts/kaitain/default.nix | 57 | ||||
-rw-r--r-- | hosts/kaitain/disks.nix | 104 | ||||
-rw-r--r-- | hosts/kaitain/hardware-configuration.nix | 44 |
3 files changed, 205 insertions, 0 deletions
diff --git a/hosts/kaitain/default.nix b/hosts/kaitain/default.nix new file mode 100644 index 0000000..b83a2c1 --- /dev/null +++ b/hosts/kaitain/default.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: { + boot = { + initrd.kernelModules = [ "zfs" ]; + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + loader.grub.device = "/dev/sda"; + supportedFilesystems = [ "zfs" ]; + #zfs.devNodes = "/dev/disk/by-label"; + }; + + environment.systemPackages = with pkgs; [ + git-review + ]; + + imports = [ + ./hardware-configuration.nix + ../common/core + #../common/optional/db.nix + ../common/optional/dev.nix + ../common/optional/misc.nix + #../common/optional/multimedia.nix + ../common/optional/pipewire.nix + ../common/optional/services/openssh.nix + ../common/optional/services/xorg.nix + ../common/optional/zfs.nix + ../common/users/nipsy + ../common/users/root + ]; + + networking = { + hostId = "4b1f6e29"; + hostName = "kaitain"; + nftables.enable = true; + }; + + services.xserver.videoDrivers = lib.mkForce [ "vmware" "virtualbox" "modesetting" ]; + + system.stateVersion = "23.11"; + + #systemd.user.services = let + # vbox-client = desc: flags: { + # description = "VirtualBox Guest: ${desc}"; + + # wantedBy = [ "graphical-session.target" ]; + # requires = [ "dev-vboxguest.device" ]; + # after = [ "dev-vboxguest.device" ]; + + # unitConfig.ConditionVirtualization = "oracle"; + + # serviceConfig.ExecStart = "${config.boot.kernelPackages.virtualboxGuestAdditions}/bin/VBoxClient -fv ${flags}"; + # }; + #in { + # virtualbox-resize = vbox-client "Resize" "--vmsvga"; + # virtualbox-clipboard = vbox-client "Clipboard" "--clipboard"; + #}; + + virtualisation.virtualbox.guest.enable = true; +} diff --git a/hosts/kaitain/disks.nix b/hosts/kaitain/disks.nix new file mode 100644 index 0000000..c8bcd5c --- /dev/null +++ b/hosts/kaitain/disks.nix @@ -0,0 +1,104 @@ +{ + disko.devices = { + disk = { + sda = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "defaults" ]; + extraArgs = [ "-n boot" ]; + }; + }; + swap = { + size = "16G"; + type = "8200"; + content = { + type = "swap"; + extraArgs = [ "-L swap" ]; + }; + }; + rpool = { + size = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + zpool = { + rpool = { + type = "zpool"; + rootFsOptions = { + acltype = "posixacl"; + canmount = "off"; + compression = "on"; + dnodesize = "auto"; + encryption = "aes-256-gcm"; + keyformat = "passphrase"; + keylocation = "file:///tmp/data.keyfile"; + #normalization = "formD"; # disabled due to previous issue: https://github.com/NixOS/nixpkgs/pull/86432 + relatime = "on"; + xattr = "sa"; + }; + postCreateHook = '' + zfs set keylocation="prompt" rpool + ''; + options = { + ashift = "12"; + #autotrim = "on"; + }; + datasets = { + "local" = { + type = "zfs_fs"; + options.mountpoint = "none"; + }; + "local/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/"; + }; + "local/nix" = { + type = "zfs_fs"; + options = { + atime = "off"; + mountpoint = "legacy"; + }; + mountpoint = "/nix"; + }; + "user" = { + type = "zfs_fs"; + options.mountpoint = "none"; + mountpoint = "/home"; + }; + "user/home" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home"; + }; + "user/home/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/root"; + }; + "user/home/nipsy" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home/nipsy"; + }; + }; + }; + }; + }; +} diff --git a/hosts/kaitain/hardware-configuration.nix b/hosts/kaitain/hardware-configuration.nix new file mode 100644 index 0000000..0ca1a06 --- /dev/null +++ b/hosts/kaitain/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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 = [ "ohci_pci" "ehci_pci" "ata_piix" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "rpool/local/root"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + fileSystems."/nix" = + { device = "rpool/local/nix"; + fsType = "zfs"; + }; + + fileSystems."/root" = + { device = "rpool/user/home/root"; + fsType = "zfs"; + }; + + fileSystems."/home/nipsy" = + { device = "rpool/user/home/nipsy"; + fsType = "zfs"; + }; + + swapDevices = + [ { device = "/dev/disk/by-label/swap"; } + ]; +} |