Skip to content

Use symlinkJoin for wrappers - #15002

Merged
abbradar merged 11 commits into
NixOS:masterfrom
abbradar:symlink-join-wrappers
Apr 26, 2016
Merged

abbradar merged 11 commits into
NixOS:masterfrom
abbradar:symlink-join-wrappers

Conversation

@abbradar

@abbradar abbradar commented Apr 26, 2016 •

Copy link
Copy Markdown
Member
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This extends symlinkJoin function to accept a set with several additional arguments, and uses that to refactor many buildEnv-and-wrap-style wrappers in the tree. Also fixes dwarf-therapist.

cc @magnetophon @avnik @ericsagnes

@abbradar abbradar added the 8.has: clean-up This PR removes packages or removes other cruft label Apr 26, 2016
@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @cdepillabout, @shak-mar and @bjornfor to be potential reviewers

@abbradar
abbradar force-pushed the symlink-join-wrappers branch from 4404bf5 to 8415fa3 Compare April 26, 2016 12:37
@abbradar

Copy link
Copy Markdown
Member Author

I've tested manually all the wrappers and checked our their contents -- they seem to behave the same. As this also fixes a package and seems a good cleanup, let's merge. Full disclosure: this is the last package I need to fix before all packages in my configuration finally build ^_^.

@abbradar
abbradar merged commit f6eb686 into NixOS:master Apr 26, 2016
@cstrahan

Copy link
Copy Markdown
Contributor

Ooh, this should be useful in the Haskell packaging, where we currently use buildEnv; thanks!

@edolstra

Copy link
Copy Markdown
Member

Why is symlinkJoin better than buildEnv?

@abbradar

Copy link
Copy Markdown
Member Author

Because of a long-standing issue #4621 -- symlinkJoin happens to use lndir which does create all the directories, and is sufficient for needs of such wrappers. The dwarf-therapist package fix is just a side effect (see #14937).

@cstrahan

Copy link
Copy Markdown
Contributor

@edolstra My understanding is that symlinkJoin will always create the sub directories, rather than (selectively) symlinking. Symlinking the entire directories causes problems where we want to create the symlink forest, and then add a file to the tree -- which wouldn't be possible (without nasty workarounds) due to the symlinked folders pointing into the immutable nix store.

@vcunat

vcunat commented Apr 27, 2016 •

Copy link
Copy Markdown
Member

Symlinking the entire directories causes problems where we want to create the symlink forest, and then add a file to the tree [...]

You don't need nasty work-arounds: you can just create the files to be added in a separate derivation (e.g. runCommand) and add it to the paths.

@abbradar

Copy link
Copy Markdown
Member Author

Hm, this won't work because those wrappers often need to refer to $out of buildEnv, but I'm not sure if this can't be solved somehow...

@vcunat

vcunat commented Apr 27, 2016

Copy link
Copy Markdown
Member

Ah, I see. You can always hack around it, e.g. only create empty dirs in that runCommand, but symlinkJoin is probably a nicer way for such cases.

A couple months ago I also needed to convert symlinks to directories for a service that was locating configuration relative to detected executable location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: clean-up This PR removes packages or removes other cruft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants