base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / al / alice-lg / package.nix
blob500f41f390826d1a34d80acb155c8a4c1815b8e1
2   lib,
3   fetchFromGitHub,
4   buildGoModule,
5   fetchYarnDeps,
6   stdenv,
7   gitUpdater,
8   yarn,
9   nodejs,
10   nixosTests,
11   fixup-yarn-lock,
14 buildGoModule rec {
15   pname = "alice-lg";
16   version = "6.1.0";
18   src = fetchFromGitHub {
19     owner = "alice-lg";
20     repo = "alice-lg";
21     rev = version;
22     hash = "sha256-BbwTLHDtpa8HCECIiy+UxyQiLf9iAD2GzE0azXk7QGU=";
23   };
25   vendorHash = "sha256-8N5E1CW5Z7HujwXRsZLv7y4uNOJkjj155kmX9PCjajQ=";
27   passthru.ui = stdenv.mkDerivation {
28     pname = "alice-lg-ui";
29     src = "${src}/ui";
30     inherit version;
32     yarnOfflineCache = fetchYarnDeps {
33       yarnLock = src + "/ui/yarn.lock";
34       hash = "sha256-PwByNIegKYTOT8Yg3nDMDFZiLRVkbX07z99YaDiBsIY=";
35     };
37     nativeBuildInputs = [
38       nodejs
39       yarn
40       fixup-yarn-lock
41     ];
43     configurePhase = ''
44       runHook preConfigure
46       # Yarn and bundler wants a real home directory to write cache, config, etc to
47       export HOME=$NIX_BUILD_TOP/fake_home
49       # Make yarn install packages from our offline cache, not the registry
50       yarn config --offline set yarn-offline-mirror $yarnOfflineCache
52       # Fixup "resolved"-entries in yarn.lock to match our offline cache
53       fixup-yarn-lock yarn.lock
55       yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
56       patchShebangs node_modules/
57       runHook postConfigure
58     '';
60     buildPhase = ''
61       runHook preBuild
63       ./node_modules/.bin/react-scripts build
65       runHook postBuild
66     '';
68     installPhase = ''
69       runHook preInstall
71       mv build $out
73       runHook postInstall
74     '';
75   };
77   preBuild = ''
78     cp -R ${passthru.ui}/ ui/build/
79   '';
81   subPackages = [ "cmd/alice-lg" ];
82   doCheck = false;
84   passthru = {
85     tests = nixosTests.alice-lg;
86     updateScript = gitUpdater { };
87   };
89   meta = {
90     homepage = "https://github.com/alice-lg/alice-lg";
91     description = "Looking-glass for BGP sessions";
92     changelog = "https://github.com/alice-lg/alice-lg/blob/main/CHANGELOG.md";
93     license = lib.licenses.bsd3;
94     maintainers = with lib.maintainers; [ stv0g ];
95     mainProgram = "alice-lg";
96   };