summaryrefslogtreecommitdiff
path: root/machines/xnet/disk.nix
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2025-04-02 22:11:38 -0400
committerKleidi Bujari <mail@4kb.net>2025-04-02 22:11:38 -0400
commitc950f338c5720a132552863a35d1c7924df3d3a6 (patch)
treec3134c42e1618c255ca8e9e0698f90b0ae8b3563 /machines/xnet/disk.nix
parentb619ff9dd42eaa62569c8297142f0e4c719d40d2 (diff)
parent09c2b6de63a6ff35348fcb2c2eb57b974f0a8a52 (diff)
downloaddepot-c950f338c5720a132552863a35d1c7924df3d3a6.tar.gz
depot-c950f338c5720a132552863a35d1c7924df3d3a6.tar.bz2
depot-c950f338c5720a132552863a35d1c7924df3d3a6.zip
Merge remote-tracking branch 'origin/copy-blueprint'
Diffstat (limited to 'machines/xnet/disk.nix')
-rw-r--r--machines/xnet/disk.nix154
1 files changed, 0 insertions, 154 deletions
diff --git a/machines/xnet/disk.nix b/machines/xnet/disk.nix
deleted file mode 100644
index 26b6909..0000000
--- a/machines/xnet/disk.nix
+++ /dev/null
@@ -1,154 +0,0 @@
-{ config, lib, modulesPath, ... }:
-let
- cfg = config.xnet.disk;
- commonOpts = {
- acltype = "posixacl";
- atime = "off";
- compression = "on";
- normalization = "formD";
- relatime = "off";
- xattr = "sa";
- "com.sun:auto-snapshot" = "false";
- };
-
- inherit (lib) mkOption mkDefault mkIf types;
-in
-{
- imports = [
- (modulesPath + "/installer/scan/not-detected.nix")
- ];
-
- options.xnet.disk = {
- enable = mkOption {
- type = types.bool;
- default = false;
- description = "Apply xnet-standard ZFS disk layout.";
- };
-
- device = mkOption {
- type = types.str;
- description = "Device used for zroot ZFS pool.";
- };
- };
-
- config = mkIf cfg.enable {
- networking.hostId = builtins.substring 0 8
- (builtins.hashString "md5" config.networking.hostName);
-
- services.zfs = {
- autoScrub.enable = true;
- trim.enable = true;
- };
-
- # With root running in memory, swap should be required unless
- # otherwise specified
- zramSwap.enable = mkDefault true;
-
- boot = {
- kernelParams = [ "nohibernate" "elevator=none" ];
- supportedFilesystems = [ "vfat" "zfs" ];
- zfs.devNodes = mkDefault "/dev/disk/by-partuuid";
- loader = {
- systemd-boot.enable = true;
- efi.canTouchEfiVariables = true;
- };
- initrd = {
- systemd.enable = true;
- availableKernelModules = [
- "xhci_pci"
- "ahci"
- "nvme"
- "usb_storage"
- "sd_mod"
- "sdhci_pci"
- ];
- };
- tmp.cleanOnBoot = mkDefault true;
- };
-
- disko.devices.disk.main = {
- type = "disk";
- device = cfg.device;
- content = {
- type = "gpt";
- partitions.ESP = {
- size = "1G";
- type = "EF00";
- content = {
- type = "filesystem";
- format = "vfat";
- mountpoint = "/boot";
- };
- };
- partitions.ZFS = {
- size = "100%";
- content = {
- type = "zfs";
- pool = "zroot";
- };
- };
- };
- };
-
- disko.devices = {
- nodev."/" = {
- fsType = "tmpfs";
- mountOptions = [ "defaults" "size=2G" "mode=755" ];
- };
-
- zpool.zroot = {
- type = "zpool";
- options = {
- ashift = "12";
- autotrim = "on";
- };
-
- datasets = {
- "local" = {
- type = "zfs_fs";
- options = commonOpts // {
- mountpoint = "none";
- };
- };
-
- "local/nix" = {
- type = "zfs_fs";
- mountpoint = "/nix";
- options.mountpoint = "legacy";
- };
-
- "local/reserved" = {
- type = "zfs_fs";
- options = {
- refreservation = "10G";
- mountpoint = "none";
- };
- };
-
- "persist" = {
- type = "zfs_fs";
- mountpoint = "/persist";
- options = commonOpts // {
- mountpoint = "legacy";
- };
- };
- };
- };
- };
-
- services.sanoid = {
- enable = true;
- templates.default = {
- autosnap = true;
- autoprune = true;
- hourly = 24;
- daily = 14;
- monthly = 1;
- };
- datasets."zroot/persist" = {
- useTemplate = [ "default" ];
- recursive = true;
- };
- };
- };
-}