-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
54 lines (47 loc) · 1.49 KB
/
flake.nix
File metadata and controls
54 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
description = "Graft - Your local environment, everywhere.";
# Pinned for go_1_26 support (nixpkgs#497104)
inputs.nixpkgs.url = "github:NixOS/nixpkgs/09612cb5a0972cf82bfadb2a63872376bbf00d2d";
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (pkgs: let
go = pkgs.go_1_26;
version = self.shortRev or self.dirtyShortRev or "nix";
in rec {
graft = pkgs.buildGoModule.override {inherit go;} {
pname = "graft";
inherit version;
src = ./.;
vendorHash = "sha256-1yH+Ln8H4+1pku0J2guZ/PlBnPqICmQjYoUbJMLxDbo=";
goSum = ./go.sum;
env.CGO_ENABLED = "0";
nativeBuildInputs = [pkgs.just pkgs.zstd];
# Cross-compile and embed daemon binaries using the justfile
preBuild = ''
if [[ "$name" != *"go-modules"* ]]; then
export BUILD_VERSION="${version}"
just prepare-embedded
fi
'';
tags = ["embed_binaries"];
ldflags = [
"-w"
"-s"
"-X github.com/edaniels/graft/pkg.buildVersion=${version}"
];
subPackages = ["cmd/graft"];
doCheck = false;
meta.mainProgram = "graft";
};
default = graft;
});
overlays.default = final: prev: {
graft = self.packages.${final.system}.graft;
};
};
}