-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
70 lines (63 loc) · 1.68 KB
/
flake.nix
File metadata and controls
70 lines (63 loc) · 1.68 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
{
description = "DevX development tool";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
nur,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
devx = pkgs.buildGo124Module {
pname = "devx";
version = "0.1.0";
src = ./.;
vendorHash = null;
CGO_ENABLED = 1;
subPackages = ["cmd/devx"];
# `nix-build` has .git folder but `nix build` does not, this caters for both cases
preConfigure = ''
export VERSION="$(git describe --tags --always || echo nix-build-at-"$(date +%s)")"
export REVISION="$(git rev-parse HEAD || echo nix-unknown)"
ldflags="-X github.com/zenginechris/devx/config.appVersion=$VERSION
-X github.com/zenginechris/devx/config.revision=$REVISION"
'';
};
in {
packages = {
devx = devx;
default = devx;
};
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
go_1_24
git
gotools
golangci-lint
go-task
gopls
go-outline
gopkgs
];
shellHook = ''
${pkgs.go_1_24}/bin/go version
'';
};
overlays.default = final: prev: {
devx = self.packages.${prev.system}.default;
};
});
}