1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-20 10:09:45 +01:00

xdg-user-dirs: create directories after linkGeneration

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.
This commit is contained in:
Naïm Favier 2022-06-12 15:18:11 +02:00 committed by Robert Helgesson
parent 8419dfd39d
commit dbed4c794d
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -120,12 +120,10 @@ in {
home.sessionVariables = directories; home.sessionVariables = directories;
home.activation = mkIf cfg.createDirectories { home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let
createXdgUserDirectories = let directoriesList = attrValues directories;
directoriesList = attrValues directories; mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"'');
mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"''); in lib.hm.dag.entryAfter [ "linkGeneration" ]
in lib.hm.dag.entryAfter [ "writeBoundary" ] (strings.concatMapStringsSep "\n" mkdir directoriesList));
(strings.concatMapStringsSep "\n" mkdir directoriesList);
};
}; };
} }