Skip to content

fix(dogfood/contents): fix resource metadata under nix #16349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/dogfood.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
- name: Setup Nix
uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16

- name: Setup GHA Nix cache
uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9

- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8.0.1
Expand Down
7 changes: 4 additions & 3 deletions dogfood/contents/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ resource "coder_agent" "dev" {
key = "swap_usage_host"
order = 4
script = <<EOT
#!/bin/bash
#!/usr/bin/env bash
echo "$(free -b | awk '/^Swap/ { printf("%.1f/%.1f", $3/1024.0/1024.0/1024.0, $2/1024.0/1024.0/1024.0) }') GiB"
EOT
interval = 10
Expand All @@ -262,7 +262,7 @@ resource "coder_agent" "dev" {
order = 5
# get load avg scaled by number of cores
script = <<EOT
#!/bin/bash
#!/usr/bin/env bash
echo "`cat /proc/loadavg | awk '{ print $1 }'` `nproc`" | awk '{ printf "%0.2f", $1/$2 }'
EOT
interval = 60
Expand All @@ -283,14 +283,15 @@ resource "coder_agent" "dev" {
key = "word"
order = 7
script = <<EOT
#!/bin/bash
#!/usr/bin/env bash
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 }'
EOT
interval = 86400
timeout = 5
}

startup_script = <<-EOT
#!/usr/bin/env bash
set -eux -o pipefail

# Allow synchronization between scripts.
Expand Down
176 changes: 96 additions & 80 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,70 +71,91 @@
vendorHash = null;
};

# Packages required to build the frontend
frontendPackages =
with pkgs;
[
cairo
pango
pixman
libpng
libjpeg
giflib
librsvg
python312Packages.setuptools # Needed for node-gyp
]
++ (lib.optionals stdenv.targetPlatform.isDarwin [
darwin.apple_sdk.frameworks.Foundation
xcbuild
]);

# The minimal set of packages to build Coder.
devShellPackages = with pkgs; [
# google-chrome is not available on aarch64 linux
(lib.optionalDrvAttr (!stdenv.isLinux || !stdenv.isAarch64) google-chrome)
# strace is not available on OSX
(lib.optionalDrvAttr (!pkgs.stdenv.isDarwin) strace)
bat
cairo
curl
delve
dive
drpc.defaultPackage.${system}
formatter
fzf
gcc13
gdk
getopt
gh
git
(lib.optionalDrvAttr stdenv.isLinux glibcLocales)
gnumake
gnused
go_1_22
go-migrate
(pinnedPkgs.golangci-lint)
gopls
gotestsum
jq
kubectl
kubectx
kubernetes-helm
lazygit
less
mockgen
moreutils
neovim
nfpm
nix-prefetch-git
nodejs
openssh
openssl
pango
pixman
pkg-config
playwright-driver.browsers
pnpm
postgresql_16
proto_gen_go_1_30
protobuf_23
ripgrep
shellcheck
(pinnedPkgs.shfmt)
sqlc
terraform
typos
# Needed for many LD system libs!
(lib.optional stdenv.isLinux util-linux)
vim
wget
yq-go
zip
zsh
zstd
];
devShellPackages =
with pkgs;
[
# google-chrome is not available on aarch64 linux
(lib.optionalDrvAttr (!stdenv.isLinux || !stdenv.isAarch64) google-chrome)
# strace is not available on OSX
(lib.optionalDrvAttr (!pkgs.stdenv.isDarwin) strace)
bat
cairo
curl
delve
dive
drpc.defaultPackage.${system}
formatter
fzf
gcc13
gdk
getopt
gh
git
(lib.optionalDrvAttr stdenv.isLinux glibcLocales)
gnumake
gnused
go_1_22
go-migrate
(pinnedPkgs.golangci-lint)
gopls
gotestsum
jq
kubectl
kubectx
kubernetes-helm
lazygit
less
mockgen
moreutils
neovim
nfpm
nix-prefetch-git
nodejs
openssh
openssl
pango
pixman
pkg-config
playwright-driver.browsers
pnpm
postgresql_16
proto_gen_go_1_30
protobuf_23
ripgrep
shellcheck
(pinnedPkgs.shfmt)
sqlc
terraform
typos
# Needed for many LD system libs!
(lib.optional stdenv.isLinux util-linux)
vim
wget
yq-go
zip
zsh
zstd
]
++ frontendPackages;

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

Expand All @@ -144,22 +165,7 @@

src = ./site/.;
# Required for the `canvas` package!
extraBuildInputs =
with pkgs;
[
cairo
pango
pixman
libpng
libjpeg
giflib
librsvg
python312Packages.setuptools
]
++ (lib.optionals stdenv.targetPlatform.isDarwin [
darwin.apple_sdk.frameworks.Foundation
xcbuild
]);
extraBuildInputs = frontendPackages;
installInPlace = true;
distDir = "out";
};
Expand Down Expand Up @@ -219,6 +225,9 @@
LOCALE_ARCHIVE =
with pkgs;
lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";

NODE_OPTIONS = "--max-old-space-size=8192";
GOPRIVATE = "coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder";
};
};

Expand Down Expand Up @@ -252,13 +261,20 @@
drv = devShells.default.overrideAttrs (oldAttrs: {
buildInputs =
(with pkgs; [
busybox
coreutils
nix
curl.bin # Ensure the actual curl binary is included in the PATH
glibc.bin # Ensure the glibc binaries are included in the PATH
jq.bin
binutils # ld and strings
filebrowser # Ensure that we're not redownloading filebrowser on each launch
systemd.out
service-wrapper
docker_26
shadow.out
su
ncurses # clear
unzip
])
++ oldAttrs.buildInputs;
});
Expand Down
Loading
Loading