mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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
|
||||
|
||||
Executable
+16
@@ -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
|
||||
Reference in New Issue
Block a user