mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
xdg-user-dirs: check for existing symlink
When a non-directory, such as a file or a dead symlink, already exists, mkdir -p fails with "cannot create directory ‘...’: File exists". This is a problem when, for example, a symlink points to a directory on a filesystem that isn't mounted yet.
This commit is contained in:
parent
cf111d1a84
commit
1283bf6ebb
1 changed files with 2 additions and 1 deletions
|
@ -137,7 +137,8 @@ in {
|
|||
|
||||
home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let
|
||||
directoriesList = attrValues directories;
|
||||
mkdir = (dir: ''run mkdir -p $VERBOSE_ARG "${dir}"'');
|
||||
mkdir =
|
||||
(dir: ''[[ -L "${dir}" ]] || run mkdir -p $VERBOSE_ARG "${dir}"'');
|
||||
in lib.hm.dag.entryAfter [ "linkGeneration" ]
|
||||
(strings.concatMapStringsSep "\n" mkdir directoriesList));
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue