daml/bin/update-nixpkgs
Gary Verhaegen fbbce80443
standardize nix-shell (#18381)
I'd like to remove `dev-env`. It's served us well, but its original
ambitions were to go way beyond a simple `nix-shell` equivalent, and now
that it's all we're using it for it doesn't really add much anymore.

Using a standard nix-shell setup would reduce the complexity of this
repo and make it easier for other developers to jump in. It would also
somewhat reduce the dev-env verbosity, which is a minor annoyance.

This is, however, a big change, and I don't think trying to do it in one
go is a great idea. So instead I'm setting a foundation in this PR and
plan to move step by step over several follow-up PRs. In this one I just
add a small default nix-shell configuration and add it to `.envrc`. In
follow-up PRs, I'll be moving paclages over from the dev-env
configuration to the nix shell, up to the point where dev-env is just an
empty shell that we can easily remove.

This PR also serves as a not-so-implicit way of gathering support for
this plan.
2024-02-09 11:11:01 +01:00

30 lines
864 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
branch=$(jq -r '.branch' $DIR/../nix/src.json)
repo=$(jq -r '.repo' $DIR/../nix/src.json)
owner=$(jq -r '.owner' $DIR/../nix/src.json)
commit=$(curl --silent \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$owner/$repo/branches/$branch \
| jq -r .commit.sha)
archive_sha=$(nix-prefetch-url \
https://github.com/$owner/$repo/archive/$commit.tar.gz \
--unpack \
2>/dev/null)
jq -n \
--arg branch $branch \
--arg repo $repo \
--arg owner $owner \
--arg rev $commit \
--arg sha256 $archive_sha \
'{$owner, $repo, $branch, $rev, $sha256}' \
> $DIR/../nix/src.json