Restructure partition config
This commit is contained in:
parent
7cf715f4d8
commit
03e42c5578
6 changed files with 53 additions and 22 deletions
27
lib/modules/fileSystems.nix
Normal file
27
lib/modules/fileSystems.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
in {
|
||||
imports = [
|
||||
./partition/disks.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
valhalla = {
|
||||
fileSystems = {
|
||||
script = mkOption {
|
||||
type = types.str;
|
||||
description = "The script for preparing the system's mounts.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
valhalla = {
|
||||
fileSystems = {
|
||||
script = config.valhalla.fileSystems.diskSetup.script;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -291,27 +291,29 @@ in
|
|||
{
|
||||
options = {
|
||||
valhalla = {
|
||||
partition = {
|
||||
fileSystems = {
|
||||
rootDir = mkOption {
|
||||
type = types.str;
|
||||
description = "The root of the installation directory to mount disks into.";
|
||||
default = "/mnt";
|
||||
};
|
||||
|
||||
os = mkOption {
|
||||
type = mkDiskType true;
|
||||
description = "The partition layout of the OS disk.";
|
||||
};
|
||||
diskSetup = {
|
||||
osDisk = mkOption {
|
||||
type = mkDiskType true;
|
||||
description = "The partition layout of the OS disk.";
|
||||
};
|
||||
|
||||
disks = mkOption {
|
||||
type = types.attrsOf (mkDiskType false);
|
||||
description = "The additional disks to format.";
|
||||
default = { };
|
||||
};
|
||||
disks = mkOption {
|
||||
type = types.attrsOf (mkDiskType false);
|
||||
description = "The additional disks to format.";
|
||||
default = { };
|
||||
};
|
||||
|
||||
script = mkOption {
|
||||
type = types.str;
|
||||
description = "The script for partitioning the system's disks.";
|
||||
script = mkOption {
|
||||
type = types.str;
|
||||
description = "The script for partitioning the system's disks.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -319,14 +321,15 @@ in
|
|||
|
||||
config = {
|
||||
valhalla = {
|
||||
partition = {
|
||||
fileSystems.diskSetup = {
|
||||
script = lib.mkDefault (
|
||||
let
|
||||
cfg = config.valhalla.partition;
|
||||
inherit (cfg) os rootDir;
|
||||
cfg = config.valhalla.fileSystems;
|
||||
inherit (cfg) rootDir;
|
||||
inherit (cfg.diskSetup) osDisk;
|
||||
inherit (lib.strings) normalizePath;
|
||||
partPath = part: "/dev/disk/by-label/${part.label}";
|
||||
disks = ([ os ] ++ (builtins.attrValues cfg.disks));
|
||||
disks = ([ osDisk ] ++ (builtins.attrValues cfg.diskSetup.disks));
|
||||
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
|
||||
|
||||
mountScript = lib.strings.concatLines (builtins.concatMap
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
let inherit (lib) mkOption types;
|
||||
in {
|
||||
imports = [
|
||||
./fileSystems.nix
|
||||
./hardware.nix
|
||||
./i18n.nix
|
||||
./os.nix
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
partition.os.partitions = {
|
||||
fileSystems.diskSetup.osDisk.partitions = {
|
||||
# Keep Windows' boot partition
|
||||
Boot.keepExisting = true;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ in {
|
|||
|
||||
config = {
|
||||
valhalla = {
|
||||
partition = {
|
||||
os = {
|
||||
fileSystems.diskSetup = {
|
||||
osDisk = {
|
||||
partitions = {
|
||||
Boot = {
|
||||
index = 1;
|
||||
|
|
|
@ -5,8 +5,8 @@ in {
|
|||
|
||||
config = {
|
||||
valhalla = {
|
||||
partition = {
|
||||
os = {
|
||||
fileSystems.diskSetup = {
|
||||
osDisk = {
|
||||
partitions = {
|
||||
Boot = {
|
||||
index = 1;
|
||||
|
|
Loading…
Reference in a new issue