Disable home impermanence
This commit is contained in:
@@ -20,6 +20,11 @@ in {
|
||||
default = [];
|
||||
};
|
||||
|
||||
persistGroupName = mkOption {
|
||||
default = "persist";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
files = mkOption {
|
||||
description = "";
|
||||
|
||||
@@ -45,10 +50,28 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.groups.${cfg.persistGroupName} = {
|
||||
name = cfg.persistGroupName;
|
||||
};
|
||||
|
||||
systemd.tmpfiles.settings = {
|
||||
"10-persist" = {
|
||||
"/persist" = {
|
||||
z = {
|
||||
group = cfg.persistGroupName;
|
||||
mode = "2775";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.systemd.initrdBin = with pkgs; [
|
||||
zfs
|
||||
];
|
||||
|
||||
# TODO: Move this somewhere else.
|
||||
programs.fuse.userAllowOther = true;
|
||||
|
||||
boot.initrd.systemd.services.erase-darlings =
|
||||
let service = {
|
||||
description = "Rollback filesystem to a blank state on boot";
|
||||
@@ -77,28 +100,35 @@ in {
|
||||
then service
|
||||
else throw "sydnix.impermanence currently requires config.boot.initrd.systemd.enable'!";
|
||||
|
||||
systemd.services.erase-home-darlings = {
|
||||
description = "Rollback home to a blank state on boot";
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
];
|
||||
after = [
|
||||
"home.mount"
|
||||
];
|
||||
path = [ pkgs.zfs pkgs.babashka ];
|
||||
# unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart =
|
||||
let script = ./erase-home-darlings.clj;
|
||||
in ''${pkgs.babashka}/bin/bb "${script}" -n "${toString cfg.archiveLimit}" --dataset "${cfg.dataset}" --rollback-to "${cfg.rollbackTo}"'';
|
||||
systemd.services =
|
||||
let erase-home-darlings = {
|
||||
description = "Rollback home to a blank state on boot";
|
||||
wantedBy = [
|
||||
"local-fs-pre.target"
|
||||
"zfs-mount.service"
|
||||
];
|
||||
before = [
|
||||
"local-fs.target"
|
||||
"local-fs-pre.target"
|
||||
"zfs-mount.service"
|
||||
];
|
||||
path = [ pkgs.zfs pkgs.babashka pkgs.util-linux ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart =
|
||||
let script = ./erase-home-darlings.clj;
|
||||
in ''${pkgs.babashka}/bin/bb "${script}" -n "${toString cfg.archiveLimit}" --dataset "${cfg.dataset}" --rollback-to "${cfg.rollbackTo}"'';
|
||||
};
|
||||
stopIfChanged = false;
|
||||
restartIfChanged = false;
|
||||
};
|
||||
in {
|
||||
# inherit erase-home-darlings;
|
||||
};
|
||||
stopIfChanged = false;
|
||||
restartIfChanged = false;
|
||||
};
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
environment.persistence."/persist/root" = {
|
||||
directories = cfg.directories;
|
||||
files = cfg.files;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user