Skip to content

Convert Devenv to Nix flake #197

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 12 commits into from
Jun 5, 2024
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
5 changes: 4 additions & 1 deletion .dvc/config
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[core]
analytics = false
remote = default-s3-remote
site_cache_dir = ./.dvc/cache
[cache]
dir = cache
['remote "default-s3-remote"']
url = s3://lpm-research/default
url = s3://lpm-research/default
6 changes: 6 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use flake

shopt -s globstar

watch_file **/*.nix
watch_file flake.lock
8 changes: 2 additions & 6 deletions .github/workflows/clojure-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ jobs:
with:
name: devenv

- name: Install devenv
run: nix profile install tarball+https://install.devenv.sh/latest
shell: sh

- name: Build developer environment
run: devenv shell -- echo "devenv built"
run: ./bin/env-run echo "Devshell built"

- name: Lint files
run: devenv shell -- clj-kondo --lint deps.edn src bin test --config '{:output {:pattern "::{{level}} file={{filename}},line={{row}},col={{col}}::{{message}}"}}'
run: ./bin/env-run clj-kondo --lint deps.edn src bin test --config '{:output {:pattern "::{{level}} file={{filename}},line={{row}},col={{col}}::{{message}}"}}'
10 changes: 3 additions & 7 deletions .github/workflows/clojure-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ jobs:
with:
name: devenv

- name: Install devenv
run: nix profile install tarball+https://install.devenv.sh/latest
shell: sh

- name: Build developer environment
run: devenv shell -- echo "devenv built"
run: ./bin/env-run echo "Devshell built"

- name: Run Clojure tests
run: devenv shell -- clojure -X:test:clj-test
run: ./bin/env-run clojure -X:test:clj-test

- name: Run ClojureScript tests
run: devenv shell -- clojure -M:test:cljs-test
run: ./bin/env-run clojure -M:test:cljs-test
27 changes: 14 additions & 13 deletions .github/workflows/commit-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,31 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 20
case: 'pnpm'
- name: Install Nix
uses: cachix/install-nix-action@v22

- uses: DeterminateSystems/magic-nix-cache-action@main

- uses: pnpm/action-setup@v3
- name: Set up Cachix
uses: cachix/cachix-action@v12
with:
version: 8
name: devenv

- name: Install commitlint
run: |
pnpm install --frozen-lockfile
./bin/env-run pnpm install --frozen-lockfile

- name: Print versions
run: |
git --version
node --version
pnpm --version
pnpm exec commitlint --version
./bin/env-run git --version &&
./bin/env-run node --version &&
./bin/env-run pnpm --version &&
./bin/env-run pnpm exec commitlint --version

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: pnpm exec commitlint --last --verbose
run: ./bin/env-run pnpm exec commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: pnpm exec commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
run: ./bin/env-run pnpm exec commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
27 changes: 7 additions & 20 deletions .github/workflows/python-build-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,24 @@ on:
push:
paths:
- '.github/workflows/python-build-tests.yaml'
- 'devenv.lock'
- 'devenv.nix'
- 'devenv.yaml'
- 'flake.nix'
- 'devshell.nix'
- 'pyproject.toml'
- 'requirements.txt'

pull_request:
paths:
- '.github/workflows/python-build-tests.yaml'
- 'devenv.lock'
- 'devenv.nix'
- 'devenv.yaml'
- 'flake.nix'
- 'devshell.nix'
- 'pyproject.toml'
- 'requirements.txt'

jobs:
run-tests:
strategy:
matrix:
# n.b. github actions macos runners are currently
# not supporting python 3.10.12. If we upgrade python
# we can resume these tests on mac, if we want to.
os: [ubuntu-latest]
os: [ ubuntu-latest, macos-latest ]

runs-on: ${{ matrix.os }}

Expand All @@ -44,16 +39,8 @@ jobs:
with:
name: devenv

- uses: actions/setup-python@v5
with:
python-version: "3.10.12"

- name: Install devenv
run: nix profile install tarball+https://install.devenv.sh/latest
shell: sh

- name: Build developer environment
run: devenv shell -- echo "devenv built"
run: ./bin/env-run echo "Devshell built"

- name: Run SPPL tests
run: devenv shell -- python -m pytest --pyargs sppl
run: ./bin/env-run python -m pytest --pyargs sppl
12 changes: 2 additions & 10 deletions .github/workflows/python-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,8 @@ jobs:
with:
name: devenv

- uses: actions/setup-python@v5
with:
python-version: "3.10.12"

- name: Install devenv
run: nix profile install tarball+https://install.devenv.sh/latest
shell: sh

- name: Build developer environment
run: devenv shell -- echo "devenv built"
run: ./bin/env-run echo "Devshell built"

- name: Run Python tests
run: devenv shell -- python -m pytest test/scripts
run: ./bin/env-run python -m pytest test/scripts
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ sum-product-dsl/
.lsp/.cache/
.lsp/sqlite.*.db

.direnv/
5 changes: 5 additions & 0 deletions bin/env-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -euo pipefail

nix develop -c bash -c "$(printf " %q" "${@}")"
Loading