[Nix-dev] Garbled man pages/incomplete environment

James Cook james.cook at utoronto.ca
Sun Jul 5 03:20:20 CEST 2015


On 4 July 2015 at 09:24, Jeffrey David Johnson <jefdaj at gmail.com> wrote:
> I'm having the same issue described here on the Gentoo forums:
>
> https://forums.gentoo.org/viewtopic-t-670013.html
>
> Man pages are hard to read because they're full of control characters. For example:
>
> NIXOS-REBUILD(8)              NixOS Reference Pages              NIXOS-REBUILD(8)
>
> ESC[1mNAMEESC[0m
>        nixos-rebuild - reconfigure a NixOS machine
>
> ESC[1mSYNOPSISESC[0m
>        ESC[1mnixos-rebuild ESC[22m{ESC[1mswitch ESC[22m| ESC[1mboot ESC[22m| ESC[1mtest
> ESC[22m| ESC[1mbuild ESC[22m| ESC[1mdry-build ESC[22m| ESC[1mdry-activate ESC[22m|
> ...
>
> I expect it's a problem with my environment variables, so
> here's my profile.nix which I import into configuration.nix:
>
> with import <mypkgs>;
>
> {
>   programs.bash = {
>     enableCompletion = true;
>     # promptInit = "PS1=\"# \"";
>   };
>
>   # replaces traditional xinitrc
>   services.xserver.displayManager.sessionCommands = ''
>     export EDITOR=qvim # why no gvim?
>     xsetroot -cursor_name left_ptr &
>     [[ -a ~/.fehbg ]] && eval $(cat ~/.fehbg)
>     unclutter -idle 1 &
>     eval "$(ssh-agent -s)" &
>   '';
>
>   environment.variables = lib.mkForce rec {
>     EDITOR   = "vim" ;
>     TERM     = TERMINAL;
>     TERMINAL = "xfce4-terminal";
>   };
>
>   # this gets reset if in environment.variables for some reason
>   environment.interactiveShellInit = ''
>     export NIX_PATH=/git/hub/nixcfg
>   '';
>
>   # TODO why can't nix-env find things on the regular NIX_PATH?
>   environment.shellAliases = {
>     "nix-env" = "nix-env -f ${<mypkgs>}";
>   };
> }
>
> As you can see I also have issues setting up NIX_PATH.
> The current kludgy solution is working OK, but if you know
> how to clean it up please mention that too! My worry is
> that I've deleted all the environment variables not
> mentioned here including some important ones, and man
> pages are just the first thing I noticed.
>
> Thanks
> Jeff

The only thing that comes to mind: environment.varibles = lib.mkForce
... looks suspicious to me. Does it work without the mkForce?

(If environment.variables is like other configuration variables I've
met, then mkForce means discard whatever the defaults are, and leaving
out mkForce means append the values you specify to whatever the
defaults are.)

You could always start commenting out parts of the configuration and
observing the changes, but of course that's tedious. Maybe using
nixos-rebuild build-vm could help.

James


More information about the nix-dev mailing list