package.nix

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