2023-05-26 17:30:37 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2023-08-30 20:18:26 +02:00
|
|
|
pkgs,
|
2023-05-26 17:30:37 +02:00
|
|
|
...
|
|
|
|
}: {
|
2023-09-05 17:50:55 +02:00
|
|
|
imports = [./users.nix];
|
2023-05-31 12:10:21 +02:00
|
|
|
# to allow all users to access hm managed persistent folders
|
|
|
|
programs.fuse.userAllowOther = true;
|
2023-08-30 14:25:52 +02:00
|
|
|
fileSystems."/state".neededForBoot = true;
|
2023-06-01 09:49:01 +02:00
|
|
|
environment.persistence."/state" = {
|
2023-05-26 17:30:37 +02:00
|
|
|
hideMounts = true;
|
|
|
|
|
|
|
|
files = [
|
|
|
|
"/etc/machine-id"
|
|
|
|
"/etc/ssh/ssh_host_ed25519_key"
|
|
|
|
"/etc/ssh/ssh_host_ed25519_key.pub"
|
|
|
|
];
|
2023-06-02 14:18:30 +02:00
|
|
|
directories =
|
|
|
|
[
|
2023-08-30 14:25:52 +02:00
|
|
|
{
|
|
|
|
directory = "/var/log";
|
|
|
|
user = "root";
|
|
|
|
group = "root";
|
|
|
|
mode = "0755";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
directory = "/var/lib/systemd";
|
|
|
|
user = "root";
|
|
|
|
group = "root";
|
|
|
|
mode = "0755";
|
|
|
|
}
|
2023-06-02 14:18:30 +02:00
|
|
|
{
|
|
|
|
directory = "/var/lib/nixos";
|
|
|
|
user = "root";
|
|
|
|
group = "root";
|
|
|
|
mode = "0775";
|
|
|
|
}
|
|
|
|
]
|
2023-06-02 17:08:21 +02:00
|
|
|
++ lib.lists.optionals config.hardware.bluetooth.enable [
|
|
|
|
"/var/lib/bluetooth"
|
2023-06-02 14:18:30 +02:00
|
|
|
];
|
2023-05-26 17:30:37 +02:00
|
|
|
};
|
2023-08-30 20:18:26 +02:00
|
|
|
|
|
|
|
# After importing the rpool, rollback the root system to be empty.
|
|
|
|
boot.initrd.systemd.services.impermanence-root = {
|
|
|
|
wantedBy = ["initrd.target"];
|
|
|
|
after = ["zfs-import-rpool.service"];
|
|
|
|
before = ["sysroot.mount"];
|
|
|
|
unitConfig.DefaultDependencies = "no";
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
ExecStart = "${pkgs.zfs}/bin/zfs rollback -r rpool/local/root@blank";
|
|
|
|
};
|
|
|
|
};
|
2023-05-26 17:30:37 +02:00
|
|
|
}
|