From 1794271c4a2703eb663f465393f2f4eb83606613 Mon Sep 17 00:00:00 2001 From: Ivan Nikolaenko Date: Fri, 16 Feb 2024 16:17:41 +0200 Subject: [PATCH] lenovo-x1: new disk partitioning scheme New disk configuration provides grounds for upcoming features, such as AB software updates and Storage VM and many more. Signed-off-by: Ivan Nikolaenko --- .../lenovo-x1-carbon-disk-config.nix | 166 ++++++++++++++++++ targets/lenovo-x1-carbon.nix | 4 +- 2 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 targets/disc-configs/lenovo-x1-carbon-disk-config.nix diff --git a/targets/disc-configs/lenovo-x1-carbon-disk-config.nix b/targets/disc-configs/lenovo-x1-carbon-disk-config.nix new file mode 100644 index 0000000000..11d3faedca --- /dev/null +++ b/targets/disc-configs/lenovo-x1-carbon-disk-config.nix @@ -0,0 +1,166 @@ +# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors +# SPDX-License-Identifier: Apache-2.0 +# +_: { + disko.devices = { + disk.disk1 = { + device = "DRIVE_PATH"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp_a = { + name = "ESP_A"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + esp_b = { + name = "ESP_B"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountOptions = ["umask=0077"]; + }; + }; + # LVM pool that is going to be encrypted + other_1 = { + name = "lvm_pv_1"; + size = "250G"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + # LVM pool that is going to be passed to the Storage VM + other_2 = { + name = "lvm_pv_2"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "vmstore"; + }; + }; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root_a = { + size = "50G"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; + }; + vm_storage_a = { + size = "30G"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/vmstore"; + mountOptions = [ + "defaults" + ]; + }; + }; + reserved_a = { + size = "10G"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + root_b = { + size = "50G"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + vm_storage_b = { + size = "30G"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + reserved_b = { + size = "10G"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + gp_storage = { + # general purpose storage + size = "50G"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + recovery = { + size = "100%FREE"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + vmstore = { + # Dedicated partition for StorageVM + type = "lvm_vg"; + lvs = { + storagevm = { + size = "100%FREE"; + content = { + type = "filesystem"; + format = "ext4"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + }; + }; +} diff --git a/targets/lenovo-x1-carbon.nix b/targets/lenovo-x1-carbon.nix index 03a72c33c5..87a384e312 100644 --- a/targets/lenovo-x1-carbon.nix +++ b/targets/lenovo-x1-carbon.nix @@ -513,12 +513,12 @@ name = "${name}-${variant}"; installer = let pkgs = import nixpkgs {inherit system;}; - inherit ((hostConfiguration.extendModules {modules = [disko.nixosModules.disko (import ../templates/targets/x86_64/generic/disk-config.nix)];}).config.system.build) toplevel; + inherit ((hostConfiguration.extendModules {modules = [disko.nixosModules.disko (import ./disc-configs/lenovo-x1-carbon-disk-config.nix)];}).config.system.build) toplevel; installerScript = import ../modules/installer/standalone-installer { inherit pkgs; toplevelDrv = toplevel; inherit (disko.packages.${system}) disko; - diskoConfig = pkgs.writeText "disko-config.nix" (builtins.readFile ../templates/targets/x86_64/generic/disk-config.nix); + diskoConfig = pkgs.writeText "disko-config.nix" (builtins.readFile ./disc-configs/lenovo-x1-carbon-disk-config.nix); }; in lib.ghaf.installer {