St: Difference between revisions

From NixOS Wiki
imported>Artturin
No edit summary
imported>Artturin
add with pkgs; and add paths
Line 5: Line 5:
== Installing ==
== Installing ==
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = with pkgs; [
   st
   st
];</syntaxhighlight>
];</syntaxhighlight>
Line 15: Line 15:
Can be applied by first downloading them from `st.suckless.org/patches` like so:
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
  curl https://st.suckless.org/patches/rightclickpaste/st-rightclickpaste-0.8.2.diff > /etc/nixos/programs/st/rightclicktopaste.diff


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


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = with pkgs; [
   (st.overrideAttrs (oldAttrs: rec {
   (st.overrideAttrs (oldAttrs: rec {
     patches = [
     patches = [
Line 38: Line 38:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = with pkgs; [
   (st.overrideAttrs (oldAttrs: rec {
   (st.overrideAttrs (oldAttrs: rec {
     patches = [
     patches = [
Line 50: Line 50:
Can be included with the `buildInputs` line like in the following ligature patch example:
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
  curl https://st.suckless.org/patches/ligatures/0.8.3/st-ligatures-20200430-0.8.3.diff > /etc/nixos/programs/st/ligatures.diff


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = with pkgs; [
   (st.overrideAttrs (oldAttrs: rec {
   (st.overrideAttrs (oldAttrs: rec {
     buildInputs = oldAttrs.buildInputs ++ (with pkgs; [ harfbuzz ]);
     buildInputs = oldAttrs.buildInputs ++ (with pkgs; [ harfbuzz ]);
Line 67: Line 67:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = with pkgs; [
   (st.overrideAttrs (oldAttrs: rec {
   (st.overrideAttrs (oldAttrs: rec {
     configFile = pkgs.writeText "config.def.h" (builtins.readFile ./programs/st/config.h);
     configFile = pkgs.writeText "config.def.h" (builtins.readFile ./programs/st/config.h);
Line 78: Line 78:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = with pkgs; [
   (st.overrideAttrs (oldAttrs: rec {
   (st.overrideAttrs (oldAttrs: rec {
     src = pkgs.fetchFromGitHub {
     src = pkgs.fetchFromGitHub {

Revision as of 04:52, 8 November 2020

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 = with pkgs; [
  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 > /etc/nixos/programs/st/rightclicktopaste.diff

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

environment.systemPackages = with pkgs; [
  (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 = with pkgs; [
  (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 > /etc/nixos/programs/st/ligatures.diff
environment.systemPackages = with pkgs; [
  (st.overrideAttrs (oldAttrs: rec {
    buildInputs = oldAttrs.buildInputs ++ (with pkgs; [ harfbuzz ]);
    patches = [
      ./programs/st/ligatures.diff
    ];
  }))
];

Config

Local config

environment.systemPackages = with pkgs; [
  (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 = with pkgs; [
  (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";
  # };
  }))
];