Skip to content

Commit

Permalink
Port to Devenv
Browse files Browse the repository at this point in the history
This will allow us to use in-project MySQL database instance.

- Started with `nix flake init --template github:cachix/devenv` as per https://devenv.sh/guides/using-with-flakes/
- Using devenv-nixpkgs https://devenv.sh/blog/2024/03/20/devenv-10-rewrite-in-rust/#devenv-nixpkgs
- Remove flake-compat as we switched to `use flake`.
  • Loading branch information
jtojnar committed Jan 7, 2025
1 parent ec6a081 commit 3a8dca3
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 123 deletions.
12 changes: 10 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
use nix
watch_file flake.nix flake.lock
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

watch_file flake.nix
watch_file flake.lock
if ! use flake . --no-pure-eval
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
14 changes: 7 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ jobs:
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Install dependencies
run: nix-shell --run 'composer install --no-interaction'
run: nix shell -c composer install --no-interaction

- name: Check code using Nette code checker
run: nix-shell --run 'code-checker -d app'
run: nix shell -c code-checker -d app

- name: Lint coding style
run: nix-shell --run 'composer run-script cs'
run: nix shell -c composer run-script cs

- name: Run static analysis
run: nix-shell --run 'composer run-script phpstan'
run: nix shell -c composer run-script phpstan

- name: Lint source code
run: nix-shell --run 'composer run-script lint'
run: nix shell -c composer run-script lint

- name: Run tests
run: |
cp .github/workflows/private.neon app/Config/private.neon
nix-shell --run 'composer test'
nix shell -c composer test
- name: Build a zipball
run: nix-shell --run 'npm run dist "entries-${{ steps.vars.outputs.sha_short }}.zip"'
run: nix shell -c npm run dist "entries-${{ steps.vars.outputs.sha_short }}.zip"

- name: Upload the zipball to GitHub
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ phpstan.neon
/.parcel-cache/

/.direnv/
/.devenv/
14 changes: 0 additions & 14 deletions default.nix

This file was deleted.

243 changes: 215 additions & 28 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3a8dca3

Please sign in to comment.