From 3bd0acfa624154474e358878dcee79ace9e3d384 Mon Sep 17 00:00:00 2001 From: Dixon Sean Low Yan Feng Date: Sun, 1 Dec 2024 11:36:41 +0800 Subject: [PATCH] revert: "fix(planet/nixos/persistence): work around https://github.com/nix-community/impermanence/issues/229" This reverts commit 80373ea0b9e9af7b08781fe064adc074ff0517c7. Fix is now in upstream impermanence. --- planet/modules/nixos/persistence/default.nix | 74 +++++++++----------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/planet/modules/nixos/persistence/default.nix b/planet/modules/nixos/persistence/default.nix index 5c89fe3..58ae827 100644 --- a/planet/modules/nixos/persistence/default.nix +++ b/planet/modules/nixos/persistence/default.nix @@ -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; @@ -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; + }; }