Skip to content

Commit

Permalink
Simplification of Nix flake and removal of GHC 8 (#245)
Browse files Browse the repository at this point in the history
Co-authored-by: CristhianMotoche <[email protected]>
Co-authored-by: Sebastián Estrella <[email protected]>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 0cf8b70 commit e910902
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 142 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
- macos-13 # x86_64-darwin
- macos-latest # aarch64-darwin
- ubuntu-latest # x86_64-linux
ghc:
- ghc8107
- ghc902
fail-fast: true
runs-on: ${{ matrix.os }}
timeout-minutes: 30
Expand All @@ -28,9 +25,9 @@ jobs:
extra-conf: accept-flake-config = true
- uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Compile code ${{ matrix.ghc }}
run: nix build .#test-${{ matrix.ghc }}
run: nix build .#test
- name: Run tests ${{ matrix.ghc }}
run: nix run .#test-${{ matrix.ghc }}
run: nix run .#test

docker:
uses: ./.github/workflows/reusable-docker.yml
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*.o
.cabal-sandbox/
.direnv/
.envrc
.hpc
.hsenv
.tool-versions
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM utdemir/ghc-musl:v24-ghc902 AS build
FROM quay.io/benz0li/ghc-musl:9.6.6 AS build
WORKDIR /usr/src/app
COPY hapistrano.cabal .
RUN cabal update && \
Expand All @@ -8,7 +8,7 @@ RUN cabal build --enable-executable-static && \
cp $(cabal exec which hap) hap

FROM alpine:3.15
MAINTAINER Nicolas Vivar <nvivar@stackbuilders.com>
MAINTAINER Cristhian Motoche <cmotoche@stackbuilders.com>
RUN apk update && \
apk add \
ca-certificates \
Expand Down
33 changes: 10 additions & 23 deletions docs/NIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,27 @@ sudo launchctl start org.nixos.nix-daemon
```

If the following messages appear running the scripts detailed in the section
below, it means that the Nix is not able to talk with the cache, in which case
is recommended to go over the steps detailed in this section again:
below, it means that Nix is not picking up the substituters we described
earlier and is unable to use them as a derivation cache:

```
warning: ignoring untrusted substituter 'https://cache.iog.io'
```
in which case
it is recommended to go over the steps detailed in this section again, or look for alternative ways to add extra substituters in [nix.conf](https://nix.dev/manual/nix/2.18/command-ref/conf-file).

## Switching between different GHC versions
## Enabling the development environment

The `bin` directory, holds all available shells:
To enable the development environment exposed by the project's [Nix flake](../flake.nix), you can start a development shell by running the following command from within the project's root:

```
ls bin | grep ghc
nix develop
```

To spawn a new shell with a pre-defined GHC version, choose one of the scripts
listed above and run the following command:
Alternatively, if you are using [nix-direnv](https://github.com/nix-community/nix-direnv) (recommended), you can run:

```sh
./bin/ghc90
```

Once inside the shell, verify the GHC version matches the script name:

```
ghc --version
direnv allow
```

After that, all commands detailed in the [Getting
Started](../README.md#getting-started) section should work the same.

Alternatively, to run a command without spawning a new shell use the `-c`
option:

```sh
./bin/ghc90 -c <command>
```
that will enable the development shell according to the contents of [.envrc](../.envrc). It is advisable not to run `direnv allow` blindly and always check the contents of [.envrc](../.envrc) files first to ensure nothing malicious is executed.
118 changes: 57 additions & 61 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 e910902

Please sign in to comment.