summary refs log tree commit diff
path: root/pkgs/servers/alice-lg
diff options
context:
space:
mode:
authorJanik H <janik@aq0.de>2023-03-30 12:36:38 +0200
committerJanik H <janik@aq0.de>2023-05-10 20:47:39 +0200
commitc2690b6544838e149819eeafd0be842b0aab1e48 (patch)
tree1ce516d9cada0f5fc2c9a6d967c74a59d0be4154 /pkgs/servers/alice-lg
parent22071c835f93ac6728ba23ccac108b6bfeb9a818 (diff)
downloadnixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.tar
nixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.tar.gz
nixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.tar.bz2
nixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.tar.lz
nixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.tar.xz
nixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.tar.zst
nixpkgs-c2690b6544838e149819eeafd0be842b0aab1e48.zip
alice-lg: init at 6.0.0
Diffstat (limited to 'pkgs/servers/alice-lg')
-rw-r--r--pkgs/servers/alice-lg/default.nix84
1 files changed, 84 insertions, 0 deletions
diff --git a/pkgs/servers/alice-lg/default.nix b/pkgs/servers/alice-lg/default.nix
new file mode 100644
index 00000000000..2e77d6917d6
--- /dev/null
+++ b/pkgs/servers/alice-lg/default.nix
@@ -0,0 +1,84 @@
+{ lib
+, fetchFromGitHub
+, buildGoModule
+, fetchYarnDeps
+, stdenv
+, yarn
+, nodejs
+, git
+, fixup_yarn_lock
+}:
+
+buildGoModule rec {
+  pname = "alice-lg";
+  version = "6.0.0";
+
+  src = fetchFromGitHub {
+    owner = "alice-lg";
+    repo = "alice-lg";
+    rev = version;
+    hash = "sha256-BdhbHAFqyQc8UbVm6eakbVmLS5QgXhr06oxoc6vYtsM=";
+  };
+
+  vendorSha256 = "sha256-SNF46uUTRCaa9qeGCfkHBjyo4BWOlpRaTDq+Uha08y8=";
+
+  passthru.ui = stdenv.mkDerivation {
+    pname = "alice-lg-ui";
+    src = "${src}/ui";
+    inherit version;
+
+    yarnOfflineCache = fetchYarnDeps {
+      yarnLock = src + "/ui/yarn.lock";
+      hash = "sha256-NeK9IM8E2IH09SVH9lMlV3taCmqwlroo4xzmv4Q01jI=";
+    };
+
+    nativeBuildInputs = [ nodejs yarn git ];
+    configurePhase = ''
+      runHook preConfigure
+
+      # Yarn and bundler wants a real home directory to write cache, config, etc to
+      export HOME=$NIX_BUILD_TOP/fake_home
+
+      # Make yarn install packages from our offline cache, not the registry
+      yarn config --offline set yarn-offline-mirror $yarnOfflineCache
+
+      # Fixup "resolved"-entries in yarn.lock to match our offline cache
+      ${fixup_yarn_lock}/bin/fixup_yarn_lock yarn.lock
+
+      yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
+      patchShebangs node_modules/
+      runHook postConfigure
+    '';
+
+    buildPhase = ''
+      runHook preBuild
+
+      ./node_modules/.bin/react-scripts build
+
+      runHook postBuild
+    '';
+
+    installPhase = ''
+      runHook preInstall
+
+      mv build $out
+
+      runHook postInstall
+    '';
+  };
+
+  preBuild = ''
+    cp -R ${passthru.ui}/ ui/build/
+  '';
+
+  subPackages = [ "cmd/alice-lg" ];
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://github.com/alice-lg/alice-lg";
+    description = "A looking-glass for BGP sessions";
+    changelog = "https://github.com/alice-lg/alice-lg/blob/main/CHANGELOG.md";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ janik ];
+  };
+}