refactor(xan): Simplify build infrastructure
Simplify the build infrastructure for creating shells etc. for xanthous, including relying more heavily on stuff exposed in Depot anyway, using shellFor in the shell.nix, and using the haskell.nix branch of all-hies for a significantly simpler build. At some point the all-hies stuff will likely want to be promoted up to //third_party, but for now it's experimental enough that I don't want to bother other people with it. Change-Id: I43830de73830fdc07d48af9b87d7930f59599532 Reviewed-on: https://cl.tvl.fyi/c/depot/+/890 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: BuildkiteCI
This commit is contained in:
parent
c0922e4906
commit
6f808dfe18
5 changed files with 42 additions and 71 deletions
|
@ -1,21 +1,7 @@
|
|||
{ nixpkgs ? import ./nixpkgs.nix {}
|
||||
, pkgs ? nixpkgs.pkgs
|
||||
, lib ? nixpkgs.lib
|
||||
, compiler ? "ghc865"
|
||||
, failOnWarnings ? false
|
||||
{ pkgs ? (import ../../../. {}).third_party
|
||||
, lib ? pkgs.lib
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) id;
|
||||
inherit (pkgs) fetchurl;
|
||||
all-hies = import (fetchTarball {
|
||||
url = "https://github.com/infinisil/all-hies/archive/4b6aab017cdf96a90641dc287437685675d598da.tar.gz";
|
||||
sha256 = "0ap12mbzk97zmxk42fk8vqacyvpxk29r2wrnjqpx4m2w9g7gfdya";
|
||||
}) {};
|
||||
hie = all-hies.selection { selector = p: { inherit (p) ghc865; }; };
|
||||
xanthous =
|
||||
(if failOnWarnings then pkgs.haskell.lib.failOnAllWarnings else id)
|
||||
((pkgs.haskellPackages
|
||||
# .extend (import ./haskell-overlay.nix { inherit pkgs; })
|
||||
).callPackage (import ./pkg.nix { inherit pkgs; }) {}); in
|
||||
xanthous // { inherit hie; }
|
||||
pkgs.haskell.lib.failOnAllWarnings (
|
||||
pkgs.haskellPackages.callPackage (import ./pkg.nix { inherit pkgs; }) {}
|
||||
)
|
||||
|
|
16
users/glittershark/xanthous/hie.nix
Normal file
16
users/glittershark/xanthous/hie.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ pkgs ? (import ../../../. {}).third_party }:
|
||||
|
||||
let
|
||||
all-hies = (fetchTarball {
|
||||
url = "https://github.com/infinisil/all-hies/archive/eff5d9a5e1a84150014095494331cf63e59923af.tar.gz";
|
||||
sha256 = "19bws9fyjhgiikig86cri05fxz1wrz60n69zrigq5wzbyn4hwv9h";
|
||||
});
|
||||
|
||||
sources = import "${all-hies}/sources.nix";
|
||||
build = import "${all-hies}/build.nix";
|
||||
|
||||
in (build {
|
||||
glibcName = pkgs.glibc.name;
|
||||
inherit sources;
|
||||
ghcVersion = "8.8.3";
|
||||
}).combined
|
|
@ -1,10 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
||||
cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1
|
||||
|
||||
argv=( "$@" )
|
||||
argv=( "${argv[@]/\'/\'\\\'\'}" )
|
||||
argv=( "${argv[@]/#/\'}" )
|
||||
argv=( "${argv[@]/%/\'}" )
|
||||
|
||||
exec nix-shell --pure --run "exec $(nix-build -o dist/nix/hie -A hie)/bin/hie ${argv[*]}"
|
||||
exec nix-shell --run "$(nix-build -o dist/bin/hie hie.nix)/bin/hie $*"
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
{ pkgs ? import ./nixpkgs.nix {} }:
|
||||
let
|
||||
inherit (builtins) filterSource elem not;
|
||||
gitignoreSource = (import (pkgs.fetchFromGitHub {
|
||||
owner = "hercules-ci";
|
||||
repo = "gitignore";
|
||||
rev = "f9e996052b5af4032fe6150bba4a6fe4f7b9d698";
|
||||
sha256 = "0jrh5ghisaqdd0vldbywags20m2cxpkbbk5jjjmwaw0gr8nhsafv";
|
||||
# date = 2019-09-18T15:15:15+02:00;
|
||||
}) { inherit (pkgs) lib; }).gitignoreSource;
|
||||
in
|
||||
{ pkgs ? (import ../../../. {}).third_party }:
|
||||
|
||||
import (pkgs.haskellPackages.haskellSrc2nix {
|
||||
name = "xanthous";
|
||||
src = gitignoreSource ./.;
|
||||
src = pkgs.gitignoreSource ./.;
|
||||
extraCabal2nixOptions = "--hpack";
|
||||
})
|
||||
|
|
|
@ -1,35 +1,17 @@
|
|||
{ nixpkgs ? import ./nixpkgs.nix {}
|
||||
, pkgs ? nixpkgs.pkgs
|
||||
, compiler ? "ghc865"
|
||||
, withHoogle ? true
|
||||
}:
|
||||
let
|
||||
pkg = import ./pkg.nix { inherit pkgs; };
|
||||
{ pkgs ? (import ../../../. {}).third_party, ... }:
|
||||
|
||||
packageSet = (
|
||||
if compiler == "default"
|
||||
then pkgs.haskellPackages
|
||||
else pkgs.haskell.packages.${compiler}
|
||||
);
|
||||
(pkgs.haskellPackages.extend (pkgs.haskell.lib.packageSourceOverrides {
|
||||
xanthous = pkgs.gitignoreSource ./.;
|
||||
})).shellFor {
|
||||
packages = p: [p.xanthous];
|
||||
withHoogle = true;
|
||||
buildInputs = with pkgs.haskellPackages; [
|
||||
cabal-install
|
||||
ghc-prof-flamegraph
|
||||
hp2pretty
|
||||
];
|
||||
|
||||
haskellPackages = (
|
||||
if withHoogle
|
||||
then packageSet.override {
|
||||
overrides = (self: super: {
|
||||
ghc = super.ghc // { withPackages = super.ghc.withHoogle; };
|
||||
ghcWithPackages = self.ghc.withPackages;
|
||||
} // (import ../../../third_party/haskell_overlay { inherit pkgs; })
|
||||
self super);
|
||||
}
|
||||
else packageSet
|
||||
);
|
||||
|
||||
drv = pkgs.haskell.lib.doBenchmark (haskellPackages.callPackage pkg {});
|
||||
|
||||
inherit (pkgs.haskell.lib) addBuildTools;
|
||||
in
|
||||
(addBuildTools drv (with haskellPackages; [
|
||||
cabal-install
|
||||
ghc-prof-flamegraph
|
||||
hp2pretty
|
||||
])).env
|
||||
nativeBuildInputs = [
|
||||
(import ./hie.nix { inherit pkgs; })
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue