Skip to content

Add haskell.nix workflow to check windows cross compilation and WINE #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/haskell-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Haskell.nix CI

on:
push:
branches: [ 'master', 'ci' ]
pull_request:
branches: [ 'master' ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.zw3rk.com https://cache.nixos.org/
- name: "Build and run tests with nix"
run: |
nix flake check --allow-import-from-derivation
55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
# Haskell.nix project used by `.github/workflows/haskell-nix.yml`

inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils, haskellNix }:
let
supportedSystems = [
"x86_64-linux"
];
in
flake-utils.lib.eachSystem supportedSystems (system:
let
overlays = [ haskellNix.overlay
(final: _prev: {
networkProject =
final.haskell-nix.cabalProject {
name = "network";
src = ./.;
compiler-nix-name = "ghc9122";
# Include Windows cross compilation
crossPlatforms = p: [ p.ucrt64 ];
modules = [{
# Run autoreconf on the source
packages.network.src = final.lib.mkForce (final.stdenv.mkDerivation {
pname = "network-src";
version = "1.0";
src = ./.;
nativeBuildInputs = [ final.autoreconfHook ];
installPhase = ''
mkdir -p $out
cp -r . $out
'';
});
}];
};
})
];
pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; };
flake = pkgs.networkProject.flake {};
in flake // {
legacyPackages = pkgs;
});

# --- Flake Local Nix Configuration ----------------------------
nixConfig = {
# This sets the flake to use the IOG nix cache.
# Nix should ask for permission before using it,
# but remove it here if you do not want it to.
extra-substituters = ["https://cache.iog.io" "https://cache.zw3rk.com"];
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="];
allow-import-from-derivation = "true";
};
}
Loading