From dbed4c794d20d51027fc1107f063ec5be027dafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Sun, 12 Jun 2022 15:18:11 +0200 Subject: [PATCH] xdg-user-dirs: create directories after `linkGeneration` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the scenario where some XDG user directory is a symlink defined by `home.file`, we want the symlink to be created before we try to `mkdir -p` that directory, as it will then silently succeed. On the other hand, if we create the directory first, creating the symlink will fail. We lose nothing by doing this as `linkGeneration` creates the directories it needs. --- modules/misc/xdg-user-dirs.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/misc/xdg-user-dirs.nix b/modules/misc/xdg-user-dirs.nix index bac6b3c25..9d29729a5 100644 --- a/modules/misc/xdg-user-dirs.nix +++ b/modules/misc/xdg-user-dirs.nix @@ -120,12 +120,10 @@ in { home.sessionVariables = directories; - home.activation = mkIf cfg.createDirectories { - createXdgUserDirectories = let - directoriesList = attrValues directories; - mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"''); - in lib.hm.dag.entryAfter [ "writeBoundary" ] - (strings.concatMapStringsSep "\n" mkdir directoriesList); - }; + home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let + directoriesList = attrValues directories; + mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"''); + in lib.hm.dag.entryAfter [ "linkGeneration" ] + (strings.concatMapStringsSep "\n" mkdir directoriesList)); }; }