-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (90 loc) · 2.84 KB
/
flake.nix
File metadata and controls
96 lines (90 loc) · 2.84 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
84
85
86
87
88
89
90
91
92
93
94
95
96
{
description = "CloudExec VPS provisioning helper";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
utils.url = "github:numtide/flake-utils";
crytic.url = "github:crytic/crytic.nix";
};
outputs = inputs: with inputs;
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
pyCommon = {
format = "pyproject";
nativeBuildInputs = with pkgs.python310Packages; [ pythonRelaxDepsHook ];
pythonRelaxDeps = true;
doCheck = false;
};
in
rec {
# Provide some binary packages for selected system types.
packages = rec {
default = cloudexec;
cloudexec = let
version = let
result = builtins.match "([^\n]*).*" (builtins.readFile ./VERSION);
in if result != null then builtins.head result else "unknown";
gitCommit = let
result = builtins.match ".*commit=([^\n]*).*" (builtins.readFile ./VERSION);
in if result != null then builtins.head result else "unknown";
gitDate = let
result = builtins.match ".*date=([^\n]*).*" (builtins.readFile ./VERSION);
in if result != null then builtins.head result else "unknown";
in pkgs.buildGoModule {
pname = "cloudexec";
version = "${version}";
src = ./.;
vendorHash = "sha256-xiiMcjo+hRllttjYXB3F2Ms2gX43r7/qgwxr4THNhsk=";
nativeBuildInputs = [
pkgs.go
];
ldflags = [
"-X main.Version=${version}"
"-X main.Commit=${gitCommit}"
"-X main.Date=${gitDate}"
];
};
};
apps = {
default = {
type = "app";
program = "${self.packages.${system}.cloudexec}/bin/cloudexec";
};
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
# misc tools
shellcheck
just
trunk-io
# go development
go
gotools
go-tools
gopls
go-outline
gopkgs
gocode-gomod
godef
golint
# deployment tools
packer
doctl
curl
# manual testing
crytic.packages.${system}.crytic-compile
crytic.packages.${system}.medusa
crytic.packages.${system}.echidna
(crytic.lib.${system}.mkVscode {
extensions = with pkgs.vscode-extensions; [
vscodevim.vim
golang.go
];
})
];
};
};
}
);
}