From 19400a88100b56fe7d2d728f2571f3507c1040a8 Mon Sep 17 00:00:00 2001 From: Miroslav Prasil Date: Mon, 18 Dec 2023 11:31:18 +0000 Subject: [PATCH] Fix symlink creation of per-user apps/icons folder The code relied on `defaultUser` attribute name in `config.users.users` to be the same as the username. This is not always the case as the username can be set by `name` attribute inside the user configuration So for following user ``` users.users.foo.name = "bar" ``` the `wsl.defaultUser = "foo"` works, but the `wsl.startMenuLaunchers = true` won't work because it tries to find applications folder at `/etc/profiles/per-user/foo/share` rather than `/etc/profiles/per-user/bar/share` that is actually created. This uses the `name` attribute of that user instead. --- modules/wsl-distro.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix index d5964243..3748cdfc 100644 --- a/modules/wsl-distro.nix +++ b/modules/wsl-distro.nix @@ -109,8 +109,8 @@ in if [[ -d "$systemConfig/sw/share/$x" ]]; then targets+=("$systemConfig/sw/share/$x/.") fi - if [[ -d "/etc/profiles/per-user/${cfg.defaultUser}/share/$x" ]]; then - targets+=("/etc/profiles/per-user/${cfg.defaultUser}/share/$x/.") + if [[ -d "/etc/profiles/per-user/${config.users.users.${cfg.defaultUser}.name}/share/$x" ]]; then + targets+=("/etc/profiles/per-user/${config.users.users.${cfg.defaultUser}.name}/share/$x/.") fi if (( ''${#targets[@]} != 0 )); then