From 2038a06f21c6bdbc819124f820140c60d035024a Mon Sep 17 00:00:00 2001 From: catvayor Date: Thu, 12 Jun 2025 14:55:27 +0200 Subject: [PATCH 1/2] refactor(web01): remove disko dependencies --- .../nixos/web01/_hardware-configuration.nix | 72 ++++++++++++++-- machines/nixos/web01/disko.nix | 86 ------------------- 2 files changed, 65 insertions(+), 93 deletions(-) delete mode 100644 machines/nixos/web01/disko.nix diff --git a/machines/nixos/web01/_hardware-configuration.nix b/machines/nixos/web01/_hardware-configuration.nix index 42bdc7e..9a2d013 100644 --- a/machines/nixos/web01/_hardware-configuration.nix +++ b/machines/nixos/web01/_hardware-configuration.nix @@ -1,12 +1,70 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ modulesPath, sources, ... }: - +{ modulesPath, ... }: { - imports = [ - "${modulesPath}/profiles/qemu-guest.nix" - "${sources.disko}/module.nix" - ./disko.nix - ]; + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot = { + initrd = { + availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "ehci_pci" + "virtio_pci" + "ahci" + "virtio_blk" + ]; + kernelModules = [ ]; + luks.devices."mainfs" = { + device = "/dev/disk/by-uuid/0de6ce5a-c5b6-41e3-96d0-c0381e06f94e"; + keyFile = "/dev/zero"; + keyFileSize = 1; + }; + }; + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/cf7f8271-c1c7-46d9-b960-281d9271c576"; + fsType = "btrfs"; + options = [ "subvol=rootfs" ]; + }; + + "/nix" = { + device = "/dev/disk/by-uuid/cf7f8271-c1c7-46d9-b960-281d9271c576"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + "/var/log" = { + device = "/dev/disk/by-uuid/cf7f8271-c1c7-46d9-b960-281d9271c576"; + fsType = "btrfs"; + options = [ "subvol=var-log" ]; + }; + + "/mnt/btrfs-root" = { + device = "/dev/disk/by-uuid/cf7f8271-c1c7-46d9-b960-281d9271c576"; + fsType = "btrfs"; + }; + + "/home" = { + device = "/dev/disk/by-uuid/cf7f8271-c1c7-46d9-b960-281d9271c576"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/2A58-A5B0"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + }; + + swapDevices = [ { device = "/dev/disk/by-uuid/9c2f1161-dc30-4bda-91aa-859bb4ec1697"; } ]; } diff --git a/machines/nixos/web01/disko.nix b/machines/nixos/web01/disko.nix deleted file mode 100644 index eeb4ed9..0000000 --- a/machines/nixos/web01/disko.nix +++ /dev/null @@ -1,86 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Maurice Debray -# -# SPDX-License-Identifier: EUPL-1.2 - -_: - -let - luksName = "mainfs"; -in -{ - boot.initrd.luks.devices.${luksName} = { - keyFile = "/dev/zero"; - keyFileSize = 1; - }; - disko.devices = { - disk = { - vdb = { - device = "/dev/vdb"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - start = "1MiB"; - label = "ESP"; - end = "512MiB"; - type = "EF00"; - priority = 1; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - luks = { - start = "512MiB"; - end = "-4GiB"; - content = rec { - type = "luks"; - name = luksName; - extraOpenArgs = [ "--keyfile-size=1" ]; - extraFormatArgs = extraOpenArgs; - settings.keyFile = "/dev/zero"; - content = { - type = "btrfs"; - mountpoint = "/mnt/btrfs-root"; - subvolumes = { - "/rootfs" = { - mountpoint = "/"; - mountOptions = [ "compress=zstd" ]; - }; - "/home" = { - mountOptions = [ "compress=zstd" ]; - mountpoint = "/home"; - }; - "/var-log" = { - mountOptions = [ "compress=zstd" ]; - mountpoint = "/var/log"; - }; - "/nix" = { - mountOptions = [ - "noatime" - "compress=zstd" - ]; - mountpoint = "/nix"; - }; - }; - }; - }; - }; - swap = { - label = "swap"; - start = "-4GiB"; - end = "100%"; - priority = 3; - content = { - type = "swap"; - randomEncryption = true; - }; - }; - }; - }; - }; - }; - }; -} -- 2.47.2 From c384f800b3e09f71e6a32baaa777d89be9acb30e Mon Sep 17 00:00:00 2001 From: catvayor Date: Thu, 12 Jun 2025 15:36:09 +0200 Subject: [PATCH 2/2] refactor(zulip01): remove disko dependencies --- .../nixos/zulip01/_hardware-configuration.nix | 29 ++++++++++----- machines/nixos/zulip01/disko.nix | 37 ------------------- 2 files changed, 20 insertions(+), 46 deletions(-) delete mode 100644 machines/nixos/zulip01/disko.nix diff --git a/machines/nixos/zulip01/_hardware-configuration.nix b/machines/nixos/zulip01/_hardware-configuration.nix index 54e1ab1..17cd11f 100644 --- a/machines/nixos/zulip01/_hardware-configuration.nix +++ b/machines/nixos/zulip01/_hardware-configuration.nix @@ -1,17 +1,10 @@ -# SPDX-FileCopyrightText: 2024 Tom Hubrecht -# -# SPDX-License-Identifier: EUPL-1.2 - # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ modulesPath, sources, ... }: - +{ modulesPath, ... }: { imports = [ (modulesPath + "/profiles/qemu-guest.nix") - (sources.disko + "/module.nix") - ./disko.nix ]; boot = { @@ -19,8 +12,8 @@ availableKernelModules = [ "ata_piix" "uhci_hcd" - "ehci_pci" "virtio_pci" + "virtio_scsi" "sr_mod" "virtio_blk" ]; @@ -30,4 +23,22 @@ kernelModules = [ "kvm-intel" ]; extraModulePackages = [ ]; }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/179ba756-b0f0-42ec-b0b5-ab3daca97d3d"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/0DB8-F2E0"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + }; + + swapDevices = [ ]; } diff --git a/machines/nixos/zulip01/disko.nix b/machines/nixos/zulip01/disko.nix deleted file mode 100644 index e549442..0000000 --- a/machines/nixos/zulip01/disko.nix +++ /dev/null @@ -1,37 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Maurice Debray -# -# SPDX-License-Identifier: EUPL-1.2 - -_: { - disko.devices = { - disk = { - main = { - device = "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - type = "EF00"; - size = "1G"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - }; - }; - }; - }; - }; - }; -} -- 2.47.2