nidus-sync/default.nix
Eli Ribble d4cbfb960e
Some checks failed
/ golint (push) Failing after 12s
Move to setting version info explicitly in linker flags
We don't have go built-in VCS information in a nix build because the git
repository isn't present. After struggling to build an overlay that
would provide it, I decided this path is easier of just injecting in the
data that we need.

Issue: #5
2026-05-19 19:46:05 +00:00

66 lines
1.6 KiB
Nix

{ ldflags, version, pkgs ? import <nixpkgs> { }, proj ? pkgs.proj }:
let
# Get commit timestamp at eval time (pure)
getCommitTime =
if builtins.pathExists ./.git
then builtins.replaceStrings ["\n"] [""] (builtins.readFile (
pkgs.runCommand "git-commit-time" {} ''
${pkgs.git}/bin/git -C ${./.} log -1 --format=%ct > $out
''
))
else "0";
in
pkgs.buildGoModule rec {
inherit ldflags version;
pname = "nidus-sync";
src = ./.;
buildTime = getCommitTime;
meta = {
description = "Nidus Sync";
homepage = "https://github.com/Gleipnir-Technology/nidus-sync";
};
subPackages = [];
vendorHash = "sha256-jlPS8lWdNPj60BMUcCrxteLuc7RXEXDtzlwjsFBJg0Y=";
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=";
};
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/
'';
}