Modularize drives further
This commit is contained in:
parent
c49948ad7b
commit
252fcce589
2 changed files with 47 additions and 21 deletions
|
|
@ -87,23 +87,4 @@ in {
|
||||||
password = "firstlogin";
|
password = "firstlogin";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-label/ROOT";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "noatime" "nodiratime" "discard" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-label/BOOT";
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/home" = {
|
|
||||||
device = "/dev/disk/by-label/HOME";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [ "noatime" "nodiratime" "discard" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [{ device = "/dev/disk/by-label/SWAP"; }];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,30 @@ let
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.mods = {
|
options.mods = {
|
||||||
|
useSwap = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
default = true;
|
||||||
|
example = false;
|
||||||
|
type = lib.types.bool;
|
||||||
|
description = ''
|
||||||
|
Use default drive config
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
defaultDrives = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
default = true;
|
||||||
|
example = false;
|
||||||
|
type = lib.types.bool;
|
||||||
|
description = ''
|
||||||
|
Use default drive config
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
extraDrives = lib.mkOption {
|
extraDrives = lib.mkOption {
|
||||||
default = [ ];
|
default = [
|
||||||
|
|
||||||
|
];
|
||||||
example = [{
|
example = [{
|
||||||
name = "drive2";
|
name = "drive2";
|
||||||
drive = {
|
drive = {
|
||||||
|
|
@ -49,6 +71,29 @@ in {
|
||||||
fileSystems = builtins.listToAttrs (map ({ name, drive }: {
|
fileSystems = builtins.listToAttrs (map ({ name, drive }: {
|
||||||
name = "/" + name;
|
name = "/" + name;
|
||||||
value = drive;
|
value = drive;
|
||||||
}) config.mods.extraDrives);
|
}) config.mods.extraDrives)
|
||||||
|
// (lib.optionalAttrs config.mods.defaultDrives.enable) {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-label/ROOT";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "noatime" "nodiratime" "discard" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-label/BOOT";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/home" = {
|
||||||
|
device = "/dev/disk/by-label/HOME";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "noatime" "nodiratime" "discard" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# TODO make this convert to choice of drives -> thanks to funny types this doesn't work...
|
||||||
|
swapDevices = lib.mkIf config.mods.useSwap.enable [{
|
||||||
|
device = "/dev/disk/by-label/SWAP";
|
||||||
|
}];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue