Some checks failed
/ golint (push) Failing after 12s
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
79 lines
2 KiB
Nix
79 lines
2 KiB
Nix
{
|
|
description = "Nidus sync";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
proj.url = "github:Gleipnir-Technology/proj";
|
|
stapelberg = {
|
|
url = "github:stapelberg/nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, proj, stapelberg }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ stapelberg.overlays.goVcsStamping ];
|
|
};
|
|
projPkg = proj.packages.${system}.default;
|
|
|
|
package = pkgs.callPackage ./default.nix {
|
|
ldflags = ldflags;
|
|
proj = projPkg;
|
|
version = packageVersion;
|
|
};
|
|
# Pull VCS metadata from the flake's own git source.
|
|
# These fields are available when the flake lives inside a git checkout.
|
|
gitRevision = self.sourceInfo.rev or "dirty";
|
|
gitShortRev = self.sourceInfo.shortRev or "dirty";
|
|
gitDateTime = self.sourceInfo.lastModifiedDate or "unknown";
|
|
|
|
# Derive a human-readable version from the git date + short rev.
|
|
# lastModifiedDate is YYYYMMDDHHMMSS; pull out just YYYY-MM-DD.
|
|
packageVersion =
|
|
let
|
|
y = builtins.substring 0 4 gitDateTime;
|
|
m = builtins.substring 4 2 gitDateTime;
|
|
d = builtins.substring 6 2 gitDateTime;
|
|
in "${y}-${m}-${d}.${gitShortRev}";
|
|
|
|
ldflags = [
|
|
"-s" "-w"
|
|
"-X main.BuildTime=${gitDateTime}"
|
|
"-X main.Revision=${gitRevision}"
|
|
"-X main.Version=${packageVersion}"
|
|
];
|
|
|
|
in
|
|
{
|
|
packages.default = package;
|
|
packages.nidus-sync = package;
|
|
|
|
# Development shell configuration
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.air
|
|
pkgs.autoprefixer
|
|
pkgs.dart-sass
|
|
pkgs.go
|
|
pkgs.go-jet
|
|
pkgs.golangci-lint
|
|
pkgs.goose
|
|
pkgs.gotools
|
|
pkgs.lefthook
|
|
pkgs.nodejs
|
|
pkgs.pkg-config
|
|
pkgs.pnpm
|
|
pkgs.prettier
|
|
pkgs.prettier-plugin-go-template
|
|
proj.packages.${system}.default
|
|
pkgs.typescript
|
|
pkgs.watchexec
|
|
];
|
|
};
|
|
}
|
|
);
|
|
}
|