[Nix-dev] What are the rules about 'share/' directory symlinking to profile?

Alexey Lebedeff binarin at gmail.com
Thu Apr 20 13:33:35 CEST 2017


I've tried with fzf.out and it also doesn't add anything to 'share' in
profile folder. The only way I was able to make it work is by adding
'share' folder to 'bin' output. Looks like some magic is attached to
'bin' itself (because I've also tried reordering outputs without any
change) - but I can't figure out how and why this is happening.

1) For fzf.out 'vim-plugins' folder is not added to profile after installation

   $ nix-build . -A fzf.out
   /nix/store/mp5drsp2l1z7k0rp4jjmll06kjck7052-fzf-0.16.6

   # 'share' is present in nix store
   $ ls ./result/share/vim-plugins/ -l
   total 4
   lrwxrwxrwx 1 root root 91 Jan  1  1970 fzf-0.16.6 -> /nix/store/mp5drsp2l1z7k0rp4jjmll06kjck7052-fzf-0.16.6/share/go/src/github.com/junegunn/fzf

   $ nix-env -f . -iA fzf.out

   # But it's missing from profile even after explicitly installing that
   $ ls -la ~/.nix-profile/share/vim-plugins
   ls: cannot access '/home/binarin/.nix-profile/share/vim-plugins': No such file or directory

2) But everything works if I add 'share' folder to 'bin' output instead, using the following
   lines in postInstall:

   +    mkdir -p $bin/share/vim-plugins
   +    cp -a $out/share/go/src/github.com/junegunn/fzf $bin/share/fzf-tmp
   +    ln -s $bin/share/fzf-tmp $bin/share/vim-plugins/${name}

   $ nix-build . -A fzf.bin
   /nix/store/3dzqj1xk6s5jfm1z4kwnkfdg9yw3xckr-fzf-0.16.6-bin

   $ ls ./result-bin/share/vim-plugins/ -l
   total 4
   lrwxrwxrwx 1 root root 72 Jan  1  1970 fzf-0.16.6 -> /nix/store/3dzqj1xk6s5jfm1z4kwnkfdg9yw3xckr-fzf-0.16.6-bin/share/fzf-tmp

   $ nix-env -f . -iA fzf.bin

   $ ls -la ~/.nix-profile/share/vim-plugins
   lrwxrwxrwx 1 root root 76 Jan  1  1970 /home/binarin/.nix-profile/share/vim-plugins -> /nix/store/3dzqj1xk6s5jfm1z4kwnkfdg9yw3xckr-fzf-0.16.6-bin/share/vim-plugins

Best,
Alexey


Guillaume Maudoux (Layus) writes:

> I guess the idea is that you need to install `fzf.out` explicitly,
> because installing `fzf` installs the first output, which is `fzf.bin`.
>
> -- Layus.
>
>
> On 20/04/17 11:46, Alexey Lebedeff wrote:
>> Hi folks.
>>
>> What are the rules about how and when 'share/' folder of (multi-output)
>> derivation will be merged into 'share/' folder of profile?
>>
>> E.g. I can't see content of
>> https://github.com/NixOS/nixpkgs/blob/4a0be7837cadf9b6e9cae430d80f65a2af60dcc6/pkgs/tools/misc/fzf/default.nix#L33
>> anywhere in my profile 'share/' even after installing every output
>>
>> Only when I move 'share/' to '$bin' output, it starts appearing in profile
>> 'share/' folder.
>>
>> Best,
>> Alexey
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> https://mailman.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list