St: Difference between revisions

From NixOS Wiki
imported>Mwilsoncoding
Installing and applying patches to st
 
imported>Artturin
No edit summary
Line 1: Line 1:
st the suckless terminal or the simple terminal
in the following examples it is assumed that <syntaxhighlight lang="nix" inline>environment.systemPackages</syntaxhighlight> is in <code>/etc/nixos/</code> and there is a <code>/etc/nixos/programs/st/</code>
== Installing ==
== Installing ==
<syntaxhighlight lang="nix">
environment.systemPackages = [
  st
];</syntaxhighlight>


  environment.systemPackages = [
== Patching ==
    st
  ];


=== Official Patches ===
=== Official Patches ===
Line 9: 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 > 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:


  environment.systemPackages = [
<syntaxhighlight lang="nix">
    (st.overrideAttrs (oldAttrs: rec {
environment.systemPackages = [
      patches = [
  (st.overrideAttrs (oldAttrs: rec {
         ./rightclicktopaste.diff
    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";
       })
    ];
  }))
];</syntaxhighlight>


=== Unofficial Patches ===
=== Unofficial Patches ===
Line 25: Line 37:
Hosted on GitHub can be applied in a similar fashion using:
Hosted on GitHub can be applied in a similar fashion using:


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


=== Patch Dependencies ===
=== Patch Dependencies ===
Line 37: 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 > ligatures.diff
 
<syntaxhighlight lang="nix">
environment.systemPackages = [
  (st.overrideAttrs (oldAttrs: rec {
    buildInputs = oldAttrs.buildInputs ++ (with pkgs; [ harfbuzz ]);
    patches = [
      ./programs/st/ligatures.diff
    ];
  }))
];</syntaxhighlight>
 
== Config ==
 
=== Local config ===
 
<syntaxhighlight lang="nix">
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'';
  }))
];</syntaxhighlight>


=== Remote config ===
Luke smiths st fork is used as the example


  environment.systemPackages = [
<syntaxhighlight lang="nix">
    (st.overrideAttrs (oldAttrs: rec {
environment.systemPackages = [
       buildInputs = oldAttrs.buildInputs ++ [ pkgs.harfbuzz ];
  (st.overrideAttrs (oldAttrs: rec {
      patches = [
    src = pkgs.fetchFromGitHub {
        ./ligatures.diff
      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";
  # };
  }))
];</syntaxhighlight>

Revision as of 21:51, 5 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 = [
  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";
  # };
  }))
];