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
|
@ -137,7 +137,8 @@ in {
|
||||||
|
|
||||||
home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let
|
home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let
|
||||||
directoriesList = attrValues directories;
|
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" ]
|
in lib.hm.dag.entryAfter [ "linkGeneration" ]
|
||||||
(strings.concatMapStringsSep "\n" mkdir directoriesList));
|
(strings.concatMapStringsSep "\n" mkdir directoriesList));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue