Skip to content

Commit 9008c33

Browse files
committed
Reworked Nix flake CI
The old CI did not run the Nix tests (it was silently failing). This resolves that and also removes the publishing of Nix to Cachix as the dependencies should be cached by the dependants themselves, and not the starter projects.
1 parent 339a181 commit 9008c33

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

.ci/publish_nix.sh

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

.ci/test_projects_nix.sh

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ 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 "$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+
nix develop . --accept-flake-config -c cabal update
24+
# The `nix run` is supposed to run inside of `nix develop`
25+
nix develop . --accept-flake-config -c nix run . --accept-flake-config
26+
nix develop . --accept-flake-config -c cabal run doctests
27+
nix develop . --accept-flake-config -c cabal run test-library
2528

2629
# Clean up
27-
cd ..
28-
rm -rf inst
30+
rm -rf ./ci-project
2931
done

projects-nix/simple-nix/flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
};
77
nixConfig = {
88
extra-substituters = [ "https://clash-lang.cachix.org" ];
9-
trusted-substituters = [ "https://clash-lang.cachix.org" ];
10-
trusted-public-keys = [ "clash-lang.cachix.org-1:/2N1uka38B/heaOAC+Ztd/EWLmF0RLfizWgC5tamCBg=" ];
9+
extra-trusted-substituters = [ "https://clash-lang.cachix.org" ];
10+
extra-trusted-public-keys = [ "clash-lang.cachix.org-1:/2N1uka38B/heaOAC+Ztd/EWLmF0RLfizWgC5tamCBg=" ];
1111
};
1212
outputs = { self, nixpkgs, flake-utils, clash-compiler }:
1313
flake-utils.lib.eachDefaultSystem (system:

0 commit comments

Comments
 (0)