Skip to content

Commit 528cee8

Browse files
committed
Add Nix flake
Add a Nix flake that creates a package using `libgit2` and `pkg-config`. Pinning nixpkgs to 22.11 ensures the correct version of `libgit2` is used as per the README with no changed needed to the source code. With this in place, the package can be build using `nix build` which creates an executable at `result/bin/lite`. A dev shell can also be started with `nix develop` based on the package inputs.
1 parent 36e0e74 commit 528cee8

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
inputs = {
3+
flake-parts.url = "github:hercules-ci/flake-parts";
4+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
5+
};
6+
7+
outputs = inputs:
8+
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
9+
systems =
10+
[ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
11+
12+
perSystem = psArgs@{ pkgs, ... }: {
13+
devShells.default =
14+
pkgs.mkShell { inputsFrom = [ psArgs.self'.packages.default ]; };
15+
16+
packages.default = pkgs.buildGoModule {
17+
pname = "splitsh-lite";
18+
version = "2.0.0";
19+
src = ./.;
20+
vendorHash = "sha256-Hk08mULIpuPR7Wyyfpd4P0Vrcp9Cu0slUzZXhzK9t0M";
21+
22+
buildInputs = with pkgs; [ libgit2 ];
23+
nativeBuildInputs = with pkgs; [ pkg-config ];
24+
25+
meta.mainProgram = "lite";
26+
};
27+
28+
formatter = pkgs.nixfmt;
29+
};
30+
};
31+
}

0 commit comments

Comments
 (0)