Skip to content

Commit

Permalink
fix(planet/nixos/persistence): persist /var/lib/nixos
Browse files Browse the repository at this point in the history
Needed to prevent UIDs and GIDs from being reassigned every boot.
  • Loading branch information
dixslyf committed Sep 1, 2024
1 parent 99e6bd8 commit d1589be
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions planet/modules/nixos/persistence/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
Allow non-root users to specify the allow_other or allow_root mount options, see mount.fuse3(8).
'';
};
persistVarLibNixos = mkOption {
type = types.bool;
default = true;
description = ''
Whether to persist the `/var/lib/nixos` directory.
Needed to persist UIDs and GIDs.
This is more of a convenience option.
'';
};
persistSystemdDirectories = mkOption {
type = types.bool;
default = false;
Expand Down Expand Up @@ -83,14 +92,6 @@
This is more of a convenience option.
'';
};
directories = mkOption {
type = with types; listOf anything;
default = [ ];
description = ''
List of directories to persist.
This list will be passed to the corresponding option in the `impermanence` module.
'';
};
persistMachineId = mkOption {
type = types.bool;
default = false;
Expand All @@ -99,6 +100,14 @@
This is more of a convenience option.
'';
};
directories = mkOption {
type = with types; listOf anything;
default = [ ];
description = ''
List of directories to persist.
This list will be passed to the corresponding option in the `impermanence` module.
'';
};
files = mkOption {
type = with types; listOf anything;
default = [ ];
Expand Down Expand Up @@ -134,6 +143,7 @@
"/var/lib/systemd/coredump"
"/var/lib/systemd/timers"
])
++ (lists.optional cfg.persistVarLibNixos "/var/lib/nixos")
++ (lists.optionals cfg.persistMachines [ "/var/lib/machines" "/etc/systemd/nspawn" ])
++ (lists.optional cfg.persistSystemdBacklight "/var/lib/systemd/backlight") # for systemd-backlight to be able to restore brightness
++ (lists.optional cfg.persistLogs "/var/log")
Expand Down

0 comments on commit d1589be

Please sign in to comment.