nidus-sync/default.nix

66 lines
1.8 KiB
Nix
Raw Permalink Normal View History

2026-03-04 03:41:41 +00:00
{ pkgs ? import <nixpkgs> { }, proj ? pkgs.proj }:
2026-03-21 17:44:14 +00:00
pkgs.buildGoModule rec {
# Try to get git info, fallback to version if .git doesn't exist
# Note: This runs at eval time, so it captures the version when you build
gitRevision =
if builtins.pathExists ./.git
then pkgs.lib.commitIdFromGitRepo ./.git
else "unknown";
gitDescribe = builtins.readFile (pkgs.runCommand "git-describe" {} ''
${pkgs.git}/bin/git -C ${./.} describe --always --dirty --tags 2>/dev/null > $out || echo "${version}" > $out
'');
ldflags = [
"-s"
"-w"
"-X main.Version=${version}"
"-X main.Commit=${gitRevision}"
];
2026-04-16 10:46:55 +00:00
meta = {
description = "Nidus Sync";
homepage = "https://github.com/Gleipnir-Technology/nidus-sync";
};
pname = "nidus-sync";
src = ./.;
subPackages = [];
version = "0.0.12";
vendorHash = "sha256-d2cTpzEtUmxAKPKmM0zeKhW4nbLnI08X8lm2yayl+NA=";
2026-04-16 10:46:55 +00:00
buildInputs = [ pkgs.proj ];
nativeBuildInputs = [
pkgs.pkg-config
pkgs.nodejs
pkgs.pnpm.configHook
];
# Fix: Filter out pnpm.configHook instead of replacing the whole list
overrideModAttrs = old: {
nativeBuildInputs = builtins.filter
(pkg: pkg != pkgs.pnpm.configHook && pkg != pkgs.nodejs)
old.nativeBuildInputs;
preBuild = "";
};
pnpmDeps = pkgs.pnpm.fetchDeps {
inherit pname src version;
fetcherVersion = 2;
hash = "sha256-4XPkwVKSuDlErKfD59iBPHLuf44iRkjEcS6tIityCjo=";
2026-04-16 10:46:55 +00:00
};
preBuild = ''
pnpm install --offline --frozen-lockfile --ignore-scripts
mkdir -p "./ts/gen"
pnpm generate-icons
pnpm build-rmo
pnpm build-sync
'';
postInstall = ''
# Copy frontend build output to artifacts so we can upload them to sentry
mkdir -p $out/share/frontend/
cp -r vite/rmo/static/gen/rmo $out/share/frontend/
cp -r vite/rmo/static/gen/sync $out/share/frontend/
'';
}