-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
Migrate the Nix setup to flakes + haskell.nix
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build and cache with Nix | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '**' | ||
- '!.github/**' | ||
- '.github/workflows/nix.yml' | ||
|
||
jobs: | ||
build-and-cache: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 740 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, macos-m1] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Nix with caching | ||
uses: kadena-io/setup-nix-with-cache/by-root@v3 | ||
with: | ||
cache_url: s3://nixcache.chainweb.com?region=us-east-1 | ||
signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }} | ||
|
||
- name: Set up AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.NIX_CACHE_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.NIX_CACHE_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Give root user AWS credentials | ||
uses: kadena-io/setup-nix-with-cache/copy-root-aws-credentials@v3 | ||
|
||
- name: Build and cache artifacts | ||
run: | | ||
echo Building the project | ||
nix build .#check --log-lines 500 --show-trace |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,9 @@ | ||
{ compiler ? "ghc8107" | ||
, rev ? "7a94fcdda304d143f9a40006c033d7e190311b54" | ||
, sha256 ? "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik" | ||
, pkgs ? | ||
import (builtins.fetchTarball { | ||
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; | ||
inherit sha256; }) { | ||
config.allowBroken = false; | ||
config.allowUnfree = true; | ||
} | ||
, returnShellEnv ? false | ||
, mkDerivation ? null | ||
}: | ||
let gitignoreSrc = import (pkgs.fetchFromGitHub { | ||
owner = "hercules-ci"; | ||
repo = "gitignore"; | ||
rev = "9e80c4d83026fa6548bc53b1a6fab8549a6991f6"; | ||
sha256 = "04n9chlpbifgc5pa3zx6ff3rji9am6msrbn1z3x1iinjz2xjfp4p"; | ||
}) {}; | ||
hpkgs = pkgs.haskell.packages.${compiler}; | ||
|
||
# See https://github.com/obsidiansystems/nix-thunk for documentation | ||
nix-thunk = import ./deps/nix-thunk {}; | ||
inherit (nix-thunk) thunkSource; | ||
in | ||
hpkgs.developPackage { | ||
name = builtins.baseNameOf ./.; | ||
root = gitignoreSrc.gitignoreSource ./.; | ||
|
||
overrides = self: super: with pkgs.haskell.lib; | ||
{ | ||
|
||
direct-sqlite = dontCheck (self.callHackageDirect { | ||
pkg = "direct-sqlite"; | ||
ver = "2.3.27"; | ||
sha256 = "0w8wj3210h08qlws40qhidkscgsil3635zk83kdlj929rbd8khip"; | ||
} {}); | ||
|
||
kadena-signing-api = doJailbreak super.kadena-signing-api; | ||
katip = dontCheck super.katip; | ||
|
||
prettyprinter-ansi-terminal = dontCheck (self.callHackageDirect { | ||
pkg = "prettyprinter-ansi-terminal"; | ||
ver = "1.1.2"; | ||
sha256 = "0lwcqndppw3jc55rlnn6sp76zmjx2yzl21g9jhg27k2rdnjwd7md"; | ||
} {}); | ||
|
||
HsYAML = dontCheck super.HsYAML; | ||
HsYAML-aeson = dontCheck super.HsYAML-aeson; | ||
aeson = dontCheck super.aeson; | ||
base16 = doJailbreak (dontCheck super.base16); | ||
chainweb-api = doJailbreak (dontCheck super.chainweb-api); | ||
cryptonite = dontCheck (appendConfigureFlag super.cryptonite "-fsupport_pclmuldq"); | ||
hashable = doJailbreak super.hashable; | ||
|
||
# These tests pull in unnecessary dependencies | ||
http2 = dontCheck super.http2; | ||
|
||
pact = dontCheck (appendConfigureFlag super.pact "-fcryptonite-ed25519 -f-build-tool -fno-advice"); | ||
prettyprinter = dontCheck super.prettyprinter; | ||
rebase = doJailbreak super.rebase; | ||
}; | ||
|
||
source-overrides = { | ||
HsYAML = nix-thunk.thunkSource ./deps/HsYAML; | ||
HsYAML-aeson = nix-thunk.thunkSource ./deps/HsYAML-aeson; | ||
cardano-crypto = nix-thunk.thunkSource ./deps/cardano-crypto; | ||
chainweb-api = thunkSource ./deps/chainweb-api; | ||
pact = thunkSource ./deps/pact; | ||
kadena-signing-api = (thunkSource ./deps/signing-api) + "/kadena-signing-api"; | ||
|
||
OneTuple = "0.3"; | ||
aeson = "1.5.6.0"; | ||
ansi-terminal = "0.11.3"; | ||
prettyprinter-ansi-terminal = "1.1.2"; | ||
time-compat = "1.9.5"; | ||
trifecta = "2.1.1"; | ||
unordered-containers = "0.2.15.0"; | ||
|
||
# These are required in order to not break payload validation | ||
base16-bytestring = "0.1.1.7"; | ||
prettyprinter = "1.6.0"; | ||
hashable = "1.3.0.0"; | ||
base64-bytestring = "1.0.0.3"; | ||
|
||
optparse-applicative = pkgs.fetchFromGitHub { | ||
owner = "pcapriotti"; | ||
repo = "optparse-applicative"; | ||
rev = "9399fd0f745e4d4d71e8bba03d402648b767363c"; | ||
sha256 = "0gkgccix898mafrs25fajqwxbb7zmg30livrj7b79knd6a5sqj76"; | ||
}; | ||
}; | ||
|
||
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: { | ||
buildTools = (attrs.buildTools or []) ++ [ | ||
pkgs.zlib | ||
hpkgs.cabal-install | ||
hpkgs.ghcid | ||
]; | ||
}); | ||
|
||
inherit returnShellEnv; | ||
} | ||
(import ( | ||
let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
in fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; } | ||
) { | ||
src = ./.; | ||
}).defaultNix.packages.${builtins.currentSystem}.default |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.