Can't install st terminal

I’m trying to install st terminal. I have an overlay which looks like this

final: prev:

let
 sources = import ./nix/sources.nix;
 pkgs = import sources.nixpkgs {};
in {
  st = prev.st.override {
    conf = ''
      /* See LICENSE file for copyright and license details. */

/*
 * appearance
 *
 * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
 */
static char *font = "Operator Mono SSm Book:pixelsize=16:antialias=true:autohint=true";
static int borderpx = 10;

/*
 * What program is execed by st depends of these precedence rules:
 * 1: program passed with -e
 * 2: scroll and/or utmp
 * 3: SHELL environment variable
 * 4: value of shell in /etc/passwd
 * 5: value of shell in config.h
 */
static char *shell = "/usr/bin/fish";
char *utmp = NULL;
/* scroll program: to enable use a string like "scroll" */
char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";

/* identification sequence returned in DA and DECID */
char *vtiden = "\033[?6c";

/* Kerning / character bounding-box multipliers */
static float cwscale = 1.0;
static float chscale = 1.0;

/*
 * word delimiter string
 *
 * More advanced example: L" `'\"()[]{}"
 */
wchar_t *worddelimiters = L" ";

...more text after that
    '';
  };
}

This is exactly 100% the same config I use on Arch when running make install and it works. Yet on NixOS when then running nixos-rebuild switch I get

In file included from x.c:61:
config.h:37:10: error: conflicting types for 'worddelimiters'
   37 | wchar_t *worddelimiters = L" ";
      |          ^~~~~~~~~~~~~~
In file included from x.c:20:
st.h:117:14: note: previous declaration of 'worddelimiters' was here
  117 | extern char *worddelimiters;
      |              ^~~~~~~~~~~~~~
In file included from x.c:61:
config.h:177:38: warning: initialization of 'char *' from incompatible pointer type 'void (*)(const Arg *)' {aka 'void (*)(const union <anonymous> *)'} [-Wincompatible-pointer-types]
  177 |     { XK_ANY_MOD,           Button2, selpaste,       {.i = 0},      1 },
      |                                      ^~~~~~~~
config.h:177:38: note: (near initialization for 'mshortcuts[0].s')
config.h:177:54: error: extra brace group at end of initializer
  177 |     { XK_ANY_MOD,           Button2, selpaste,       {.i = 0},      1 },
      |                                                      ^

and many more errors like this. Without the overlay it works but then I obviously don’t have my configuration. I have no idea where to even start debugging this

It seems that you have a configuration that is valid only for newer versions of st.

If you don’t use nixpkgs unstable, the current st version is 0.8.2. Your config uses wchar_t for the type of worddelimiters. This is necessary since this change to st, but that is only included since version 0.8.3. So it will fail with 0.8.2

You have many options to fix the issue:

  • Use nixpkgs unstable channel and leave your config as it is now
  • Change your config to be compatible with st 0.8.2
  • In your overlay, use overrideAttrs to change the source of st to a newer one. This way, your build will work either with nixpkgs unstable or with 20.03
1 Like