Replies: 3 comments
-
I don't have a full grasp on this, but it's definitely unfortunate if paths referenced in a nixvim config aren't treated as persistent runtime dependencies... Reading this nix pill, it seems nix usually figures it out automagically. However I wonder if, bucause the path is to a In a nixpkgs style derivation all runtime/installed files will have been copied to the builder's Looking at how nixos handles paths in (for example) its nixvim/modules/top-level/files/default.nix Lines 70 to 92 in 9c11b54 My first thought is that maybe any module allowing path type options should be coercing them into a derivation owned by the module implementing the option, but I feel like we'd need to discuss the issue with some experts to get a better understanding of the situation. As an initial workaround, does doing something like |
Beta Was this translation helpful? Give feedback.
-
I ended up doing this: { pkgs, ... }: let
snippets = pkgs.stdenv.mkDerivation {
name = "snippets";
src = ./.;
buildCommand = ''
mkdir $out
cp -r $src/*.{json,lua,snippets} $out
'';
};
in {
programs.nixvim = {
plugins.luasnip = {
enable = true;
fromLua = [{paths = "${snippets}";}];
fromSnipmate = [{paths = "${snippets}";}];
fromVscode = [{paths = "${snippets}";}];
};
};
} The "snippets" derivation isn't removed on |
Beta Was this translation helpful? Give feedback.
-
I created an issue from this discussion: #2179 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I configured the snippet path using the relative path like in the example. However, at one point the snippets stopped working and I figured that it happened because Nix thought the directory was only needed at a build time and could now be GC'd (I have
nix.gc.automatic
enabled). Here is the snippet from the generatedinit.lua
:I don't know how Nix decides whether the referenced path should be kept or not. I think that if I used
mkDerivation
the directory wouldn't be treated as a garbage, but I don't think that such thing should be necessary in Nixvim config.I wrote this in Discussions, because I don't know if this is my fault and if it can be improved in Nixvim.
Beta Was this translation helpful? Give feedback.
All reactions