~kris/suckless

st

71f9529a6d06df140909d60df5901b02fedee1bf — Sidhanth Rathod 4 years ago df114a3 + b94f5ca
Merge pull request #40 from sioodmy/implement/nix-flake

Implement Nix flakes :snowflake: 
5 files changed, 143 insertions(+), 14 deletions(-)

M README.md
A default.nix
A flake.lock
A flake.nix
D shell.nix
M README.md => README.md +23 -9
@@ 7,29 7,42 @@
## Dependencies

```
# Void 
# Void
xbps-install libXft-devel libX11-devel harfbuzz-devel libXext-devel libXrender-devel libXinerama-devel
 

# Debian (and ubuntu probably)
apt install build-essential libxft-dev libharfbuzz-dev 
apt install build-essential libxft-dev libharfbuzz-dev

# Nix
nix develop github:siduck/st

(most of these are already installed on Arch based distros)

# Install font-symbola and libXft-bgra
```

## Try it out!

Before you install st on your system, you might want to try it out first.
To do so, simply run (requires [Nix](https://nixos.org/download.html))
`nix run github:siduck/st`

## Install

```
git clone https://github.com/siduck/st.git
cd st
sudo make install 
sudo make install
xrdb merge pathToXresourcesFile
```

(note : put the xrdb merge command in your wm's autostart or similar) 
(note : put the xrdb merge command in your wm's autostart or similar)

## Fonts 
### Using Nix flakes

Add `st.url = "github:siduck/st";` to your inputs and install `inputs.st.packages."${system}".st-snazzy` package

## Fonts

- Install JetbrainsMono Mono Nerd Font or any nerd font from [here](https://www.nerdfonts.com/font-downloads)



@@ 62,6 75,7 @@ alias rel="xrdb merge pathToXresourcesFile && kill -USR1 $(pidof st)"
```

## Ram usage comparison with other terminals and speed test

<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/terminal_ramUsage.jpg"> <br><br>
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/speedTest.png"> <br><br>
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/speedTest1.png"> <br><br>


@@ 73,7 87,7 @@ alias rel="xrdb merge pathToXresourcesFile && kill -USR1 $(pidof st)"
<pre>
ctrl + shift + c        Copy  <br>
ctrl + shift + v        Paste <br>
right click on the terminal ( will paste the copied thing ) 
right click on the terminal ( will paste the copied thing )

(Zoom)
alt  + comma            Zoom in <br>


@@ 85,7 99,7 @@ alt  + s                Increase Transparency<br>
alt  + a                Decrease Transparency<br>
alt  + m                Reset Transparency<br>

alt + k                 scroll down 
alt + k                 scroll down
alt + j                 scroll up

mod + shift + enter    open a new terminal with same cwd ( current working directory )


@@ 109,5 123,5 @@ you can change all of these in config.h

# Credits

- [live-reload](https://github.com/nimaipatel/st) 
- [live-reload](https://github.com/nimaipatel/st)
- [patch_column](https://github.com/nimaipatel/st/blob/all/patches/7672445bab01cb4e861651dc540566ac22e25812.diff)

A default.nix => default.nix +42 -0
@@ 0,0 1,42 @@
{ lib, stdenv, fetchurl, pkg-config, fontconfig, freetype, libX11, libXft
, harfbuzz, gd, glib, ncurses, writeText, conf ? null, patches ? [ ]
, extraLibs ? [ ], nixosTests }:

stdenv.mkDerivation rec {
  pname = "st-snazzy";
  version = "0.8.5";

  src = ./.;
  inherit patches;

  configFile =
    lib.optionalString (conf != null) (writeText "config.def.h" conf);

  postPatch = lib.optionalString (conf != null) "cp ${configFile} config.def.h"
    + lib.optionalString stdenv.isDarwin ''
      substituteInPlace config.mk --replace "-lrt" ""
    '';

  strictDeps = true;

  makeFlags = [ "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" ];

  nativeBuildInputs = [ pkg-config ncurses fontconfig freetype ];
  buildInputs = [ libX11 libXft harfbuzz gd glib ] ++ extraLibs;

  preInstall = ''
    export TERMINFO=$out/share/terminfo
  '';

  installFlags = [ "PREFIX=$(out)" ];

  passthru.tests.test = nixosTests.terminal-emulators.st;

  meta = with lib; {
    homepage = "https://github.com/siduck/st";
    description = "snazzy terminal (suckless + lightweight)";
    license = licenses.mit;
    maintainers = with maintainers; [ sioodmy ];
    platforms = platforms.unix;
  };
}

A flake.lock => flake.lock +43 -0
@@ 0,0 1,43 @@
{
  "nodes": {
    "flake-utils": {
      "locked": {
        "lastModified": 1656928814,
        "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1658161305,
        "narHash": "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "e4d49de45a3b5dbcb881656b4e3986e666141ea9",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

A flake.nix => flake.nix +35 -0
@@ 0,0 1,35 @@
{
  description = "snazzy terminal (suckless + lightweight)";

  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system};
      in rec {
        packages = flake-utils.lib.flattenTree {
          st-snazzy = pkgs.callPackage ./default.nix { };
        };
        defaultPackage = packages.st-snazzy;
        apps.st-snazzy = flake-utils.lib.mkApp {
          drv = packages.st-snazzy;
          exePath = "/bin/st";
        };
        apps.default = apps.st-snazzy;
        defaultApp = apps.st-snazzy;
        devShell = pkgs.mkShell rec {
          name = "st-snazzy";
          packages = with pkgs; [
            pkgconfig
            xorg.libX11
            xorg.libXft
            fontconfig
            harfbuzz
            gd
            glib
          ];
        };

      });
}

D shell.nix => shell.nix +0 -5
@@ 1,5 0,0 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  nativeBuildInputs = with pkgs; [ pkgconfig xorg.libX11 xorg.libXft fontconfig harfbuzz ];
}