2024-08-08 12:16:04 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
sources = import ./../sources/sources.nix;
|
|
|
|
in {
|
|
|
|
options.mine.state.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
(sources.impermanence + "/nixos.nix")
|
|
|
|
];
|
|
|
|
|
|
|
|
config = mkIf config.mine.state.enable {
|
|
|
|
environment.persistence = {
|
|
|
|
root = {
|
|
|
|
persistentStoragePath = "/state/root";
|
|
|
|
|
|
|
|
files = [
|
|
|
|
"/etc/machine-id"
|
|
|
|
];
|
|
|
|
|
|
|
|
directories = [
|
|
|
|
"/var/lib/nixos"
|
|
|
|
"/var/log"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2024-08-09 19:11:10 +00:00
|
|
|
|
|
|
|
# fixes the following error, when trying to use impermanence
|
|
|
|
# in `/var/lib/private`, which is needed for DynamicUser.
|
|
|
|
# Error: Directory "/var/lib/private" already exists, but has mode 0755 that is too permissive (0700 was requested), refusing.
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d /var/lib/private 0700 root root - -"
|
|
|
|
];
|
2024-08-08 12:16:04 +00:00
|
|
|
};
|
|
|
|
}
|