[Nix-dev] Package: tabbed

Alexander Foremny alexanderforemny at googlemail.com
Thu Jan 5 01:49:19 CET 2012


Hello.

I am trying to create a package for tabbed [1] and I am wondering how to
handle configuration. To the best of my knowledge tabbed can solely be
configured by editing `config.h.def' prior to compilation. I thought it
would be nice to expose all of the configuration to Nix and I started to
create a package which does that.

Essentially I recreate the default configuration from a attribute set which
could be changed using Nix. See default.nix and
tabbedconfig-for-default.nix below.

Is this adviced procedure or should this matter be handled differently?

For instance the user could supply a patch to be applied the very same way.
However, since tabbed is not updated frequently (it's 0.3 since I started
using it) and the configuration file doesn't have many options I thought
the proposed approach would integrate best with NixOS.

Has this already been discussed somewhere?

Regards
Alexander Foremny

[1] http://tools.suckless.org/tabbed

default.nix
> { stdenv, fetchurl, libX11,
>  tabbedConfig ? import ./tabbedconfig-for-default.nix }:
>
> stdenv.mkDerivation {
> ...
>   patchPhase = ''
>       cat << EOF > config.def.h
>       static const char *font        = "${tabbedConfig.font}";
>       static const char *normbgcolor = "${tabbedConfig.normBgColor}";
>       static const char *normfgcolor = "${tabbedConfig.normFgColor}";
>       static const char *selbgcolor  = "${tabbedConfig.selBgColor}";
>       static const char *selfgcolor  = "${tabbedConfig.selFgColor}";
>       static const char *before      = "${tabbedConfig.before}";
>       static const char *after       = "${tabbedConfig.after}";
>       static const int tabwidth      = ${tabbedConfig.tabWidth};
>       static const Bool foreground   = ${tabbedConfig.foreground};
> ...
>       EOF
>   '';
> ...

tabbedconfig-for-default.nix
> { font        = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
>   normBgColor = "#cccccc";
>   normFgColor = "#000000";
>   selBgColor  = "#0066ff";
>   selFgColor  = "#ffffff";
>   before      = "<";
>   after       = ">";
>   tabWidth    = "200";
>   foreground  = "False";
>   modKey      = "ControlMask";
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20120105/f801da88/attachment.html 


More information about the nix-dev mailing list