Skip to content

Commit 365d39b

Browse files
authored
Merge branch 'master' into hkm/nixpkgs-update
2 parents 52d807d + 57938c2 commit 365d39b

File tree

1,182 files changed

+906
-99012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,182 files changed

+906
-99012
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Wait for Hydra Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "nix-tools-*"
9+
pull_request:
10+
11+
env:
12+
FLAKE_REF: github:${{ github.repository }}?ref=${{ github.head_ref || github.ref }}
13+
GH_TOKEN: ${{ github.token }}
14+
15+
jobs:
16+
wait-for-hydra:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install Nix with good defaults
24+
uses: input-output-hk/install-nix-action@v20
25+
with:
26+
extra_nix_config: |
27+
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=
28+
substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com
29+
nix_path: nixpkgs=channel:nixos-unstable
30+
31+
- name: Display flake metadata
32+
id: flake-metadata
33+
run: |
34+
echo $PWD
35+
ls -lah .
36+
nix flake metadata ${{ env.FLAKE_REF }}
37+
nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT"
38+
39+
- name: Wait for nix-tools meta job
40+
uses: input-output-hk/actions/wait-for-hydra@angerman/support-prs
41+
with:
42+
status: 'ci/hydra-build:nix-tools'
43+
44+
- name: "Pull nix-tools"
45+
run: |
46+
ls -lah .
47+
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip .
48+
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip .
49+
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip .
50+
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd --no-link --print-out-paths)/*.zip .
51+
52+
- name: Configure Git
53+
if: startsWith(github.ref, 'refs/tags/')
54+
run: |
55+
git config --global user.name 'Auto Update Bot'
56+
git config --global user.email '[email protected]'
57+
58+
- name: "Compute nix-tools-static.nix"
59+
if: startsWith(github.ref, 'refs/tags/')
60+
run: |
61+
git fetch --all
62+
git switch --force static-nix-tools
63+
(
64+
echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell.nix/releases/download/${GITHUB_REF_NAME}/\"; in {"
65+
for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do
66+
echo " ${arch} = pkgs.fetchurl { "
67+
echo " name = \"${arch}-nix-tools-static\";"
68+
echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";"
69+
echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";"
70+
echo " };"
71+
done
72+
echo "}"
73+
) > nix-tools-static.nix
74+
cat nix-tools-static.nix
75+
76+
77+
- name: Push to nix branch
78+
if: startsWith(github.ref, 'refs/tags/')
79+
run: |
80+
git add nix-tools-static.nix
81+
git commit -m "update nix-tools-static.nix"
82+
git push origin static-nix-tools
83+
84+
- name: Release
85+
uses: input-output-hk/action-gh-release@v1
86+
if: startsWith(github.ref, 'refs/tags/')
87+
with:
88+
files: |
89+
*-nix-tools-static.zip

build.nix

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ in rec {
2626

2727
tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
2828
pkgs.recurseIntoAttrs ({
29-
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; cabalProjectLocal = builtins.readFile ./test/cabal.project.local; };
29+
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; };
3030
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
3131
hlint-latest = tool compiler-nix-name "hlint" {
3232
inherit evalPackages;
@@ -91,11 +91,7 @@ in rec {
9191
};
9292
check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {};
9393
check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix {
94-
# Includes cabal-install since this is commonly used.
95-
nix-tools = pkgs.linkFarm "common-tools" [
96-
{ name = "nix-tools"; path = haskell.nix-tools; }
97-
{ name = "cabal-install"; path = haskell.cabal-install.${compiler-nix-name}; }
98-
];
94+
nix-tools = haskell.nix-tools-unchecked; # includes cabal-install and default-setup
9995
};
10096
check-materialization-concurrency = pkgs.buildPackages.callPackage ./scripts/check-materialization-concurrency/check.nix {};
10197
check-path-support = pkgsForGitHubAction.buildPackages.callPackage ./scripts/check-path-support.nix {
@@ -114,7 +110,7 @@ in rec {
114110
# Some of the dependencies of the impure scripts so that they will
115111
# will be in the cache too for buildkite.
116112
inherit (pkgs.buildPackages) glibc coreutils git openssh cabal-install nix-prefetch-git;
117-
inherit (haskell) nix-tools;
113+
nix-tools = pkgs.haskell-nix.nix-tools-unchecked;
118114
})
119115
);
120116
}

builder/comp-builder.nix

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ let
110110

111111
ghc = (if enableDWARF then (x: x.dwarf) else (x: x)) (
112112
(if smallAddressSpace then (x: x.smallAddressSpace) else (x: x)) defaults.ghc);
113-
setup = (if enableDWARF then (x: x.dwarf) else (x: x)) (
114-
(if smallAddressSpace then (x: x.smallAddressSpace) else (x: x)) drvArgs.setup);
113+
setup = (if enableDWARF then (x: x.dwarf or x) else (x: x)) (
114+
(if smallAddressSpace then (x: x.smallAddressSpace or x) else (x: x)) drvArgs.setup);
115115

116116
# TODO fix cabal wildcard support so hpack wildcards can be mapped to cabal wildcards
117117
canCleanSource = !(cabal-generator == "hpack" && !(package.cleanHpack or false));
@@ -285,7 +285,7 @@ let
285285

286286
enableParallelBuilding = true;
287287

288-
SETUP_HS = setup + /bin/Setup;
288+
SETUP_HS = setup + "/bin/${setup.exeName}";
289289

290290
inherit cabalFile;
291291
passAsFile = [ "cabalFile" ];
@@ -545,7 +545,7 @@ let
545545
# we assume that if the SETUP_HS command fails and the following line was found in the error
546546
# log, that it was the only error. Hence if we do _not_ find the line, grep will fail and this derivation
547547
# will be marked as failure.
548-
cat $SETUP_ERR | grep 'No executables and no library found\. Nothing to do\.'
548+
cat $SETUP_ERR | tr '\n' ' ' | tr -d '\r' | grep 'No executables and no library found\. Nothing to do\.'
549549
fi
550550
''}
551551
${lib.optionalString (haskellLib.isLibrary componentId) ''
@@ -635,7 +635,11 @@ let
635635
''))
636636
+ (lib.optionalString doCoverage ''
637637
mkdir -p $out/share
638-
cp -r dist/${lib.optionalString (builtins.compareVersions defaults.ghc.version "9.9" >= 0) "build/extra-compilation-artifacts/"}hpc $out/share
638+
if [ -d dist/build/extra-compilation-artifacts ]; then
639+
cp -r dist/build/extra-compilation-artifacts/hpc $out/share
640+
else
641+
cp -r dist/hpc $out/share
642+
fi
639643
cp dist/setup-config $out/
640644
'')
641645
}

builder/hspkg-builder.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ let
3535

3636
setup = if package.buildType == "Simple"
3737
then
38-
# Don't try to build default setup with DWARF enabled
39-
let defaultSetup = ghc.defaultSetupFor package.identifier.name // {
40-
dwarf = defaultSetup;
41-
}; in defaultSetup
38+
if stdenv.targetPlatform.isGhcjs # TODO probably should be hostPlatform, but only HsColour used to build ghc will change (updating will require rebuilding all the ghcjs versions)
39+
then
40+
buildPackages.haskell-nix.nix-tools-unchecked.exes.default-setup-ghcjs // { exeName = "default-setup-ghcjs"; }
41+
else
42+
buildPackages.haskell-nix.nix-tools-unchecked.exes.default-setup // { exeName = "default-setup"; }
4243
else setup-builder ({
4344
component = components.setup // {
4445
depends = config.setup-depends ++ components.setup.depends ++ package.setup-depends;

builder/setup-builder.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ let
7777
cleanSrc = cleanSrc';
7878
dwarf = self (drvArgs // { enableDWARF = true; });
7979
smallAddressSpace = self (drvArgs // { smallAddressSpace = true; });
80+
exeName = "Setup";
8081
};
8182

8283
meta = {

flake.lock

Lines changed: 14 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
url = "github:input-output-hk/stackage.nix";
3737
flake = false;
3838
};
39-
nix-tools-static = {
40-
url = "github:input-output-hk/haskell-nix-example/nix";
41-
flake = false;
42-
};
4339
cabal-32 = {
4440
url = "github:haskell/cabal/3.2";
4541
flake = false;
@@ -132,7 +128,7 @@
132128
stripAttrsForHydra
133129
filterDerivations;
134130

135-
in traceHydraJobs ({
131+
flake = {
136132
inherit config;
137133
overlay = self.overlays.combined;
138134
overlays = import ./overlays { sources = inputs; };
@@ -247,10 +243,6 @@
247243
inherit system;
248244
pkgs = self.legacyPackages.${system};
249245
src = ./nix-tools;
250-
override-inputs = {
251-
# Avoid downloading another `hackage.nix`.
252-
inherit (inputs) hackage;
253-
};
254246
};
255247
in cf.defaultNix.hydraJobs;
256248
in
@@ -287,7 +279,23 @@
287279
"ghc901"
288280
"ghc921" "ghc922" "ghc923"])
289281
);
290-
});
282+
}; in with (import nixpkgs { system = "x86_64-linux"; });
283+
traceHydraJobs (lib.recursiveUpdate flake {
284+
hydraJobs.nix-tools = pkgs.releaseTools.aggregate {
285+
name = "nix-tools";
286+
constituents = [
287+
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static"
288+
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static"
289+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static"
290+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64"
291+
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
292+
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
293+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd"
294+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd"
295+
(writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000"))
296+
];
297+
};
298+
});
291299

292300
# --- Flake Local Nix Configuration ----------------------------
293301
nixConfig = {

0 commit comments

Comments
 (0)