Skip to content

Commit

Permalink
Merge branch 'master' into hkm/nixpkgs-update
Browse files Browse the repository at this point in the history
  • Loading branch information
angerman authored Apr 5, 2024
2 parents 52d807d + 57938c2 commit 365d39b
Show file tree
Hide file tree
Showing 1,182 changed files with 906 additions and 99,012 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/upload-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Wait for Hydra Build

on:
push:
branches:
- main
tags:
- "nix-tools-*"
pull_request:

env:
FLAKE_REF: github:${{ github.repository }}?ref=${{ github.head_ref || github.ref }}
GH_TOKEN: ${{ github.token }}

jobs:
wait-for-hydra:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Nix with good defaults
uses: input-output-hk/install-nix-action@v20
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.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com
nix_path: nixpkgs=channel:nixos-unstable

- name: Display flake metadata
id: flake-metadata
run: |
echo $PWD
ls -lah .
nix flake metadata ${{ env.FLAKE_REF }}
nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT"
- name: Wait for nix-tools meta job
uses: input-output-hk/actions/wait-for-hydra@angerman/support-prs
with:
status: 'ci/hydra-build:nix-tools'

- name: "Pull nix-tools"
run: |
ls -lah .
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 .
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 .
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 .
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 .
- name: Configure Git
if: startsWith(github.ref, 'refs/tags/')
run: |
git config --global user.name 'Auto Update Bot'
git config --global user.email '[email protected]'
- name: "Compute nix-tools-static.nix"
if: startsWith(github.ref, 'refs/tags/')
run: |
git fetch --all
git switch --force static-nix-tools
(
echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell.nix/releases/download/${GITHUB_REF_NAME}/\"; in {"
for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do
echo " ${arch} = pkgs.fetchurl { "
echo " name = \"${arch}-nix-tools-static\";"
echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";"
echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";"
echo " };"
done
echo "}"
) > nix-tools-static.nix
cat nix-tools-static.nix
- name: Push to nix branch
if: startsWith(github.ref, 'refs/tags/')
run: |
git add nix-tools-static.nix
git commit -m "update nix-tools-static.nix"
git push origin static-nix-tools
- name: Release
uses: input-output-hk/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*-nix-tools-static.zip
10 changes: 3 additions & 7 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in rec {

tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
pkgs.recurseIntoAttrs ({
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; cabalProjectLocal = builtins.readFile ./test/cabal.project.local; };
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; };
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
hlint-latest = tool compiler-nix-name "hlint" {
inherit evalPackages;
Expand Down Expand Up @@ -91,11 +91,7 @@ in rec {
};
check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {};
check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix {
# Includes cabal-install since this is commonly used.
nix-tools = pkgs.linkFarm "common-tools" [
{ name = "nix-tools"; path = haskell.nix-tools; }
{ name = "cabal-install"; path = haskell.cabal-install.${compiler-nix-name}; }
];
nix-tools = haskell.nix-tools-unchecked; # includes cabal-install and default-setup
};
check-materialization-concurrency = pkgs.buildPackages.callPackage ./scripts/check-materialization-concurrency/check.nix {};
check-path-support = pkgsForGitHubAction.buildPackages.callPackage ./scripts/check-path-support.nix {
Expand All @@ -114,7 +110,7 @@ in rec {
# Some of the dependencies of the impure scripts so that they will
# will be in the cache too for buildkite.
inherit (pkgs.buildPackages) glibc coreutils git openssh cabal-install nix-prefetch-git;
inherit (haskell) nix-tools;
nix-tools = pkgs.haskell-nix.nix-tools-unchecked;
})
);
}
14 changes: 9 additions & 5 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ let

ghc = (if enableDWARF then (x: x.dwarf) else (x: x)) (
(if smallAddressSpace then (x: x.smallAddressSpace) else (x: x)) defaults.ghc);
setup = (if enableDWARF then (x: x.dwarf) else (x: x)) (
(if smallAddressSpace then (x: x.smallAddressSpace) else (x: x)) drvArgs.setup);
setup = (if enableDWARF then (x: x.dwarf or x) else (x: x)) (
(if smallAddressSpace then (x: x.smallAddressSpace or x) else (x: x)) drvArgs.setup);

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

enableParallelBuilding = true;

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

inherit cabalFile;
passAsFile = [ "cabalFile" ];
Expand Down Expand Up @@ -545,7 +545,7 @@ let
# we assume that if the SETUP_HS command fails and the following line was found in the error
# log, that it was the only error. Hence if we do _not_ find the line, grep will fail and this derivation
# will be marked as failure.
cat $SETUP_ERR | grep 'No executables and no library found\. Nothing to do\.'
cat $SETUP_ERR | tr '\n' ' ' | tr -d '\r' | grep 'No executables and no library found\. Nothing to do\.'
fi
''}
${lib.optionalString (haskellLib.isLibrary componentId) ''
Expand Down Expand Up @@ -635,7 +635,11 @@ let
''))
+ (lib.optionalString doCoverage ''
mkdir -p $out/share
cp -r dist/${lib.optionalString (builtins.compareVersions defaults.ghc.version "9.9" >= 0) "build/extra-compilation-artifacts/"}hpc $out/share
if [ -d dist/build/extra-compilation-artifacts ]; then
cp -r dist/build/extra-compilation-artifacts/hpc $out/share
else
cp -r dist/hpc $out/share
fi
cp dist/setup-config $out/
'')
}
Expand Down
9 changes: 5 additions & 4 deletions builder/hspkg-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ let

setup = if package.buildType == "Simple"
then
# Don't try to build default setup with DWARF enabled
let defaultSetup = ghc.defaultSetupFor package.identifier.name // {
dwarf = defaultSetup;
}; in defaultSetup
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)
then
buildPackages.haskell-nix.nix-tools-unchecked.exes.default-setup-ghcjs // { exeName = "default-setup-ghcjs"; }
else
buildPackages.haskell-nix.nix-tools-unchecked.exes.default-setup // { exeName = "default-setup"; }
else setup-builder ({
component = components.setup // {
depends = config.setup-depends ++ components.setup.depends ++ package.setup-depends;
Expand Down
1 change: 1 addition & 0 deletions builder/setup-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ let
cleanSrc = cleanSrc';
dwarf = self (drvArgs // { enableDWARF = true; });
smallAddressSpace = self (drvArgs // { smallAddressSpace = true; });
exeName = "Setup";
};

meta = {
Expand Down
46 changes: 14 additions & 32 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 18 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
url = "github:input-output-hk/stackage.nix";
flake = false;
};
nix-tools-static = {
url = "github:input-output-hk/haskell-nix-example/nix";
flake = false;
};
cabal-32 = {
url = "github:haskell/cabal/3.2";
flake = false;
Expand Down Expand Up @@ -132,7 +128,7 @@
stripAttrsForHydra
filterDerivations;

in traceHydraJobs ({
flake = {
inherit config;
overlay = self.overlays.combined;
overlays = import ./overlays { sources = inputs; };
Expand Down Expand Up @@ -247,10 +243,6 @@
inherit system;
pkgs = self.legacyPackages.${system};
src = ./nix-tools;
override-inputs = {
# Avoid downloading another `hackage.nix`.
inherit (inputs) hackage;
};
};
in cf.defaultNix.hydraJobs;
in
Expand Down Expand Up @@ -287,7 +279,23 @@
"ghc901"
"ghc921" "ghc922" "ghc923"])
);
});
}; in with (import nixpkgs { system = "x86_64-linux"; });
traceHydraJobs (lib.recursiveUpdate flake {
hydraJobs.nix-tools = pkgs.releaseTools.aggregate {
name = "nix-tools";
constituents = [
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static"
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static"
"x86_64-linux.nix-tools.static.zipped.nix-tools-static"
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64"
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd"
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd"
(writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000"))
];
};
});

# --- Flake Local Nix Configuration ----------------------------
nixConfig = {
Expand Down
Loading

0 comments on commit 365d39b

Please sign in to comment.