Skip to content

Commit

Permalink
fix deprecated activationScripts.var in recent nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
fsagbuya committed Jan 2, 2024
1 parent 47a11f7 commit 9bf8b2e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,23 @@ with lib;
# dummy to make setup-etc happy
'';
system.activationScripts.etc = stringAfter [ "users" "groups" ] config.system.build.etcActivationCommands;
# Re-apply deprecated var value due to systemd preference in recent nixpkgs
# See https://github.com/NixOS/nixpkgs/commit/59e37267556eb917146ca3110ab7c96905b9ffbd
system.activationScripts.var = lib.mkForce ''
# Various log/runtime directories.
mkdir -p /var/tmp
chmod 1777 /var/tmp
# Empty, immutable home directory of many system accounts.
mkdir -p /var/empty
# Make sure it's really empty
${pkgs.e2fsprogs}/bin/chattr -f -i /var/empty || true
find /var/empty -mindepth 1 -delete
chmod 0555 /var/empty
chown root:root /var/empty
${pkgs.e2fsprogs}/bin/chattr -f +i /var/empty || true
'';
# nix-build -A system.build.toplevel && du -h $(nix-store -qR result) --max=0 -BM|sort -n
system.build.toplevel = pkgs.runCommand "not-os" {
activationScript = config.system.activationScripts.script;
Expand Down

0 comments on commit 9bf8b2e

Please sign in to comment.