package.nix

48 lines · 1072 bytes

 1{
 2  buildGoModule,
 3  lib,
 4  makeBinaryWrapper,
 5  mpv,
 6  rofi,
 7  ueberzugpp,
 8  withMpv ? true,
 9  withRofi ? false,
10  withUeberzugpp ? false,
11}: let
12  inherit (lib) optional optionalString;
13
14  path = optional withMpv mpv
15    ++ optional withRofi rofi
16    ++ optional withUeberzugpp ueberzugpp;
17in
18  buildGoModule {
19    pname = "curd";
20    version = builtins.readFile ./VERSION.txt;
21
22    src = lib.fileset.toSource {
23      root = ./.;
24      fileset = lib.fileset.unions [
25        ./cmd
26        ./internal
27        ./vendor
28
29        ./go.mod
30        ./go.sum
31      ];
32    };
33
34    nativeBuildInputs = [makeBinaryWrapper];
35    vendorHash = null;
36
37    postFixup = optionalString (builtins.length path > 0) ''
38      wrapProgram $out/bin/curd --prefix PATH : ${lib.makeBinPath path}
39    '';
40
41    meta = {
42      description = "Watch anime in CLI with AniList Tracking, Discord RPC, and automatic intro/outro skipping";
43      homepage = "https://github.com/Wraient/curd";
44      license = lib.licenses.gpl3;
45      platforms = lib.platforms.unix;
46      mainProgram = "curd";
47    };
48  }