-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
83 lines (72 loc) · 2.14 KB
/
flake.nix
File metadata and controls
83 lines (72 loc) · 2.14 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
description = "datumctl - A CLI for interacting with Datum Cloud";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system:
let
pkgs = import nixpkgs {
inherit system;
};
# Get version from git, fallback to "dev" if not in a git repo
version =
if (builtins.pathExists ./.git)
then builtins.replaceStrings ["\n"] [""] (builtins.readFile (
pkgs.runCommand "get-version" {} ''
cd ${./.}
${pkgs.git}/bin/git describe --tags --always --dirty 2>/dev/null > $out || echo "dev" > $out
''
))
else "dev";
in
{
packages = {
default = pkgs.buildGoModule {
pname = "datumctl";
inherit version;
src = ./.;
# Hash of Go module dependencies.
# Update this after changing go.mod/go.sum:
# task nix-update-hash
vendorHash = "sha256-lB8FG3TaxGQeEKTS+iP3xr/DXLH5+Fk0pEhA5ctXO0I=";
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
meta = with pkgs.lib; {
description = "A CLI for interacting with the Datum platform";
homepage = "https://www.datum.net/docs/quickstart/datumctl/";
license = licenses.asl20;
maintainers = [ ];
mainProgram = "datumctl";
};
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go_1_25
gopls
gotools
go-task
go-tools
goreleaser
syft
git
];
shellHook = ''
echo "datumctl development environment"
echo "Go version: $(go version)"
'';
};
formatter = pkgs.nixpkgs-fmt;
}
);
}