default.nix

 1{
 2  pkgs ? import <nixpkgs> { },
 3  lib ? pkgs.lib,
 4  ...
 5}:
 6let
 7  api-schema = pkgs.stdenv.mkDerivation {
 8    name = "git-bug-api-schema";
 9    src = ../api/graphql/schema;
10
11    installPhase = ''
12      cp -r $src $out
13    '';
14  };
15in
16{
17  default = pkgs.buildNpmPackage {
18    name = "git-bug-web-ui";
19    npmDepsHash = "sha256-Mut8+2kiJgeM9KnKctFttQxeq7y0VkUCgpP0zo18Gxg=";
20
21    dontStrip = false;
22
23    src = pkgs.nix-gitignore.gitignoreRecursiveSource [ ./.gitignore ./src/.gitignore ] (
24      lib.fileset.toSource {
25        root = ./.;
26        fileset = lib.fileset.difference ./. (
27          lib.fileset.unions [
28            (lib.fileset.fileFilter (
29              f:
30              lib.any (ext: f.hasExt ext) [
31                # keep-sorted start
32                "go"
33                "md"
34                "nix"
35                # keep-sorted end
36              ]
37            ) ./.)
38
39            # keep-sorted start
40            ./.gitignore
41            ./Makefile
42            ./src/.gitignore
43            # keep-sorted end
44          ]
45        );
46      }
47    );
48
49    nativeBuildInputs = with pkgs; [ go ];
50
51    postUnpack = ''
52      mkdir -p api/graphql
53      cp -r "${api-schema}" "api/graphql/schema"
54    '';
55
56    postInstall = ''
57      pwd
58      cp -rv build/ $out
59    '';
60
61    meta = {
62      description = "Web interface for git-bug, a distributed issue tracker";
63      homepage = "https://github.com/git-bug/git-bug";
64      license = lib.licenses.gpl3Plus;
65    };
66  };
67}