home-manager
home-manager copied to clipboard
files: allow target conflicts between recursively-linked directories (exclusively)
Description
Loosened the "no two home.file directives may have the same target" constraint: Multiple directives may share a target if and only if they are recursively-linked directories
Checklist
-
[X] Change is backwards compatible. note: one bout of weirdness is the use of
pathExists "${sourceStorePath v}/.."
to detect if the source path is a directory. This might warrant a double check for cross-platform compatibility -
[X] Code formatted with
./format
. note: due to the large changes caused by this, formatting was done in a separate, reproducible commit. -
[X] Code tested through
nix-shell --pure tests -A run.all
. (note: the line in the tests about neovim was disabled, as that test failed both before and after my changes. this is however not committed) -
[X] Test cases updated/added. See example.
-
[X] Commit messages are formatted like
{component}: {description} {long description}
See CONTRIBUTING for more information and recent commit messages for examples.
If you saw the previous (closed WIP) pull request, this is a simpler version, which doesn't re-fix what was already fixed in the lest few months[?].
Also, I'm no longer trying to understand how force
interacts with recursive
, as there is no apparent breaking change in that area here.
force
seems to straight-up not work when recursive
is active, both on per-file conflict and in terms of overriding the full directory, whatever the "ideal" behavior of that interaction is supposed to be
Thanks for the contribution! I was having a look at this and in general it seems fine. But I do feel a bit reluctant to make source
a mergeable option since it seems quite unintuitive to me. If I needed to merge source directories and link them recursively then the first thing that comes to mind is to use symlinkJoin
like so
home.file."test-recursive-joined" = {
source = pkgs.symlinkJoin {
name = "test-recursive-joined";
paths = [ ./test1 ./test2 ];
};
recursive = true;
};
Do you really need the mergeability or is the symlinkJoin
solution sufficient?
There would probably be some usecases where being able to have separate directives (if they are in different files which have completely different purposes and are both included by home.nix
, maybe?)
…But I have to admit I outright didn't know about symlinkJoin
, and it would fit my usecase nicely.
Should I do a pull request that simply mentions that function in the docs for home.file
instead?
…@rycee should I?
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.
If you are the original author of the PR
- GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
- If it is unfinished but you plan to finish it, please mark it as a draft.
- If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
- To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR
- If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.