brewery
notashelf /
5a9242b53f3a4122e1031f9326d8ba8b9f31e2b9

beer

public

A terminal worth pouring time into

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