blob: dc790bd3457917dac448c303d0f9a0b6422d4942 (
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
|
{ options, config, lib, namespace, ... }:
with lib; with lib.${namespace}; let
cfg = config.${namespace}.system;
in {
options.${namespace}.system = with types; {
hostname = mkOption {
type = strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
};
id = mkOption {
default = null;
type = nullOr str;
};
impermanent = mkEnableOption "root impermanence";
};
config = {
networking.hostName = cfg.hostname;
networking.hostId = cfg.id;
environment = mkIf cfg.impermanent {
persistence."/persist/system" = {
hideMounts = true;
directories = [
"/etc/nixos"
"/var/log"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
# "/var/lib/bluetooth"
];
files = [
"/etc/machine-id"
];
};
};
};
}
|