brewery

beer

public

A terminal worth pouring time into

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/beer.git
nix/package.nixNix88 lines2.3 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
          (s + /contrib)
34
        ];
35
      };
36
37
    cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
38
    enableParallelBuilding = true;
39
40
    strictDeps = true;
41
    nativeBuildInputs = [
42
      pkg-config
43
      makeBinaryWrapper
44
      ncurses # tic
45
      scdoc # man page generation
46
      installShellFiles # installManPage
47
    ];
48
49
    buildInputs = [
50
      wayland
51
      libxkbcommon
52
      freetype
53
      fontconfig
54
      harfbuzz
55
    ];
56
57
    # Install the terminfo entry, and make the Wayland/xkb libraries (loaded via
58
    # dlopen, so not captured by rpath) discoverable at runtime.
59
    postInstall = ''
60
      mkdir -p "$out/share/terminfo"
61
      tic -x -o "$out/share/terminfo" terminfo/beer.info
62
63
      # Generate the man pages from their scdoc sources.
64
      scdoc < doc/beer.1.scd > beer.1
65
      scdoc < doc/beer.toml.5.scd > beer.toml.5
66
      scdoc < doc/beer-themes.7.scd > beer-themes.7
67
      installManPage beer.1 beer.toml.5 beer-themes.7
68
69
      # Desktop entry, scalable icon, and a commented example config.
70
      install -Dm644 contrib/dev.notashelf.beer.desktop \
71
        "$out/share/applications/dev.notashelf.beer.desktop"
72
      install -Dm644 contrib/dev.notashelf.beer.svg \
73
        "$out/share/icons/hicolor/scalable/apps/dev.notashelf.beer.svg"
74
      install -Dm644 contrib/beer.toml "$out/share/doc/beer/beer.toml.example"
75
76
      wrapProgram "$out/bin/beer" \
77
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [wayland libxkbcommon]}
78
    '';
79
80
    meta = {
81
      description = "A fast, software-rendered, Wayland-native terminal emulator";
82
      homepage = "https://github.com/NotAShelf/beer";
83
      license = lib.licenses.eupl12;
84
      maintainers = with lib.maintainers; [NotAShelf];
85
      mainProgram = "beer";
86
      platforms = lib.platforms.linux;
87
    };
88
  })