Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make /etc/nixos writable #398

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions modules/build-tarball.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ let
wsl.defaultUser = "nixos";
${lib.optionalString (!config.wsl.nativeSystemd) "wsl.nativeSystemd = false;"}

system.activationScripts.NixOS-WSL-Permissions-Fixer.text =
'''
if [ -f /etc/nixos/.permissions-fixer-needed ]; then
echo "[NixOS-WSL-Permissions-Fixer] Making /etc/nixos writable to current user..."
${pkgs.acl}/bin/setfacl -R -m u:nixos:rwx /etc/nixos
aikooo7 marked this conversation as resolved.
Show resolved Hide resolved
if [ "$?" -eq 0 ]; then
rm /etc/nixos/.permissions-fixer-needed
fi
else
echo "[NixOS-WSL-Permissions-Fixer] Permissions don't need to be fixed."
fi
''';

# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
Expand Down Expand Up @@ -86,6 +99,7 @@ in
cp -R ${lib.cleanSource cfg.configPath}/. "$root/etc/nixos"
chmod -R u+w "$root/etc/nixos"
''}
touch "$root/etc/nixos/.permissions-fixer-needed"

echo "[NixOS-WSL] Compressing..."
tar -C "$root" \
Expand Down