blob: a3ba353bcfa5cfcb4b74730a04b15f9b2ee61b1d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
{
config,
lib,
...
}:
with lib; let
cfg = config.system.fileSystemLayouts;
defaultMountOptions = [
"compress-force=zstd:15" # This saves disk space, at a performance cost
"noatime" # should have some performance upsides, and I don't use it anyways
];
in {
options.system.fileSystemLayouts = {
enable = mkEnableOption (mdDoc "fileSystemLayout");
mainDisk = mkOption {
type = lib.types.path;
example = literalExpression "/dev/disk/by-uuid/0442cb6d-f13a-4635-b487-fa76189774c5";
description = lib.mdDoc "Path to the main disk";
};
efiDisk = mkOption {
type = lib.types.path;
example = literalExpression "/dev/disk/by-uuid/5143-6136";
description = lib.mdDoc "Path to the main disk";
};
};
config = mkIf cfg.enable {
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
options = ["defaults" "size=2G" "mode=755"];
};
"/nix" = {
device = cfg.mainDisk;
fsType = "btrfs";
options = ["subvol=nix"] ++ defaultMountOptions;
};
"/srv" = {
device = cfg.mainDisk;
fsType = "btrfs";
neededForBoot = true;
options = ["subvol=storage"] ++ defaultMountOptions;
};
"/boot" = {
device = cfg.efiDisk;
fsType = "vfat";
};
# This results in infinite recursion, don't ask my why
# "${config.users.users.soispha.home}/.config" = {
# device = "none";
# fsType = "tmpfs";
# options = ["defaults" "size=1G" "mode=755"];
# };
};
swapDevices = [];
};
}
|