Skip to content

Commit

Permalink
feat: add permissions fix
Browse files Browse the repository at this point in the history
- make /etc/nixos writable
  • Loading branch information
aikooo7 committed Jan 11, 2024
1 parent d2fd320 commit ea53e81
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
initialConfig = {
wsl.enable = true;

programs.bash.loginShellInit = "nixos-wsl-welcome";
programs.bash.loginShellInit = "nixos-wsl-permissions-fix && nixos-wsl-welcome";
};
in
{
Expand Down
1 change: 0 additions & 1 deletion modules/build-tarball.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ in
'' else ''
mkdir -p "$root/etc/nixos"
cp -R ${lib.cleanSource cfg.configPath}/. "$root/etc/nixos"
chmod -R u+w "$root/etc/nixos"
''}
echo "[NixOS-WSL] Compressing..."
Expand Down
1 change: 1 addition & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
./welcome.nix
./wsl-conf.nix
./wsl-distro.nix
./permissions-fix.nix

(lib.mkRemovedOptionModule [ "wsl" "docker-native" ]
"Additional workarounds are no longer required for Docker to work. Please use the standard `virtualisation.docker` NixOS options.")
Expand Down
13 changes: 13 additions & 0 deletions modules/permissions-fix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ lib, pkgs, config, ... }:
let
permissions-fix = pkgs.writeShellScriptBin "nixos-wsl-permissions-fix"
''
echo -e "[NixOS-WSL] Making /etc/nixos writable to current user...\n"
sudo setfacl -R -m u:nixos:rwx /etc/nixos
'';
in
{
config = lib.mkIf config.wsl.enable {
environment.systemPackages = [ permissions-fix ];
};
}

0 comments on commit ea53e81

Please sign in to comment.