blob: 1dbfa14e39c06d4046e8c0dfbb84abc1ea036dc3 (
plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
{ config, lib, ... }:
with lib; let
cfg = config.local.boot.stack.btrfsToplevelMultidrive;
in
{
options.local.boot.stack.btrfsToplevelMultidrive = {
enable = mkEnableOption "filesystem stack: persistent btrfs toplevel with optional hdd drive";
toplevel = {
device = mkOption {
type = types.str;
};
ssd = mkOption {
type = types.bool;
};
snapshot = mkOption {
type = types.bool;
default = false;
};
root = mkOption {
type = types.str;
};
pivot = mkOption {
type = types.str;
default = "/";
};
};
secondary = {
device = mkOption {
type = types.str;
};
ssd = mkOption {
type = types.bool;
};
snapshot = mkOption {
type = types.bool;
default = false;
};
home = mkOption {
type = types.str;
};
pivot = mkOption {
type = types.str;
default = "/";
};
};
};
config = mkIf cfg.enable {
local.btrfs = {
mounts = {
"/" = {
inherit (cfg.toplevel) device ssd;
subvol = cfg.toplevel.root;
};
"/toplevel" = {
inherit (cfg.toplevel) device ssd;
subvol = cfg.toplevel.pivot;
};
#FIXME: Este nombre es legacy
"/hdd" = {
inherit (cfg.secondary) device ssd;
subvol = cfg.secondary.pivot;
};
"/home" = {
inherit (cfg.secondary) device ssd;
subvol = cfg.secondary.home;
};
};
snapper = optionalAttrs cfg.toplevel.snapshot
{
root = "/";
} // optionalAttrs cfg.secondary.snapshot {
home = "/home";
};
};
# Asegura que /hdd sea descifrado antes de intentar montar /home
fileSystems."/home".depends = [ "/hdd" ];
};
}
|