Skip to content

Commit

Permalink
lenovo-x1: new disk partitioning scheme
Browse files Browse the repository at this point in the history
New disk configuration provides grounds for upcoming features,
such as AB software updates and Storage VM and many more.

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
  • Loading branch information
unbel13ver committed Feb 22, 2024
1 parent 70dcec0 commit 1794271
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 2 deletions.
166 changes: 166 additions & 0 deletions targets/disc-configs/lenovo-x1-carbon-disk-config.nix
Original file line number Diff line number Diff line change
@@ -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"
];
};
};
};
};
};
};
}
4 changes: 2 additions & 2 deletions targets/lenovo-x1-carbon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1794271

Please sign in to comment.