Wrappers vs. Dotfiles: Difference between revisions
imported>Fzakaria Added wrapProgram example |
Redchess64 (talk | contribs) m fixed a code block that i copypasted, and then suffered for 2 hours debugging |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 14: | Line 14: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
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. | |||
You can use this simple function which takes care of wrapping the script & symlinking | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | writeShellScriptBinAndSymlink = name: text: super.symlinkJoin { | ||
name = name; | |||
paths = [ | |||
(super.writeShellScriptBin name text) | |||
} | super."${name}" | ||
]; | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Downside of the Wrapper Approach === | === Downside of the Wrapper Approach === | ||
Line 30: | Line 34: | ||
=== Alternatives === | === Alternatives === | ||
* [[Home Manager]] manages dotfiles in the user's home directory | * [[Home Manager]] manages dotfiles in the user's home directory | ||
[[Category:Configuration]] |