From 73840cc9b5ddaff43cdd643dedcc8a6136f05961 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Mon, 13 Jan 2025 13:17:05 +0800 Subject: [PATCH] system/preservation: use static symlink for files in `/etc` --- nixos/profiles/system/boot/secure-boot.nix | 5 ++++- nixos/profiles/system/preservation.nix | 14 +++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/nixos/profiles/system/boot/secure-boot.nix b/nixos/profiles/system/boot/secure-boot.nix index 58f536e..4324fe8 100644 --- a/nixos/profiles/system/boot/secure-boot.nix +++ b/nixos/profiles/system/boot/secure-boot.nix @@ -9,5 +9,8 @@ pkiBundle = "/etc/secureboot"; }; - preservation.preserveAt."/persist".directories = [ "/etc/secureboot" ]; + environment.etc."secureboot" = { + source = "/persist/etc/secureboot"; + mode = "direct-symlink"; + }; } diff --git a/nixos/profiles/system/preservation.nix b/nixos/profiles/system/preservation.nix index ae984f2..b14351c 100644 --- a/nixos/profiles/system/preservation.nix +++ b/nixos/profiles/system/preservation.nix @@ -64,21 +64,17 @@ user = "root"; group = "root"; } - { - file = "/etc/machine-id"; - inInitrd = true; - how = "symlink"; - mode = "-"; - user = "root"; - group = "root"; - configureParent = true; - } ]; }; } ); }; + environment.etc."machine-id" = { + source = "/persist/etc/machine-id"; + mode = "direct-symlink"; + }; + # https://github.com/NixOS/nixpkgs/pull/351151#issuecomment-2549025171 systemd.services.systemd-machine-id-commit = { unitConfig.ConditionPathIsMountPoint = [