Skip to content

Commit 6b3e14f

Browse files
johnstcnThomasK33
andauthored
fix(dogfood/contents): fix resource metadata under nix (#16349)
Co-authored-by: Thomas Kosiewski <tk@coder.com>
1 parent a15f06a commit 6b3e14f

File tree

4 files changed

+208
-96
lines changed

4 files changed

+208
-96
lines changed

.github/workflows/dogfood.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ jobs:
3737
- name: Setup Nix
3838
uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16
3939

40-
- name: Setup GHA Nix cache
41-
uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9
42-
4340
- name: Get branch name
4441
id: branch-name
4542
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8.0.1

dogfood/contents/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ resource "coder_agent" "dev" {
249249
key = "swap_usage_host"
250250
order = 4
251251
script = <<EOT
252-
#!/bin/bash
252+
#!/usr/bin/env bash
253253
echo "$(free -b | awk '/^Swap/ { printf("%.1f/%.1f", $3/1024.0/1024.0/1024.0, $2/1024.0/1024.0/1024.0) }') GiB"
254254
EOT
255255
interval = 10
@@ -262,7 +262,7 @@ resource "coder_agent" "dev" {
262262
order = 5
263263
# get load avg scaled by number of cores
264264
script = <<EOT
265-
#!/bin/bash
265+
#!/usr/bin/env bash
266266
echo "`cat /proc/loadavg | awk '{ print $1 }'` `nproc`" | awk '{ printf "%0.2f", $1/$2 }'
267267
EOT
268268
interval = 60
@@ -283,14 +283,15 @@ resource "coder_agent" "dev" {
283283
key = "word"
284284
order = 7
285285
script = <<EOT
286-
#!/bin/bash
286+
#!/usr/bin/env bash
287287
curl -o - --silent https://www.merriam-webster.com/word-of-the-day 2>&1 | awk ' $0 ~ "Word of the Day: [A-z]+" { print $5; exit }'
288288
EOT
289289
interval = 86400
290290
timeout = 5
291291
}
292292

293293
startup_script = <<-EOT
294+
#!/usr/bin/env bash
294295
set -eux -o pipefail
295296
296297
# Allow synchronization between scripts.

flake.nix

Lines changed: 96 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -71,70 +71,91 @@
7171
vendorHash = null;
7272
};
7373

74+
# Packages required to build the frontend
75+
frontendPackages =
76+
with pkgs;
77+
[
78+
cairo
79+
pango
80+
pixman
81+
libpng
82+
libjpeg
83+
giflib
84+
librsvg
85+
python312Packages.setuptools # Needed for node-gyp
86+
]
87+
++ (lib.optionals stdenv.targetPlatform.isDarwin [
88+
darwin.apple_sdk.frameworks.Foundation
89+
xcbuild
90+
]);
91+
7492
# The minimal set of packages to build Coder.
75-
devShellPackages = with pkgs; [
76-
# google-chrome is not available on aarch64 linux
77-
(lib.optionalDrvAttr (!stdenv.isLinux || !stdenv.isAarch64) google-chrome)
78-
# strace is not available on OSX
79-
(lib.optionalDrvAttr (!pkgs.stdenv.isDarwin) strace)
80-
bat
81-
cairo
82-
curl
83-
delve
84-
dive
85-
drpc.defaultPackage.${system}
86-
formatter
87-
fzf
88-
gcc13
89-
gdk
90-
getopt
91-
gh
92-
git
93-
(lib.optionalDrvAttr stdenv.isLinux glibcLocales)
94-
gnumake
95-
gnused
96-
go_1_22
97-
go-migrate
98-
(pinnedPkgs.golangci-lint)
99-
gopls
100-
gotestsum
101-
jq
102-
kubectl
103-
kubectx
104-
kubernetes-helm
105-
lazygit
106-
less
107-
mockgen
108-
moreutils
109-
neovim
110-
nfpm
111-
nix-prefetch-git
112-
nodejs
113-
openssh
114-
openssl
115-
pango
116-
pixman
117-
pkg-config
118-
playwright-driver.browsers
119-
pnpm
120-
postgresql_16
121-
proto_gen_go_1_30
122-
protobuf_23
123-
ripgrep
124-
shellcheck
125-
(pinnedPkgs.shfmt)
126-
sqlc
127-
terraform
128-
typos
129-
# Needed for many LD system libs!
130-
(lib.optional stdenv.isLinux util-linux)
131-
vim
132-
wget
133-
yq-go
134-
zip
135-
zsh
136-
zstd
137-
];
93+
devShellPackages =
94+
with pkgs;
95+
[
96+
# google-chrome is not available on aarch64 linux
97+
(lib.optionalDrvAttr (!stdenv.isLinux || !stdenv.isAarch64) google-chrome)
98+
# strace is not available on OSX
99+
(lib.optionalDrvAttr (!pkgs.stdenv.isDarwin) strace)
100+
bat
101+
cairo
102+
curl
103+
delve
104+
dive
105+
drpc.defaultPackage.${system}
106+
formatter
107+
fzf
108+
gcc13
109+
gdk
110+
getopt
111+
gh
112+
git
113+
(lib.optionalDrvAttr stdenv.isLinux glibcLocales)
114+
gnumake
115+
gnused
116+
go_1_22
117+
go-migrate
118+
(pinnedPkgs.golangci-lint)
119+
gopls
120+
gotestsum
121+
jq
122+
kubectl
123+
kubectx
124+
kubernetes-helm
125+
lazygit
126+
less
127+
mockgen
128+
moreutils
129+
neovim
130+
nfpm
131+
nix-prefetch-git
132+
nodejs
133+
openssh
134+
openssl
135+
pango
136+
pixman
137+
pkg-config
138+
playwright-driver.browsers
139+
pnpm
140+
postgresql_16
141+
proto_gen_go_1_30
142+
protobuf_23
143+
ripgrep
144+
shellcheck
145+
(pinnedPkgs.shfmt)
146+
sqlc
147+
terraform
148+
typos
149+
# Needed for many LD system libs!
150+
(lib.optional stdenv.isLinux util-linux)
151+
vim
152+
wget
153+
yq-go
154+
zip
155+
zsh
156+
zstd
157+
]
158+
++ frontendPackages;
138159

139160
docker = pkgs.callPackage ./nix/docker.nix { };
140161

@@ -144,22 +165,7 @@
144165

145166
src = ./site/.;
146167
# Required for the `canvas` package!
147-
extraBuildInputs =
148-
with pkgs;
149-
[
150-
cairo
151-
pango
152-
pixman
153-
libpng
154-
libjpeg
155-
giflib
156-
librsvg
157-
python312Packages.setuptools
158-
]
159-
++ (lib.optionals stdenv.targetPlatform.isDarwin [
160-
darwin.apple_sdk.frameworks.Foundation
161-
xcbuild
162-
]);
168+
extraBuildInputs = frontendPackages;
163169
installInPlace = true;
164170
distDir = "out";
165171
};
@@ -219,6 +225,9 @@
219225
LOCALE_ARCHIVE =
220226
with pkgs;
221227
lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
228+
229+
NODE_OPTIONS = "--max-old-space-size=8192";
230+
GOPRIVATE = "coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder";
222231
};
223232
};
224233

@@ -252,13 +261,20 @@
252261
drv = devShells.default.overrideAttrs (oldAttrs: {
253262
buildInputs =
254263
(with pkgs; [
255-
busybox
256264
coreutils
257265
nix
258266
curl.bin # Ensure the actual curl binary is included in the PATH
259267
glibc.bin # Ensure the glibc binaries are included in the PATH
268+
jq.bin
260269
binutils # ld and strings
261270
filebrowser # Ensure that we're not redownloading filebrowser on each launch
271+
systemd.out
272+
service-wrapper
273+
docker_26
274+
shadow.out
275+
su
276+
ncurses # clear
277+
unzip
262278
])
263279
++ oldAttrs.buildInputs;
264280
});

0 commit comments

Comments
 (0)