From dac00d11b06c02637b803490feeded6a83be7c6e Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 6 Apr 2024 11:53:25 -0400 Subject: [PATCH] petalburg: conver to disko petalburg: add disko to flake --- flake.nix | 1 + hosts/petalburg/default.nix | 1 + hosts/petalburg/disko.nix | 56 ++++++++++++++++++++++ hosts/petalburg/hardware-configuration.nix | 15 ------ 4 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 hosts/petalburg/disko.nix diff --git a/flake.nix b/flake.nix index 64b023b1..9aa32f65 100644 --- a/flake.nix +++ b/flake.nix @@ -81,6 +81,7 @@ system = "x86_64-linux"; specialArgs = { inherit inputs; }; modules = [ + disko-unstable.nixosModules.disko nixos-hardware.nixosModules.common-pc-laptop-ssd nixos-hardware.nixosModules.common-cpu-intel home-manager-unstable.nixosModules.home-manager diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index 953e545e..e98d696f 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -53,6 +53,7 @@ let in { imports = [ + ./disko.nix ./hardware-configuration.nix # Include the results of the hardware scan. ./home.nix ]; diff --git a/hosts/petalburg/disko.nix b/hosts/petalburg/disko.nix new file mode 100644 index 00000000..aab5f743 --- /dev/null +++ b/hosts/petalburg/disko.nix @@ -0,0 +1,56 @@ +{ + disko.devices = { + disk = { + vdb = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "1024M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "rootfs" = { mountpoint = "/"; }; + # For use with future impermanence setups + "persist" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + # Subvolume name is the same as the mountpoint + "home" = { + mountOptions = [ "compress=zstd" ]; + mountpoint = "/home"; + }; + # Parent is not mounted so the mountpoint must be set + "nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + }; + mountpoint = "/partition-root"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/petalburg/hardware-configuration.nix b/hosts/petalburg/hardware-configuration.nix index a7dfd49d..c6b556d0 100644 --- a/hosts/petalburg/hardware-configuration.nix +++ b/hosts/petalburg/hardware-configuration.nix @@ -36,21 +36,6 @@ powerManagement.powertop.enable = true; services.thermald.enable = true; - fileSystems."/" = { - device = "/dev/disk/by-uuid/ed744c02-8854-4f1a-8e75-ed15f02775e3"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/37BB-86B6"; - fsType = "vfat"; - }; - - swapDevices = [{ - device = "/dev/disk/by-uuid/7a33dbc2-73f7-490b-9aa6-382e119a997e"; - priority = 1; - }]; - # 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