Skip to content

Commit

Permalink
revert: "fix(planet/nixos/persistence): work around nix-community/imp…
Browse files Browse the repository at this point in the history
…ermanence#229"

This reverts commit 80373ea.

Fix is now in upstream impermanence.
  • Loading branch information
dixslyf committed Dec 1, 2024
1 parent d065da6 commit 3bd0acf
Showing 1 changed file with 33 additions and 41 deletions.
74 changes: 33 additions & 41 deletions planet/modules/nixos/persistence/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
config =
let
cfg = config.planet.persistence;
inherit (lib) mkIf mkMerge lists;
inherit (lib) mkIf lists;

getUserPersistence = user: config.home-manager.users.${user}.planet.persistence;
users = builtins.attrNames config.home-manager.users;
Expand All @@ -135,48 +135,40 @@
user-persistence.enable && user-persistence.useBindMounts
) users;
in
mkIf cfg.enable (mkMerge [
{
# Opt-in persisted root directories
environment.persistence.${cfg.persistDirectory} = {
inherit (cfg) hideMounts;
mkIf cfg.enable {
# Opt-in persisted root directories
environment.persistence.${cfg.persistDirectory} = {
inherit (cfg) hideMounts;

directories =
cfg.directories
++ (lists.optionals cfg.persistSystemdDirectories [
"/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")
++ (lists.optional cfg.persistSsh "/etc/ssh");
directories =
cfg.directories
++ (lists.optionals cfg.persistSystemdDirectories [
"/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")
++ (lists.optional cfg.persistSsh "/etc/ssh");

files = cfg.files ++ lists.optional cfg.persistMachineId "/etc/machine-id";
files = cfg.files ++ lists.optional cfg.persistMachineId "/etc/machine-id";

users = lib.attrsets.genAttrs target-users (
user:
let
user-persistence = getUserPersistence user;
in
{
inherit (user-persistence) files;
directories = user-persistence.finalDirectories;
}
);
};

programs.fuse.userAllowOther = cfg.fuseAllowOther;
}
users = lib.attrsets.genAttrs target-users (
user:
let
user-persistence = getUserPersistence user;
in
{
inherit (user-persistence) files;
directories = user-persistence.finalDirectories;
}
);
};

# Work around https://github.com/nix-community/impermanence/issues/229
(mkIf cfg.persistMachineId {
boot.initrd.systemd.suppressedUnits = [ "systemd-machine-id-commit.service" ];
systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ];
})
]);
programs.fuse.userAllowOther = cfg.fuseAllowOther;
};
}

0 comments on commit 3bd0acf

Please sign in to comment.