St

From NixOS Wiki
Revision as of 21:51, 5 November 2020 by imported>Artturin

st the suckless terminal or the simple terminal

in the following examples it is assumed that environment.systemPackages is in /etc/nixos/ and there is a /etc/nixos/programs/st/

Installing

environment.systemPackages = [
  st
];

Patching

Official Patches

Can be applied by first downloading them from `st.suckless.org/patches` like so:

curl https://st.suckless.org/patches/rightclickpaste/st-rightclickpaste-0.8.2.diff > rightclicktopaste.diff

And then including them in an attribute override in your systemPackages declaration:

environment.systemPackages = [
  (st.overrideAttrs (oldAttrs: rec {
    patches = [
      ./programs/st/rightclicktopaste.diff
      # Patches can also be fetched directly
      (pkgs.fetchpatch {
        url = "https://st.suckless.org/patches/rightclickpaste/st-rightclickpaste-0.8.2.diff";
        sha256 = "1y4fkwn911avwk3nq2cqmgb2rynbqibgcpx7yriir0lf2x2ww1b6";
      })
    ];
  }))
];

Unofficial Patches

Hosted on GitHub can be applied in a similar fashion using:

environment.systemPackages = [
  (st.overrideAttrs (oldAttrs: rec {
    patches = [
      "${fetchFromGitHub { owner = "foo"; repo = "bar"; rev = "0.0.1"; sha256 = "111111111111111111111111111111111111111111111111111"; }}/some-custom-patch.diff"
    ];
  }))
];

Patch Dependencies

Can be included with the `buildInputs` line like in the following ligature patch example:

curl https://st.suckless.org/patches/ligatures/0.8.3/st-ligatures-20200430-0.8.3.diff > ligatures.diff
environment.systemPackages = [
  (st.overrideAttrs (oldAttrs: rec {
    buildInputs = oldAttrs.buildInputs ++ (with pkgs; [ harfbuzz ]);
    patches = [
      ./programs/st/ligatures.diff
    ];
  }))
];

Config

Local config

environment.systemPackages = [
  (st.overrideAttrs (oldAttrs: rec {
    configFile = pkgs.writeText "config.def.h" (builtins.readFile ./programs/st/config.h);
    postPatch = oldAttrs.postPatch ++ ''cp ${configFile} config.def.h'';
  }))
];

Remote config

Luke smiths st fork is used as the example

environment.systemPackages = [
  (st.overrideAttrs (oldAttrs: rec {
    src = pkgs.fetchFromGitHub {
      owner = "LukeSmithxyz";
      repo = "st";
      rev = "8ab3d03681479263a11b05f7f1b53157f61e8c3b";
      sha256 = "1brwnyi1hr56840cdx0qw2y19hpr0haw4la9n0rqdn0r2chl8vag";
    };
    buildInputs = oldAttrs.buildInputs ++ (with super; [ harfbuzz ]);
  # If you want it to be always up to date use fetchTarball instead of fetchFromGitHuh
  # src = pkgs.fetchTarball {
  #   url = "https://github.com/lukesmithxyz/st/archive/master.tar.gz";
  # };
  }))
];