Wrappers vs. Dotfiles: Difference between revisions
Appearance
imported>Tv import https://github.com/NixOS/nixpkgs/pull/9250#issuecomment-323732211 |
(No difference)
|
Revision as of 09:44, 27 October 2018
Usually user applications (like editors, etc.) get configured through dotfiles in the user's home directory. An alternative, declarative approach is to create wrappers for application on a per-user basis, like this:
{
users.users.root.packages = [
(pkgs.writeScriptBin "htop" ''
#! ${pkgs.bash}/bin/bash
export HTOPRC=${pkgs.writeText "htoprc" ...}
exec ${pkgs.htop}/bin/htop "$@"
'')
];
}
Downside of the Wrapper Approach
- There might be applications that don't provide means to specify configuration. One could override
$HOME, but then there might be applications that require$HOMEfor other stuff than configuration. - Applications cannot write their configuration anymore, e.g.
htopwill just terminate without error and nothing changed.
Alternatives
- Home Manager manages dotfiles in the user's home directory