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 ? (import ../../../. {}).third_party
|
||||||
, pkgs ? nixpkgs.pkgs
|
, lib ? pkgs.lib
|
||||||
, lib ? nixpkgs.lib
|
|
||||||
, compiler ? "ghc865"
|
|
||||||
, failOnWarnings ? false
|
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
pkgs.haskell.lib.failOnAllWarnings (
|
||||||
inherit (lib) id;
|
pkgs.haskellPackages.callPackage (import ./pkg.nix { inherit pkgs; }) {}
|
||||||
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; }
|
|
||||||
|
|
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
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1
|
||||||
|
|
||||||
argv=( "$@" )
|
exec nix-shell --run "$(nix-build -o dist/bin/hie hie.nix)/bin/hie $*"
|
||||||
argv=( "${argv[@]/\'/\'\\\'\'}" )
|
|
||||||
argv=( "${argv[@]/#/\'}" )
|
|
||||||
argv=( "${argv[@]/%/\'}" )
|
|
||||||
|
|
||||||
exec nix-shell --pure --run "exec $(nix-build -o dist/nix/hie -A hie)/bin/hie ${argv[*]}"
|
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
{ pkgs ? import ./nixpkgs.nix {} }:
|
{ pkgs ? (import ../../../. {}).third_party }:
|
||||||
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
|
|
||||||
import (pkgs.haskellPackages.haskellSrc2nix {
|
import (pkgs.haskellPackages.haskellSrc2nix {
|
||||||
name = "xanthous";
|
name = "xanthous";
|
||||||
src = gitignoreSource ./.;
|
src = pkgs.gitignoreSource ./.;
|
||||||
extraCabal2nixOptions = "--hpack";
|
extraCabal2nixOptions = "--hpack";
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,35 +1,17 @@
|
||||||
{ nixpkgs ? import ./nixpkgs.nix {}
|
{ pkgs ? (import ../../../. {}).third_party, ... }:
|
||||||
, pkgs ? nixpkgs.pkgs
|
|
||||||
, compiler ? "ghc865"
|
|
||||||
, withHoogle ? true
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
pkg = import ./pkg.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
packageSet = (
|
(pkgs.haskellPackages.extend (pkgs.haskell.lib.packageSourceOverrides {
|
||||||
if compiler == "default"
|
xanthous = pkgs.gitignoreSource ./.;
|
||||||
then pkgs.haskellPackages
|
})).shellFor {
|
||||||
else pkgs.haskell.packages.${compiler}
|
packages = p: [p.xanthous];
|
||||||
);
|
withHoogle = true;
|
||||||
|
buildInputs = with pkgs.haskellPackages; [
|
||||||
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
|
cabal-install
|
||||||
ghc-prof-flamegraph
|
ghc-prof-flamegraph
|
||||||
hp2pretty
|
hp2pretty
|
||||||
])).env
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
(import ./hie.nix { inherit pkgs; })
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue