brewery
notashelf /
db9b53fdadda888e7ffeaa4a113d0348c96db75b

beer

public

A terminal worth pouring time into

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/beer.git
nix/package.nixNix79 lines1.9 KB
1
{
2
  lib,
3
  rustPlatform,
4
  pkg-config,
5
  makeBinaryWrapper,
6
  ncurses,
7
  scdoc,
8
  installShellFiles,
9
  wayland,
10
  libxkbcommon,
11
  freetype,
12
  fontconfig,
13
  harfbuzz,
14
}: let
15
  cargoTOML = lib.importTOML ../Cargo.toml;
16
in
17
  rustPlatform.buildRustPackage (finalAttrs: {
18
    pname = "beer";
19
    version = cargoTOML.workspace.package.version;
20
21
    src = let
22
      fs = lib.fileset;
23
      s = ../.;
24
    in
25
      fs.toSource {
26
        root = s;
27
        fileset = fs.unions [
28
          (s + /crates)
29
          (s + /Cargo.lock)
30
          (s + /Cargo.toml)
31
          (s + /terminfo)
32
          (s + /doc)
33
        ];
34
      };
35
36
    cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
37
    enableParallelBuilding = true;
38
39
    strictDeps = true;
40
    nativeBuildInputs = [
41
      pkg-config
42
      makeBinaryWrapper
43
      ncurses # tic
44
      scdoc # man page generation
45
      installShellFiles # installManPage
46
    ];
47
48
    buildInputs = [
49
      wayland
50
      libxkbcommon
51
      freetype
52
      fontconfig
53
      harfbuzz
54
    ];
55
56
    # Install the terminfo entry, and make the Wayland/xkb libraries (loaded via
57
    # dlopen, so not captured by rpath) discoverable at runtime.
58
    postInstall = ''
59
      mkdir -p "$out/share/terminfo"
60
      tic -x -o "$out/share/terminfo" terminfo/beer.info
61
62
      # Generate the man pages from their scdoc sources.
63
      scdoc < doc/beer.1.scd > beer.1
64
      scdoc < doc/beer.toml.5.scd > beer.toml.5
65
      installManPage beer.1 beer.toml.5
66
67
      wrapProgram "$out/bin/beer" \
68
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [wayland libxkbcommon]}
69
    '';
70
71
    meta = {
72
      description = "A fast, software-rendered, Wayland-native terminal emulator";
73
      homepage = "https://github.com/NotAShelf/beer";
74
      license = lib.licenses.eupl12;
75
      maintainers = with lib.maintainers; [NotAShelf];
76
      mainProgram = "beer";
77
      platforms = lib.platforms.linux;
78
    };
79
  })