Wrappers vs. Dotfiles: Difference between revisions

imported>Fzakaria
Added a link to the cookbook to keep all output files
imported>Fzakaria
mNo edit summary
Line 16: Line 16:
The disadvantage of this way is that it doesn't propagate man pages and other paths from the old derivation.
The disadvantage of this way is that it doesn't propagate man pages and other paths from the old derivation.
Please refer to [[Nix_Cookbook#Wrapping_packages]] to possible solutions to retain all outputs.
Please refer to [[Nix_Cookbook#Wrapping_packages]] to possible solutions to retain all outputs.
You can use this simple function which takes care of wrapping the script & symlinking
<syntaxhighlight lang="nix">
writeShellScriptBinAndSymlink = name: text: super.symlinkJoin {
    name = name;
    paths = [
      super."${name}"
      (super.writeShellScriptBin name text)
    ];
  };
</syntaxhighlight>


=== Downside of the Wrapper Approach ===
=== Downside of the Wrapper Approach ===