From c3a19fb6f91137402406e63d84abc874a23a42a3 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Tue, 17 Sep 2024 09:57:13 -0500 Subject: [PATCH] created disko config for defiant --- hosts/defiant/configuration.nix | 8 ++++++- hosts/defiant/disko-config.nix | 42 ++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/hosts/defiant/configuration.nix b/hosts/defiant/configuration.nix index 594e83f..e42db42 100644 --- a/hosts/defiant/configuration.nix +++ b/hosts/defiant/configuration.nix @@ -32,7 +32,10 @@ boot.supportedFilesystems = [ "zfs" ]; - networking.hostId = "c8985fc5"; # TODO: populate this when I get home + boot.zfs.extraPools = [ "zpool" ]; + + # this might need to match the hostId of the installation medium? `head -c 8 /etc/machine-id` NOPE + networking.hostId = "c51763d6"; networking.hostName = "defiant"; # Define your hostname. nixpkgs.config.allowUnfree = true; @@ -46,6 +49,9 @@ services.xserver.desktopManager.gnome.enable = true; services.xserver.desktopManager.xterm.enable = false; + # Get rid of xTerm + services.xserver.excludePackages = [ pkgs.xterm ]; + # disable computer sleeping systemd.targets.sleep.enable = false; systemd.targets.suspend.enable = false; diff --git a/hosts/defiant/disko-config.nix b/hosts/defiant/disko-config.nix index 10ec163..653f29f 100644 --- a/hosts/defiant/disko-config.nix +++ b/hosts/defiant/disko-config.nix @@ -33,7 +33,32 @@ let size = "100%"; content = { type = "zfs"; - pool = "zpool"; + pool = "zroot"; + }; + }; + }; + }; + }; + cacheDisk = devicePath: swapSize: { + type = "disk"; + device = devicePath; + content = { + type = "gpt"; + partitions = { + encryptedSwap = { + size = swapSize; + content = { + type = "swap"; + randomEncryption = true; + discardPolicy = "both"; + resumeDevice = true; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; }; }; }; @@ -48,10 +73,10 @@ in { hd_13_tb_b = zfsDisk "/dev/disk/by-id/ata-ST18000NE000-3G6101_ZVTCXWSC"; hd_13_tb_c = zfsDisk "/dev/disk/by-id/ata-ST18000NE000-3G6101_ZVTD10EH"; - # ssd_2_tb_a = zfsDisk "/dev/disk/by-id/XXX"; + # ssd_2_tb_a = cacheDisk "64G" "/dev/disk/by-id/XXX"; }; zpool = { - zpool = { + zroot = { type = "zpool"; mode = { topology = { @@ -73,7 +98,7 @@ in { options = { ashift = "12"; }; - + rootFsOptions = { encryption = "on"; keyformat = "hex"; @@ -83,19 +108,18 @@ in { acltype = "posixacl"; "com.sun:auto-snapshot" = "false"; }; + + mountpoint = "/"; + postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot@blank$' || zfs snapshot zroot@blank"; datasets = { - "root" = { - type = "zfs_fs"; - mountpoint = "/"; - }; "nix" = { type = "zfs_fs"; mountpoint = "/nix"; }; "home" = { type = "zfs_fs"; - mountpoint = "/home"; + mountpoint = "/mnt/home"; options = { "com.sun:auto-snapshot" = "true"; };