-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathflake.nix
More file actions
130 lines (112 loc) · 3.98 KB
/
Copy pathflake.nix
File metadata and controls
130 lines (112 loc) · 3.98 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfreePredicate = pkg: pkg.pname == "ngrok";
};
};
readmeGeneratorForHelm = pkgs.buildNpmPackage {
pname = "readme-generator-for-helm";
version = "2.6.1";
src = pkgs.fetchFromGitHub {
owner = "bitnami";
repo = "readme-generator-for-helm";
rev = "2.6.1";
hash = "sha256-hgVSiYOM33MMxVlt36aEc0uBWIG/OS0l7X7ZYNESO6A=";
};
npmDepsHash = "sha256-baRBchp4dBruLg0DoGq7GsgqXkI/mBBDowtAljC2Ckk=";
dontNpmBuild = true;
};
mkScript =
name: text:
let
script = pkgs.writeShellScriptBin name text;
in
script;
scripts = [
(mkScript "devhelp" ''
cat <<'EOF'
Welcome to the ngrok-operator development environment!
Please make sure you have the following environment variables set:
NGROK_API_KEY - Your ngrok API key
NGROK_AUTHTOKEN - Your ngrok authtoken
If you are using GitHub Codespaces, a kind cluster should
already be running. You can verify this by running:
kind get clusters
Common commands:
make build - Build the operator
make test - Run tests
make lint - Run linters
make deploy - Deploy to the kind cluster
For more information, see the development documentation in
./docs/developer-guide/README.md
You can also run "devhelp" at any time to see this message again.
EOF
'')
];
in
{
packages.readme-generator-for-helm = readmeGeneratorForHelm;
devShells.default = pkgs.mkShell {
buildInputs =
with pkgs;
[
bashInteractive
go_1_26
go-tools
golangci-lint
gotools
jq
kind
kubebuilder
kubectl
kubernetes-controller-tools
(pkgs.wrapHelm pkgs.kubernetes-helm {
plugins = [
# helm-unittest 1.1.0 changed plugin.yaml from a single `command` field
# to `platformCommand` entries with platform-suffixed binary names, but
# nixpkgs builds one binary from source and installs it as plain `untt`.
# Patch plugin.yaml to match, mirroring the fix planned for upstream nixpkgs.
(pkgs.kubernetes-helmPlugins.helm-unittest.overrideAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.yq-go ];
postPatch = ''
yq -i 'del(.platformCommand) | del(.platformHooks) | .command = "''${HELM_PLUGIN_DIR}/untt"' plugin.yaml
'';
}))
];
})
kyverno-chainsaw
ngrok
nixfmt
setup-envtest
tilt
yq
readmeGeneratorForHelm
]
++ scripts;
CGO_ENABLED = "0";
# GitHub Codespaces sets GOROOT in /etc/environment. However, we are managing
# go via nix, so we need to unset it to avoid conflicts. See also: https://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really
GOROOT = "";
ENVTEST_K8S_VERSION = "1.34.1";
shellHook = ''
export KUBEBUILDER_ASSETS="$(setup-envtest use $ENVTEST_K8S_VERSION -p path)"
devhelp
'';
};
}
));
}