diff options
| author | Kleidi Bujari <mail@4kb.net> | 2024-12-01 22:30:26 -0500 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2024-12-01 22:30:26 -0500 |
| commit | f08f3812f40322b6098d75573413ed83f358871f (patch) | |
| tree | 0f864c4695dab404e261e6bf179cfc1b04d6c7f5 /modules/xnet/disk/default.nix | |
| parent | 3ccc7e784a0ed5b19910ab856f6d9774a6f27956 (diff) | |
| download | depot-f08f3812f40322b6098d75573413ed83f358871f.tar.gz depot-f08f3812f40322b6098d75573413ed83f358871f.tar.bz2 depot-f08f3812f40322b6098d75573413ed83f358871f.zip | |
Cleanup xnet module and add baseline modules
With these changes, the xnet module is useable as a system builder. At
this point, it is still undecided whether all configuration will be
generalized into this module, rather than keeping mini-modules local to
the machine they will run on.
Diffstat (limited to 'modules/xnet/disk/default.nix')
| -rw-r--r-- | modules/xnet/disk/default.nix | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/modules/xnet/disk/default.nix b/modules/xnet/disk/default.nix deleted file mode 100644 index aca6ae2..0000000 --- a/modules/xnet/disk/default.nix +++ /dev/null @@ -1,113 +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 = [ - ./boot.nix - (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 = "Underlying device that build the root ZFS pool."; - }; - - extraDatasets = mkOption { }; - }; - - config = mkIf cfg.enable { - networking.hostId = builtins.substring 0 8 - (builtins.hashString "md5" config.networking.hostName); - - services.zfs = { - autoScrub.enable = true; - trim.enable = true; - }; - - zramSwap.enable = mkDefault true; - - boot = { - kernelParams = [ "nohibernate" "elevator=none" ]; - supportedFilesystems = [ "vfat" "zfs" ]; - zfs.devNodes = "/dev/disk/by-partuuid"; - }; - - disko.devices = (import ./layouts/single.nix cfg.device) // { - 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; - }; - - "local/reserved" = { - type = "zfs_fs"; - options = { - refreservation = "10G"; - mountpoint = "none"; - }; - }; - - "local/nix" = { - type = "zfs_fs"; - mountpoint = "/nix"; - options.mountpoint = "legacy"; - }; - - "local/certs" = { - type = "zfs_fs"; - mountpoint = "/certs"; - options.mountpoint = "legacy"; - }; - - "persist" = { - type = "zfs_fs"; - mountpoint = "/persist"; - options = { mountpoint = "legacy"; } // commonOpts; - }; - - "persist/data" = { - type = "zfs_fs"; - mountpoint = "/persist/data"; - options.mountpoint = "legacy"; - }; - } // cfg.extraDatasets; - }; - }; - - users.groups.backup = { - members = [ config.services.syncoid.group ]; - gid = 2001; - }; - }; -} |
