Skip to content
Merged
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
40 changes: 34 additions & 6 deletions .github/workflows/nixpkgs-ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
name: "nixpkgs CI"

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
get-ghc-versions:
name: Determine GHC versions to test
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.get-ghc-versions-step.outputs.versions }}

steps:
- uses: actions/checkout@v4.2.2
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Get GHC Versions from ci.nix
id: get-ghc-versions-step
run: |
echo -n "versions=" >> "$GITHUB_OUTPUT"
nix-instantiate --eval --strict --json -E "builtins.attrNames (import ./ci.nix { })" >> "$GITHUB_OUTPUT"

nix-build:
runs-on: ubuntu-latest
needs:
- get-ghc-versions

strategy:
matrix:
version: ${{ fromJSON(needs.get-ghc-versions.outputs.versions) }}

steps:
- uses: actions/checkout@v3.3.0
- uses: cachix/install-nix-action@v19
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: ci.nix
run: nix-build ci.nix
- uses: actions/checkout@v4.2.2
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: nix-build ci.nix -A ${{ matrix.version }}
env:
ATTR: ${{ matrix.version }}
run: |
nix-build ci.nix -A "$ATTR"
19 changes: 17 additions & 2 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ let
inherit (pkgs) lib haskell;
inherit (haskell.lib.compose) buildFromSdist overrideCabal;

expr =
{ mkDerivation, base, Cabal, Cabal-syntax, lib }:
mkDerivation {
pname = "jailbreak-cabal";
version = "unstable-unknown";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base Cabal Cabal-syntax ];
homepage = "https://github.com/NixOS/jailbreak-cabal";
description = "Strip version restrictions from Cabal files";
license = lib.licenses.bsd3;
mainProgram = "jailbreak-cabal";
};

# All non-binary GHC package sets
eligible = lib.filterAttrs
(name: _:
Expand All @@ -18,11 +33,11 @@ lib.mapAttrs
(_: hpkgs:
# cabal-install is not cached for all package sets, so we'll rely on Setup.hs
lib.pipe
(hpkgs.callCabal2nix "jailbreak-cabal-ghc-${hpkgs.ghc.version}.nix" ./. {})
(hpkgs.callPackage expr { })
[
# Check for packaging bugs
buildFromSdist
# To better identify build failures
(overrideCabal { pname = "jailbreak-cabal-ghc-${hpkgs.ghc.version}"; })
(overrideCabal (old: { version = "${old.version}+ghc-${hpkgs.ghc.version}"; }))
])
eligible