lib: Evaluate partition's _index parameter

This is required to be able to generate sgdisk invocations that are
equivalent to what's currently generated in nix.
This commit is contained in:
Felix Uhl committed 2024-11-10 17:39:39 +01:00
1 parent 4f16850ca4
commit 70efb0a658
3 files changed
+7 -1

No files matched your search

+2 -1
View File
@@ -44,6 +44,7 @@ let
diskoConfig = evaluatedConfig.config.disko.devices;
finalConfig = lib.filterAttrsRecursive (name: value: !lib.hasPrefix "_" name) diskoConfig;
shouldBeEvaluated = name: (!lib.hasPrefix "_" name) || (name == "_index");
finalConfig = lib.filterAttrsRecursive (name: value: shouldBeEvaluated name) diskoConfig;
in
finalConfig
@@ -6,6 +6,7 @@
"efiGptPartitionFirst": true,
"partitions": {
"ESP": {
"_index": 1,
"alignment": 0,
"content": {
"device": "/dev/disk/by-partlabel/disk-main-ESP",
@@ -32,6 +33,7 @@
"type": "EF00"
},
"root": {
"_index": 2,
"alignment": 0,
"content": {
"device": "/dev/disk/by-partlabel/disk-main-root",
@@ -6,6 +6,7 @@
"efiGptPartitionFirst": true,
"partitions": {
"ESP": {
"_index": 2,
"alignment": 0,
"content": {
"device": "/dev/disk/by-partlabel/disk-main-ESP",
@@ -32,6 +33,7 @@
"type": "EF00"
},
"boot": {
"_index": 1,
"alignment": 0,
"content": null,
"device": "/dev/disk/by-partlabel/disk-main-boot",
@@ -45,6 +47,7 @@
"type": "EF02"
},
"root": {
"_index": 3,
"alignment": 0,
"content": {
"device": "/dev/disk/by-partlabel/disk-main-root",