Skip to content
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

Use ghcr.io to store closure #39

Merged
merged 197 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
52017d6
Create a GA to populate zw3rk S3 buckets on push events
yvan-sraka Mar 6, 2023
de7ee45
Fix AWS S3 CLI error: Unable to locate credentials ...
yvan-sraka Mar 13, 2023
8968482
Add a GitHub Action workflow to run on-demand some benchmarks
yvan-sraka Mar 13, 2023
080234b
Use GitHub Pages to serve statically the bootstrap shell
yvan-sraka Mar 13, 2023
c9beeae
Solve a "full disk" GA issue by rather rely on a matrix of jobs
yvan-sraka Mar 14, 2023
c09e618
Apply @angerman suggestions from last PR review :)
yvan-sraka Mar 14, 2023
759909d
Try to take advantage of hydra build products rather than rely on GA …
yvan-sraka Mar 15, 2023
54953b8
Apply @angerman patch :)
yvan-sraka Mar 16, 2023
8e8c2f3
[WIP] Last tweaks and plumbing ...
yvan-sraka Mar 16, 2023
3159409
WIP ...
yvan-sraka Mar 20, 2023
6e017cd
Add hello action
hamishmack Mar 27, 2023
d95cd8e
Add on: push:
hamishmack Mar 27, 2023
f66dc54
Test shell
hamishmack Mar 27, 2023
ef47b15
Test just using run
hamishmack Mar 27, 2023
b46fe2e
Without quotes
hamishmack Mar 27, 2023
4f3c082
Without {0}
hamishmack Mar 27, 2023
1fdc65a
Try with bash
hamishmack Mar 27, 2023
db639a9
Fix unpack
hamishmack Mar 27, 2023
f0dc17a
Fix unpack
hamishmack Mar 27, 2023
388727a
Try multiple cases
hamishmack Mar 27, 2023
e567c9f
Use this devx repo
hamishmack Mar 27, 2023
27af155
Try parent?
hamishmack Mar 27, 2023
f10d673
Use ${{ github.workspace }}
hamishmack Mar 27, 2023
4cb89d2
Try $GITHUB_WORKSPACE
hamishmack Mar 27, 2023
9e55c50
"${{ github.workspace }}"/.
hamishmack Mar 27, 2023
78dea2f
"${{ github.workspace }}"/.
hamishmack Mar 27, 2023
029ae0d
${GITHUB_WORKSPACE}
hamishmack Mar 27, 2023
df718de
Checkout code
hamishmack Mar 27, 2023
ec5b9cf
Merge remote-tracking branch 'origin/main' into s3-uploads
hamishmack Mar 27, 2023
55a0d68
Include cabal update
hamishmack Mar 27, 2023
63583cc
--accept-flake-config
hamishmack Mar 27, 2023
1059995
Merge remote-tracking branch 'origin/main' into s3-uploads
hamishmack Mar 28, 2023
494a9b3
Try with closure
hamishmack Mar 28, 2023
3c347f4
Allow redirect
hamishmack Mar 28, 2023
9ac893d
More curl options
hamishmack Mar 28, 2023
6bfb884
Use gzip and only make linux
hamishmack Mar 28, 2023
9ceadf3
Add (haskell-nix.roots compiler-nix-name)
hamishmack Mar 28, 2023
360c170
Try using env.sh instead of nix develop
hamishmack Mar 28, 2023
66e83dd
Remove (haskell-nix.roots compiler-nix-name)
hamishmack Mar 28, 2023
fda8561
Try cloudflair
hamishmack Mar 29, 2023
1ab863e
Try zstd for compression
hamishmack Mar 29, 2023
d955302
Use zstd
hamishmack Mar 29, 2023
165c551
Split out cabal update
hamishmack Mar 29, 2023
989f84d
Split out cabal update
hamishmack Mar 29, 2023
260caa4
Try using ghrc
hamishmack Mar 29, 2023
370e588
Use nix profile install
hamishmack Mar 29, 2023
e9252c6
Tidy up
hamishmack Mar 29, 2023
ab5aa2e
Split DL and import
hamishmack Mar 29, 2023
05f24e0
Split DL and import
hamishmack Mar 29, 2023
ea69f66
Split installs
hamishmack Mar 29, 2023
e2f3bf9
Use static jq
hamishmack Mar 29, 2023
9ac9c8b
Use curl instead of skopeo
hamishmack Mar 29, 2023
5414f1a
Bump haskell.nix
hamishmack Mar 30, 2023
776088a
Make env.sh the root of the closure
hamishmack Mar 30, 2023
45364f9
Get env.sh from last line of import
hamishmack Mar 30, 2023
b668c05
Get env.sh from last line of import
hamishmack Mar 30, 2023
52614e2
Use crul and ci.zw3rk.com for now
hamishmack Mar 30, 2023
5e6d05b
Add missing zstd -d
hamishmack Mar 30, 2023
90a85d6
Symlink env.sh
hamishmack Mar 30, 2023
df8ee69
Back to fetch-docker.sh
hamishmack Mar 30, 2023
176f837
Back to fetch-docker.sh
hamishmack Mar 30, 2023
fa02104
Add devx bash wrapper
hamishmack Mar 31, 2023
58ac368
use sudo
hamishmack Mar 31, 2023
9231794
Add {0}
hamishmack Mar 31, 2023
2c8e361
Try building with GHA
hamishmack Mar 31, 2023
897c695
fix file name
hamishmack Mar 31, 2023
59e6a4f
Fix attribute path
hamishmack Mar 31, 2023
6c86011
Tidy up
hamishmack Mar 31, 2023
4b3e8b9
Try uploading container
hamishmack Mar 31, 2023
3546c91
Add missing ./
hamishmack Mar 31, 2023
f086a10
Fix file name
hamishmack Mar 31, 2023
85696ab
Fix file name
hamishmack Mar 31, 2023
707f876
Try again
hamishmack Mar 31, 2023
dd0c118
Trace script commands
hamishmack Mar 31, 2023
45370c7
Add quotes
hamishmack Mar 31, 2023
965c092
Clean output
hamishmack Mar 31, 2023
b43da3b
Set default shell use new docker repo
hamishmack Mar 31, 2023
4424bd1
fix unapck
hamishmack Mar 31, 2023
880effe
Does this work?
hamishmack Mar 31, 2023
372ab9e
How about this
hamishmack Mar 31, 2023
ca36e44
Try source
hamishmack Mar 31, 2023
f664a95
Try source
hamishmack Mar 31, 2023
c832dcc
exec?
hamishmack Mar 31, 2023
be5ff20
exec bash
hamishmack Mar 31, 2023
dd0f051
Try source again
hamishmack Mar 31, 2023
0801471
Try eval
hamishmack Mar 31, 2023
78c33a9
Use GITHUB_ENV
hamishmack Mar 31, 2023
d6f774e
Use working-directory
hamishmack Mar 31, 2023
3600f3a
Test error handling
hamishmack Mar 31, 2023
44ae49a
Update devx
hamishmack Mar 31, 2023
add4711
set -euox pipefail
hamishmack Mar 31, 2023
8ad672f
Remove tracing
hamishmack Mar 31, 2023
9fee91d
Use matrix to upload
hamishmack Mar 31, 2023
5af13f2
Use matrix to upload
hamishmack Mar 31, 2023
3b03de7
Build more
hamishmack Mar 31, 2023
588f8c5
Fix matrix
hamishmack Mar 31, 2023
7580f46
fail-fast: false
hamishmack Mar 31, 2023
243954d
Exclude missing versions
hamishmack Mar 31, 2023
aafe0f4
Try ln -s
hamishmack Mar 31, 2023
26d99aa
Try single quotes
hamishmack Mar 31, 2023
18cd141
Use exclude
hamishmack Mar 31, 2023
16def2e
Fix hello matrix
hamishmack Mar 31, 2023
3f1aaa2
Try sudo mv
hamishmack Mar 31, 2023
b455e5a
Add nix-collect-garbage
hamishmack Mar 31, 2023
1d83fcd
avoid using tempfs
hamishmack Mar 31, 2023
074d064
Fix for JS
hamishmack Apr 3, 2023
0f052da
Test rebuilding env.sh
hamishmack Apr 3, 2023
a8301ac
Try building env.sh on hydra
hamishmack Apr 3, 2023
d2776a0
Avoid one level of recursive nix
hamishmack Apr 3, 2023
06dce2c
Avoid one level of recursive nix
hamishmack Apr 3, 2023
202f914
Fix DEVSHELL
hamishmack Apr 3, 2023
9f7722d
Fix DEVSHELL
hamishmack Apr 3, 2023
4bfb622
check cabal wrapper
hamishmack Apr 3, 2023
fcac467
Fix devshell selection
hamishmack Apr 3, 2023
7e34142
Try to build all variants
hamishmack Apr 3, 2023
27f0abc
Build darwin shells on hydra
hamishmack Apr 3, 2023
400290a
No musl on macOS
hamishmack Apr 3, 2023
92df396
Update github action matrix
hamishmack Apr 4, 2023
2bf9ef2
Update .github/workflows/main.yml
hamishmack Apr 4, 2023
9c83626
Update .github/workflows/hello.yml
hamishmack Apr 4, 2023
4cd3171
Remove test code used to trigger rebuild
hamishmack Apr 4, 2023
ef17bed
Add aarch64
hamishmack Apr 4, 2023
f27752a
Remove code we don't need yet
hamishmack Apr 4, 2023
0ece4e3
Add aarch64
hamishmack Apr 4, 2023
b335dd0
Add `--show-trace`
hamishmack Apr 5, 2023
221fb21
Verbose logging
hamishmack Apr 5, 2023
b60df73
Reduce size while we debug
hamishmack Apr 5, 2023
ee7a861
Update flake.nix
angerman Apr 5, 2023
dee9937
Fix HLS and disable darwin github actions (for now)
hamishmack Apr 6, 2023
3200341
Skip macOS env.sh derivations for now
hamishmack Apr 6, 2023
0ce401d
Use oras rather than custom scripts
andreabedini Apr 6, 2023
0e38e81
Merge pull request #40 from input-output-hk/andreabedini/ghcr
hamishmack Apr 6, 2023
1be42a3
Skip darwin
hamishmack Apr 6, 2023
278c712
Use hkm/aarch64-musl branch of haskell.nix
hamishmack Apr 12, 2023
7f8ee01
Use non musl tools for now
hamishmack Apr 13, 2023
4530e65
Add --show-trace
hamishmack Apr 13, 2023
3b94ee5
Add --show-trace
hamishmack Apr 13, 2023
aea059a
Add --show-trace
hamishmack Apr 13, 2023
791a7f1
Try setting `evalSystem`
hamishmack Apr 13, 2023
3592c50
Try setting `evalSystem`
hamishmack Apr 13, 2023
0a4cef8
Try setting `evalSystem`
hamishmack Apr 13, 2023
6f14266
Add windows
hamishmack Apr 13, 2023
8b98ea5
Update flake-utils
hamishmack Apr 13, 2023
5974dde
Limit windows to x86_64
hamishmack Apr 13, 2023
9b8b638
Limit windows to x86_64
hamishmack Apr 13, 2023
6ccccd1
Include more windows compilers
hamishmack Apr 13, 2023
8ec3f5b
Avoid overhead of oras
hamishmack Apr 13, 2023
365f7be
Check script
hamishmack Apr 13, 2023
168cc74
Check script
hamishmack Apr 13, 2023
578168f
Remove broken check
hamishmack Apr 13, 2023
7197783
Windows fixes
hamishmack Apr 13, 2023
40f8a52
Run all tests
hamishmack Apr 13, 2023
cfbc783
Build darwin shells
hamishmack Apr 13, 2023
ea91075
Turn off darwin for now
hamishmack Apr 14, 2023
4557156
Bump haskellNix
hamishmack Apr 14, 2023
2e88d88
Bump haskellNix
hamishmack Apr 14, 2023
b2acfb6
Disable broken tests
hamishmack Apr 17, 2023
caa9edc
Check if derivation path can be found
hamishmack Apr 18, 2023
e31aa73
Bump haskellNix
hamishmack Apr 18, 2023
155664d
Bump haskellNix
hamishmack Apr 18, 2023
6ec3480
remove test step
hamishmack Apr 18, 2023
3b89123
Set cabal dir
hamishmack Apr 18, 2023
030bd6c
Set cabal dir
hamishmack Apr 18, 2023
fb385ac
Set cabal dir
hamishmack Apr 18, 2023
88d5d66
Disable aarch64-linux for now
hamishmack Apr 18, 2023
aa8d7e1
Fixes for hsc2hs
hamishmack Apr 18, 2023
b6460e8
Use hsc2hs wrapper
hamishmack Apr 18, 2023
48c1528
Add alex and happy for cross compiling
hamishmack Apr 18, 2023
ef9573a
Add alex and happy for cross compiling
hamishmack Apr 18, 2023
359cb49
Fix TH on windows
hamishmack Apr 19, 2023
da6ef68
Get crypto overlay from iohk-nix as flake input
hamishmack Apr 19, 2023
3d71e9c
Merge remote-tracking branch 'origin/main' into hkm/ghcr
hamishmack Apr 21, 2023
22be169
Remove windows cross compile for now.
hamishmack Apr 21, 2023
5c5e279
Try building on macOS
hamishmack Apr 21, 2023
fa4cefc
Build containers on linux
hamishmack Apr 21, 2023
4acee2d
Include aarch64-darwin
hamishmack Apr 21, 2023
8a78667
Use cp instead of ln -s for /usr/bin
hamishmack Apr 21, 2023
3c0ebb0
Log command
hamishmack Apr 21, 2023
4e4bc2b
Use /usr/local/bin
hamishmack Apr 21, 2023
775eac5
Check contents of /usr/local/bin
hamishmack Apr 21, 2023
66cd18b
sudo chmod +x /usr/local/bin/devx-env.sh
hamishmack Apr 21, 2023
7507f5d
Try ln -s and /usr/local/bin
hamishmack Apr 21, 2023
1ec5910
Use #!/bin/bash
hamishmack Apr 21, 2023
31fe920
Enable all tests
hamishmack Apr 21, 2023
2d5885c
Try macos-12
hamishmack Apr 21, 2023
bf80666
Skip aarch64-darwin for now
hamishmack Apr 21, 2023
9bde99c
Use master branch of haskellNix
hamishmack Apr 24, 2023
213641b
Update for ghc 9.4.5 support
hamishmack Apr 24, 2023
a243ea0
Refactor the way evalSystem is set
hamishmack Apr 24, 2023
5818363
Skip broken hlint
hamishmack Apr 24, 2023
1965c22
Skip broken hlint
hamishmack Apr 24, 2023
3f5bde0
Skip broken hlint and hls
hamishmack Apr 24, 2023
e64d893
Skip broken hlint and hls
hamishmack Apr 24, 2023
231b859
Use tool map for happy and alex
hamishmack Apr 24, 2023
3337824
Fix happy and alex versions
hamishmack Apr 24, 2023
0c1480e
Cabal revision work around
hamishmack Apr 26, 2023
e61b7ca
Add comments
hamishmack Apr 26, 2023
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
89 changes: 89 additions & 0 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Test that we can build the hello world example form hackage
on:
push:
workflow_dispatch:

defaults:
run:
shell: devx {0}

jobs:
build:
strategy:
fail-fast: false
matrix:
platform:
- x86_64-darwin
- x86_64-linux
# Skipping because we do not have runners for these set up.
#- aarch64-darwin
#- aarch64-linux
compiler-nix-name:
- ghc8107
- ghc927
- ghc961
target-platform:
- ""
- "-static"
- "-js"
hamishmack marked this conversation as resolved.
Show resolved Hide resolved
# Comming soon.
#- "-windows"
variant:
- ""
- "-minimal"
iog:
- ""
- "-iog"
exclude:
# Just cross compiling javascript with ghc 9.6.1 for now
- compiler-nix-name: ghc8107
target-platform: "-js"
- compiler-nix-name: ghc927
target-platform: "-js"
# Static builds not working for darwin yet
- platform: x86_64-darwin
target-platform: "-static"
# Static tools not working right now (so just building "-static-minimal" for now)
- target-platform: "-static"
variant: ""
# hlint and hls not working on ghc 9.6.1 yet
- target-platform: ghc961
variant: ""
# Windows cross compilation only works on x86_64 right now.
- platform: aarch64-darwin
target-platform: "-windows"
- platform: aarch64-linux
target-platform: "-windows"

runs-on: ${{ matrix.platform == 'x86_64-linux' && 'ubuntu-latest' || 'macos-latest' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Nix with good defaults
uses: cachix/install-nix-action@v17
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 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/
nix_path: nixpkgs=channel:nixos-unstable
- name: Install jq
shell: bash
run: |
curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o jq
chmod +x jq
- name: Download and import closure
shell: bash
run: |
./fetch-docker.sh input-output-hk/devx ${{ matrix.platform }}.${{ matrix.compiler-nix-name }}${{ matrix.target-platform }}${{ matrix.variant }}${{ matrix.iog }}-env | zstd -d | nix-store --import | tee store-paths.txt
sudo ln -s $(tail -n 1 store-paths.txt) /usr/local/bin/devx-env.sh
sudo cp extra/devx /usr/local/bin
- name: cabal update
run: cabal update
- name: unapck hello
run: cabal unpack hello
- name: build hello
working-directory: hello-1.0.0.2
run: cabal build
- name: test hello
working-directory: hello-1.0.0.2
run: cabal test
92 changes: 92 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Prebuild DevX closures
on:
push:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
strategy:
fail-fast: false
matrix:
platform:
- x86_64-darwin
- x86_64-linux
- aarch64-darwin
# Currently broken
#- aarch64-linux
compiler-nix-name:
- ghc8107
- ghc927
- ghc961
target-platform:
- ""
- "-static"
- "-js"
hamishmack marked this conversation as resolved.
Show resolved Hide resolved
# Coming soon.
#- "-windows"
variant:
- ""
- "-minimal"
iog:
- ""
- "-iog"
exclude:
# Just cross compiling javascript with ghc 9.6.1 for now
- compiler-nix-name: ghc8107
target-platform: "-js"
- compiler-nix-name: ghc927
target-platform: "-js"
# Static builds not working for darwin yet
- platform: x86_64-darwin
target-platform: "-static"
# Static tools not working right now (so just building "-static-minimal" for now)
- target-platform: "-static"
variant: ""
# hlint and hls not working on ghc 9.6.1 yet
- target-platform: ghc961
variant: ""
# Windows cross compilation only works on x86_64 right now.
- platform: aarch64-darwin
target-platform: "-windows"
- platform: aarch64-linux
target-platform: "-windows"

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Install Nix with good defaults
uses: cachix/install-nix-action@v17
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=
substituters = https://cache.iog.io/ https://cache.zw3rk.com/ https://cache.nixos.org/
nix_path: nixpkgs=channel:nixos-unstable
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Work around issue fetching cabal revision files
run: |
# This will cause the revised `.cabal` files used whan building alex
# for building GHC to be fetched using the `x86_64-linux` `.drv` for `fetchurl`.
# Later when we want the non `x86_64-linux` version later it will find the
# fixed output of the derivation is already in the `/nix/store` and will
# not try to fetch it using the platform we do not have a builder for.
if [[ "${{ matrix.platform }}" != "x86_64-linux" && "${{ matrix.target-platform }}" = "-js" ]]; then
nix build ".#hydraJobs.x86_64-linux.${{ matrix.compiler-nix-name }}-js-minimal" --show-trace
fi
- name: Compute and upload closure and developer environment to ghcr.io
env:
NIX_STORE_SECRET_KEY: ${{ secrets.SECRET_KEY }}
DEV_SHELL: ${{ matrix.platform }}.${{ matrix.compiler-nix-name }}${{ matrix.target-platform }}${{ matrix.variant }}${{ matrix.iog }}-env
run: ./extra/ghcr-upload.sh
24 changes: 16 additions & 8 deletions cross-js.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true, withIOG ? true }:
{ pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }:
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name (tool-version-map compiler-nix-name tool-name);
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = tool "cabal";
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
compiler-not-in = compiler-list: name: (if __elem compiler-nix-name compiler-list then __trace "No ${name}. Not yet compatible with ${compiler-nix-name}" false else true);
Expand All @@ -20,7 +20,7 @@ let tool-version-map = import ./tool-map.nix;
"$@" \
$NIX_CABAL_FLAGS
;;
clean)
clean|unpack)
cabal "$@"
;;
*)
Expand All @@ -29,6 +29,12 @@ let tool-version-map = import ./tool-map.nix;
esac
'';
};
wrapped-hsc2hs = pkgs.pkgsBuildBuild.writeShellApplication {
name = "${compiler.targetPrefix}hsc2hs";
text = ''
${compiler}/bin/${compiler.targetPrefix}hsc2hs --cross-compile "$@"
'';
};
in
pkgs.mkShell ({
# Note [cabal override]:
Expand All @@ -43,10 +49,10 @@ pkgs.mkShell ({
# open source, and licenses accordingly. Otherwise we'd have to link gmp
# dynamically. This requirement will be gone with gmp-bignum.
#
NIX_CABAL_FLAGS = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isGhcjs [
"--with-ghc=javascript-unknown-linux-ghcjs-ghc"
"--with-ghc-pkg=javascript-unknown-linux-ghcjs-pkg"
"--with-hsc2hs=javascript-unknown-linux-ghcjs-hsc2hs"
NIX_CABAL_FLAGS = [
"--with-ghc=javascript-unknown-ghcjs-ghc"
"--with-ghc-pkg=javascript-unknown-ghcjs-ghc-pkg"
"--with-hsc2hs=javascript-unknown-ghcjs-hsc2hs"
# ensure that the linker knows we want a static build product
# "--enable-executable-static"
];
Expand All @@ -69,9 +75,11 @@ pkgs.mkShell ({
'';
buildInputs = [];

nativeBuildInputs = [ wrapped-cabal compiler ] ++ (with pkgs; [
nativeBuildInputs = [ wrapped-hsc2hs wrapped-cabal compiler ] ++ (with pkgs; [
haskell-nix.cabal-install.${compiler-nix-name}
pkgconfig
(tool "happy")
(tool "alex")
stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [
])
++ pkgs.lib.optional (withHLS && (compiler-not-in ["ghc961"] "Haskell Language Server")) (tool "haskell-language-server")
Expand Down
12 changes: 7 additions & 5 deletions dynamic.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# define a development shell for dynamically linked applications (default)
{ pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true, withIOG ? true }:
{ pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }:
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name (tool-version-map compiler-nix-name tool-name);
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = tool "cabal";
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
compiler-not-in = compiler-list: name: (if __elem compiler-nix-name compiler-list then __trace "No ${name}. Not yet compatible with ${compiler-nix-name}" false else true);
Expand All @@ -18,7 +18,7 @@ let tool-version-map = import ./tool-map.nix;
case "$1" in
build) cabal "$@"
;;
clean) cabal "$@"
clean|unpack) cabal "$@"
;;
*) cabal "$@"
;;
Expand All @@ -33,6 +33,8 @@ pkgs.mkShell {
shellHook = with pkgs; ''
export PS1="\[\033[01;33m\][\w]$\[\033[00m\] "
${figlet}/bin/figlet -f rectangles 'IOG Haskell Shell'
export CABAL_DIR=$HOME/.cabal
echo "CABAL_DIR set to $CABAL_DIR"
''
# this one is only needed on macOS right now, due to a bug in loading libcrypto.
+ lib.optionalString stdenv.hostPlatform.isMacOS
Expand All @@ -57,8 +59,8 @@ pkgs.mkShell {
]
++ pkgs.lib.optional pkgs.stdenv.hostPlatform.isLinux systemd
)
++ pkgs.lib.optional (withHLS && (compiler-not-in ["ghc961"] "Haskell Language Server")) (tool "haskell-language-server")
++ pkgs.lib.optional (withHlint && (compiler-not-in ["ghc961"] "HLint")) (tool "hlint")
++ pkgs.lib.optional (withHLS && (compiler-not-in (["ghc961"] ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
++ pkgs.lib.optional (withHlint && (compiler-not-in (["ghc961"] ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
++ pkgs.lib.optional withIOG
(with pkgs; [ cddl cbor-diag ]
++ map pkgs.lib.getDev (with pkgs; [ libsodium-vrf secp256k1 R_4_1_3]))
Expand Down
6 changes: 6 additions & 0 deletions extra/devx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euo pipefail

source /usr/local/bin/devx-env.sh
source "$1"
7 changes: 7 additions & 0 deletions extra/ghcr-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p zstd -p oras
set -euox pipefail

nix build ".#hydraJobs.${DEV_SHELL}" --show-trace
nix-store --export $(nix-store -qR result) | zstd -z8T8 >${DEV_SHELL}
oras push ghcr.io/input-output-hk/devx:${DEV_SHELL} ${DEV_SHELL}
18 changes: 18 additions & 0 deletions fetch-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

TOKEN=$(curl --silent https://ghcr.io/token\?scope\=repository:$1:pull | jq -r .token)

BLOB=$(curl \
--silent \
--request 'GET' \
--header "Authorization: Bearer $TOKEN" \
--header "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
"https://ghcr.io/v2/$1/manifests/$2" | tee manifest.json | jq -r '.layers[0].digest')

curl \
--location \
--request GET \
--header "Authorization: Bearer ${TOKEN}" \
"https://ghcr.io/v2/$1/blobs/${BLOB}"
Loading
Loading