-
Notifications
You must be signed in to change notification settings - Fork 200
/
flake.nix
69 lines (54 loc) · 2.09 KB
/
flake.nix
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
{
description = "Instant, easy, predictable dev environments";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lastTag = "0.13.6";
revision = if (self ? shortRev)
then "${self.shortRev}"
else "${self.dirtyShortRev or "dirty"}";
# Add the commit to the version string for flake builds
version = "${lastTag}-${revision}";
# Run `devbox run update-flake` to update the vendor-hash
vendorHash = if builtins.pathExists ./vendor-hash
then builtins.readFile ./vendor-hash
else "";
buildGoModule = pkgs.buildGo123Module;
in
{
inherit self;
packages.default = buildGoModule {
pname = "devbox";
inherit version vendorHash;
src = ./.;
subpackage = [ ./cmd/devbox ];
ldflags = [
"-s"
"-w"
"-X go.jetpack.io/devbox/internal/build.Version=${version}"
"-X go.jetpack.io/devbox/internal/build.Commit=${revision}"
];
# Disable tests if they require network access or are integration tests
doCheck = false;
nativeBuildInputs = [ pkgs.installShellFiles ];
postInstall = pkgs.lib.optionalString (pkgs.stdenv.buildPlatform.canExecute pkgs.stdenv.hostPlatform) ''
installShellCompletion --cmd devbox \
--bash <($out/bin/devbox completion bash) \
--fish <($out/bin/devbox completion fish) \
--zsh <($out/bin/devbox completion zsh)
'';
meta = with pkgs.lib; {
description = "Instant, easy, and predictable development environments";
homepage = "https://www.jetify.com/devbox";
license = licenses.asl20;
maintainers = with maintainers; [ lagoja ];
};
};
}
);
}