Skip to content

Commit

Permalink
Add nix packaging support using haskell.nix (#483)
Browse files Browse the repository at this point in the history
* Add nix packaging files

* Flake-based nix packaging

* Add non-flake compatibility layer for nix

* Try to put stack.yaml with a sub-dir

* Revert "Try to put stack.yaml with a sub-dir"

Does not work, attempting other workarounds.

This reverts commit 45a8601.

* Use haskell.nix from main flake

* Use correct project type

* Support of different ghc versions in nix packaging

* Add multiple devShells and fix typo

* Fix another typo

* Another typo

* Add workflow for testing nix integration

* Remove evalSystem

* Disable devshell testing in workflows, takes too long

* Add missing option for nix flake commands to work

* Fix nix flake check

* Try to fix OS X workflow
  • Loading branch information
chaserhkj authored Jul 21, 2024
1 parent f2db6f8 commit 4496a35
Show file tree
Hide file tree
Showing 5 changed files with 907 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Test Nix Integration"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
nix:
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
name: Nix on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.nixos.org https://cache.ngi0.nixos.org/ https://cache.iog.io/
nix_path: nixpkgs=channel:nixos-unstable

- name: "Test Nix flakes build"
run: nix build

# Development shells will require building of hls and take a lot of time
# Let's not do that in the actions for now
# - name: "Test Nix flakes development shell"
# run: nix develop --check

- name: "Test Nix flake-compact build"
run: nix-build

# - name: "Test Nix flake-compact development shell"
# run: nix-shell --run echo

- continue-on-error: false
run: nix flake check --allow-import-from-derivation --impure
10 changes: 10 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
Loading

0 comments on commit 4496a35

Please sign in to comment.