chore: add build targets to nix flake (#13186)

* chore: add build targets to nix flake

Enables `nix build github:coder/coder#main`!

* Fix all packages

* Add back pnpm

* Update flake.nix

Co-authored-by: Asher <ash@coder.com>

* Remove yarn

* fmt

---------

Co-authored-by: Asher <ash@coder.com>
This commit is contained in:
Kyle Carberry
2024-05-06 18:21:20 -04:00
committed by GitHub
co-authored by Asher
parent 05facc971b
commit 3e3118794f
6 changed files with 185 additions and 24 deletions
+3
View File
@@ -43,6 +43,9 @@ SCRIPT="${BASH_SOURCE[1]:-${BASH_SOURCE[0]}}"
SCRIPT_DIR="$(realpath "$(dirname "$SCRIPT")")"
function project_root {
# Nix sets $src in derivations!
[[ -n "${src:-}" ]] && echo "$src" && return
# Try to use `git rev-parse --show-toplevel` to find the project root.
# If this directory is not a git repository, this command will fail.
git rev-parse --show-toplevel 2>/dev/null && return
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Updates SRI hashes for flake.nix.
set -eu
cd "$(dirname "${BASH_SOURCE[0]}")/.."
OUT=$(mktemp -d -t nar-hash-XXXXXX)
echo "Downloading Go modules..."
GOPATH="$OUT" go mod download
echo "Calculating SRI hash..."
HASH=$(go run tailscale.com/cmd/nardump --sri "$OUT/pkg/mod/cache/download")
sudo rm -rf "$OUT"
sed -i "s/\(vendorHash = \"\)[^\"]*/\1${HASH}/" ./flake.nix