WIP everything

This commit is contained in:
steveej 2024-01-18 14:59:17 +00:00
parent 2a23c7fdbe
commit 26f0bde4b3
29 changed files with 1630 additions and 423 deletions

View file

@ -7,6 +7,12 @@
with lib; let
cfg = config.hardware.opinionatedDisk;
ownLib = pkgs.callPackage ../lib/default.nix {};
earlyDiskId = cfg:
if cfg.earlyDiskIdOverride != ""
then cfg.earlyDiskIdOverride
else cfg.diskId
;
in {
options.hardware.opinionatedDisk = {
enable = mkEnableOption "Enable opinionated filesystem layout";
@ -15,6 +21,11 @@ in {
default = true;
type = types.bool;
};
earlyDiskIdOverride = mkOption {
default = "";
type = types.string;
};
};
config = lib.mkIf cfg.enable {
@ -38,7 +49,7 @@ in {
swapDevices = [{device = ownLib.disk.swapFsDevice cfg.diskId;}];
boot.loader.grub = {
device = ownLib.disk.bootGrubDevice cfg.diskId;
device = ownLib.disk.bootGrubDevice (earlyDiskId cfg);
enableCryptodisk = cfg.encrypted;
};
@ -54,6 +65,7 @@ in {
builtins.elemAt splitstring lastelem;
value = {
device = ownLib.disk.bootLuksDevice cfg.diskId;
preLVM = true;
allowDiscards = true;
};