-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aspell: added new patch data-dirs-from-nix-profiles.patch #30234
aspell: added new patch data-dirs-from-nix-profiles.patch #30234
Conversation
@deedrah, how about this part? nixpkgs/nixos/modules/programs/environment.nix Lines 52 to 57 in eb21d19
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked on
aspellWithDicts
derivation, but I don't think it could solve this problem.
It may be good to add a line in the header of the aspellWithDicts
expression explaining this limitation.
@@ -10,6 +10,7 @@ stdenv.mkDerivation rec { | |||
|
|||
patchPhase = '' | |||
patch interfaces/cc/aspell.h < ${./clang.patch} | |||
patch -p1 < ${./data-dirs-from-nix-profiles.patch} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be an optional patch, because looking for NIX_PROFILES
is basically an impurity. See the if [ -z "\$ASPELL_CONF" ]; then
in the code that is removed. This is important for aspellWithPackages
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For build-time purity, I agree. For run-time purity, I think it's a bit of a gray area. Taking this purity argument to the extreme would be that e.g. "bash" on NixOS would not see "git" unless you have a "bash = bashWithPackages [ git ]" thing. And I don't think we want that :-)
An alternative could be to modify the patch so that it only reads NIX_PROFILES if NIX_ASPELL_USE_PROFILES is set (or something). Then the patch could be applied unconditionally. (No recompilation needed.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For build-time purity, I agree. For run-time purity, I think it's a bit of a gray area. Taking this purity argument to the extreme would be that e.g. "bash" on NixOS would not see "git" unless you have a "bash = bashWithPackages [ git ]" thing. And I don't think we want that :-)
That's an impurity that exists by default, and one which is quite useful. Yet, if you want to, you could prevent it by creating a buildEnv
and creating wrappers setting e.g PATH
.
In this case, the impurity can also be useful, however it is now forced, thus requiring a wrapper unsetting NIX_PROFILES
.
If I wanted these kind of impurities, I could have stayed with Debian or any other distro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition ensure that whenever ASPELL_CONF
contains data-dir
or dict-dir
, NIX_PROFILES
is ignored.
I have tested that aspellWithDicts
behaves as it should with this patch.
I don't think another variable is needed, but adding new parameter for the derivation like searchNixProfiles
for safety would be OK.
@michalrus I have tested it with I have tried build And about |
I agree with @deedrah , that's for another PR. |
f3859bf
to
86c5bfc
Compare
I have update my branch. @michalrus |
@deedrah, I think I just used:
… but with the previous commit SHA1. But now when I tried that, with the current one:
The error was:
So this is unrelated to your PR. Could you give me a command that works for you w/ gedit? Thank you for your effort! ♥ |
Possibly just rebase this commit onto somewhere later, where that |
This patch starts to compile on current nixos-unstable, 0ce09af. But it’s currently building webkit. :/ |
It compiled well on
I do confirm gedit works, though. |
@deedrah, so it would be wonderful if you rebased this commit onto |
Aspell will search for dictionaries in all nix profiles even when used as library. Setting data-dir or dict-dir in ASPELL_CONF will disable this behavior.
86c5bfc
to
ba4cefe
Compare
@michalrus it's rebased |
Cool, thank you! (ノ^_^)ノ @FRidh, WDYT? |
Awesome, thank you, all! 🤗 |
aspell does not find the dictionary installed in config.nix after the following change: NixOS/nixpkgs#30234
We set[1] ASPELL_CONF to the last nix profile containing lib/aspell in 2013. In 2017, aspell is patched[2] to search NIX_PROFILES, which makes [1] not needed any more. Deleting it is also agreed in this discussion[3]. [1]: 0192c02 [2]: ba4cefe [3]: NixOS#30234
Aspell will search for dictionaries in all nix profiles even when used as library.
Setting data-dir or dict-dir in ASPELL_CONF will disable this behavior.
Motivation for this change
The ASPELL_CONF variable is used only by aspell binary so any application using aspell API will never see any dictionaries (like in #28815). Internal code of aspell allows multiple data/dict search paths so is possible to add all
lib/aspell
subdirectories from all nix profiles, unlike when using ASPELL_CONF.Any application using
libaspell
will be able use any dictionary installed without any modification.I have looked on
aspellWithDicts
derivation, but I don't think it could solve this problem.Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)