mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 03:09:47 +01: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
942146ac90
commit
0c4a97f880
1 changed files with 2 additions and 1 deletions
|
@ -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