From e8fff0bbd36ec312f0aa4d7ca272a23bb01f2267 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 22 Nov 2024 20:36:56 -0500 Subject: [PATCH] feat: add script to fix UID changes --- outputs.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/outputs.nix b/outputs.nix index a20a1b61..226b9f3a 100644 --- a/outputs.nix +++ b/outputs.nix @@ -161,6 +161,18 @@ isoConfig="nixosConfigurations.live-image.config.system.build.isoImage" nom build $(realpath /etc/nixos)#$isoConfig '') + (pkgs.writeShellApplication { + name = "fixUidChange"; + text = '' + GROUP="$1" + OLD_GID="$2" + NEW_GID="$3" + + sudo sed -i -e "/^$GROUP:/d" /etc/group # Remove generated group entry + sudo find / -gid "$OLD_GID" -exec chgrp "$NEW_GID" {} + # Change GID on existing files + sudo nixos-rebuild --switch # Regenerate /etc/group with new GID + ''; + }) ]; };