Skip to content

Commit 3f18a5e

Browse files
committed
Reworked Nix flake CI
1 parent df3b8d7 commit 3f18a5e

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

.ci/publish_nix.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.ci/test_projects_nix.sh

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ IFS=$'\n\t'
55

66
cd "$(git rev-parse --show-toplevel)"
77

8-
for project in *.hsfiles; do
9-
nix-shell --pure --packages stack --run "stack new inst \"${project}\""
108

11-
cd inst
9+
for project in projects-nix/*; do
10+
# Copy the directory and resolve symlinks
11+
# The reason we copy the directory rather than invoking `nix init ...` is because nix init does
12+
# not resolve symlinks. However these symlinks *are* resolved as soon as it gets copied over to
13+
# `clash-starters`. So to 'mimick' the behaviour of `nix init` we just copy over the directory.
14+
cp -rL projects-nix/$project ./ci-project
15+
# If files aren't referenced by git, Nix gets very confused
16+
# This is not needed outside of a git repository, but since the files get copied over in a
17+
# git repository, we need to do this
18+
git add -A
19+
cd ./ci-project
1220

13-
if [[ -f "shell.nix" ]]; then
14-
# Build and test with nix. Note that nix-build already runs the tests,
15-
# but we'd also like to be able to run them using just cabal in a shell.
16-
nix-build
17-
if [[ ${project} != "deca.hsfiles" ]]; then
18-
nix-shell --pure --run "cabal run clash -- Example.Project --vhdl"
19-
else
20-
nix-shell --pure --run "cabal run clash -- DECA --vhdl"
21-
fi
22-
nix-shell --pure --run "cabal run doctests"
23-
nix-shell --pure --run "cabal run test-library"
24-
fi
21+
# Test
22+
nix build . --accept-flake-config
23+
# The `nix run` is supposed to run inside of `nix develop`
24+
nix develop . --accept-flake-config -c nix run . --accept-flake-config
2525

2626
# Clean up
27-
cd ..
28-
rm -rf inst
27+
rm -rf ./ci-project
2928
done

0 commit comments

Comments
 (0)