From c3589b3a73cbd5d463b77d67672d2ed2e4cd990c Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 1 Jul 2024 12:47:35 -0400 Subject: [PATCH] Yank out Disko config. Can't get it to detect its own root filesystem --- flake.lock | 12 ++-- hosts/Dimaga/default.nix | 10 ---- hosts/Dimaga/hardware-configuration.nix | 75 ++++++++++++++++++++++++- hosts/Haven/default.nix | 10 ---- hosts/Shura/default.nix | 10 ---- modules/system/disko.nix | 14 ++--- 6 files changed, 87 insertions(+), 44 deletions(-) diff --git a/flake.lock b/flake.lock index 905b58b..b10282c 100644 --- a/flake.lock +++ b/flake.lock @@ -158,11 +158,11 @@ ] }, "locked": { - "lastModified": 1719677234, - "narHash": "sha256-qO9WZsj/0E6zcK4Ht1y/iJ8XfwbBzq7xdqhBh44OP/M=", + "lastModified": 1719827439, + "narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=", "owner": "nix-community", "repo": "home-manager", - "rev": "36317d4d38887f7629876b0e43c8d9593c5cc48d", + "rev": "59ce796b2563e19821361abbe2067c3bb4143a7d", "type": "github" }, "original": { @@ -316,11 +316,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1719506693, - "narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=", + "lastModified": 1719690277, + "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a", + "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", "type": "github" }, "original": { diff --git a/hosts/Dimaga/default.nix b/hosts/Dimaga/default.nix index 5f2ab86..9be81fe 100644 --- a/hosts/Dimaga/default.nix +++ b/hosts/Dimaga/default.nix @@ -42,16 +42,6 @@ in tpm2.enable = true; }; - # Use Disko to partition and format disks - disko = { - enable = true; - primaryDiskID = ""; - swapFile = { - enable = true; - size = "16G"; - }; - }; - # Change the default text editor. Options are "emacs", "nano", or "vim". editor = "nano"; diff --git a/hosts/Dimaga/hardware-configuration.nix b/hosts/Dimaga/hardware-configuration.nix index e3dad4c..c07cc5a 100644 --- a/hosts/Dimaga/hardware-configuration.nix +++ b/hosts/Dimaga/hardware-configuration.nix @@ -1 +1,74 @@ -builtins.abort "Need to generate hardware-configuration.nix for Dimaga" \ No newline at end of file +{ + config, + lib, + pkgs, + modulesPath, + ... +}: + +let + primaryDisk = "/dev/disk/by-id/"; + luksDevice = ""; + standardMountOpts = [ + "compress=zstd" + "noatime" + ]; +in +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot = { + initrd = { + availableKernelModules = [ + "xhci_pci" + "nvme" + "usb_storage" + "sd_mod" + "sdhci_pci" + ]; + luks.devices."luks-${luksDevice}" = { + device = "/dev/disk/by-uuid/${luksDevice}"; + crypttabExtraOpts = [ "tpm2-device=auto" ]; # Enable TPM auto-unlocking + }; + }; + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + }; + + fileSystems = { + "/" = { + device = primaryDisk; + fsType = "btrfs"; + options = [ "subvol=@" ] ++ standardMountOpts; + }; + "/home" = { + device = primaryDisk; + fsType = "btrfs"; + options = [ "subvol=@home" ] ++ standardMountOpts; + }; + "/nix" = { + device = primaryDisk; + fsType = "btrfs"; + options = [ "subvol=@nix" ] ++ standardMountOpts; + }; + "/swap" = { + device = primaryDisk; + fsType = "btrfs"; + options = [ "subvol=@swap" ]; + }; + "/boot" = { + device = "/dev/disk/by-uuid/AFCB-D880"; + fsType = "vfat"; + }; + }; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/Haven/default.nix b/hosts/Haven/default.nix index 5850f4c..e68ea6a 100644 --- a/hosts/Haven/default.nix +++ b/hosts/Haven/default.nix @@ -40,16 +40,6 @@ in tpm2.enable = true; }; - # Use Disko to partition and format disks - disko = { - enable = false; - primaryDiskID = "nvme-eui.002538da11443b4d"; - swapFile = { - enable = true; - size = "16G"; - }; - }; - # Change the default text editor. Options are "emacs", "nano", or "vim". editor = "nano"; diff --git a/hosts/Shura/default.nix b/hosts/Shura/default.nix index ddcf346..3e5e382 100644 --- a/hosts/Shura/default.nix +++ b/hosts/Shura/default.nix @@ -53,16 +53,6 @@ in tpm2.enable = true; }; - # Partition disks using Disko - disko = { - enable = false; - primaryDiskID = "nvme-eui.ace42e0025b66c912ee4ac0000000001"; - swapFile = { - enable = true; - size = "16G"; - }; - }; - # Change the default text editor. Options are "emacs", "nano", or "vim". editor = "nano"; diff --git a/modules/system/disko.nix b/modules/system/disko.nix index 081467b..134897d 100644 --- a/modules/system/disko.nix +++ b/modules/system/disko.nix @@ -29,19 +29,19 @@ in config = lib.mkIf cfg.enable { # Check for blank values - assertions = [ - { - assertion = (cfg.primaryDiskID != ""); - message = "aux.system.disko.primaryDiskID is not set. Please enter a valid disk ID."; - } - ]; + assertions = [ + { + assertion = (cfg.primaryDiskID != ""); + message = "aux.system.disko.primaryDiskID is not set. Please enter a valid disk ID."; + } + ]; # Disk management disko.enableConfig = true; disko.devices = { disk = { main = { type = "disk"; - device = "/dev/disk/by-id/${cfg.primaryDisk.id}"; + device = "/dev/disk/by-id/${cfg.primaryDiskID}"; content = { type = "gpt"; partitions = {