2022-12-01 21:14:46 +01:00
|
|
|
{
|
|
|
|
pkgs ? import <nixpkgs> {},
|
2022-12-06 09:10:54 +01:00
|
|
|
hc ? "ghc923"
|
2022-12-01 21:14:46 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
pkgs.stdenv.mkDerivation rec {
|
|
|
|
name = "aoc-2022";
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.haskell.compiler.${hc}
|
2022-12-03 10:02:56 +01:00
|
|
|
pkgs.haskellPackages.split
|
2022-12-01 21:14:46 +01:00
|
|
|
pkgs.git
|
|
|
|
pkgs.zlib
|
|
|
|
pkgs.cabal-install
|
|
|
|
pkgs.pkgconfig
|
|
|
|
pkgs.which
|
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH
|
|
|
|
export LANG=en_US.UTF-8
|
|
|
|
'';
|
|
|
|
LOCALE_ARCHIVE =
|
|
|
|
if pkgs.stdenv.isLinux
|
|
|
|
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
|
|
|
|
else "";
|
2022-12-01 22:28:05 +01:00
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
# This currently doesn't work yet.
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$TMP
|
|
|
|
mkdir -p $TMP/.cabal $out/bin
|
|
|
|
cp cabal.config $TMP/.cabal/config
|
|
|
|
cabal build
|
|
|
|
ln -s dist-newstyle/build/x86_64-linux/ghc-9.2.4/aoc2022-0.1.0.0/x/aoc2022/build/aoc2022/aoc2022 $out/bin/aoc2022
|
|
|
|
'';
|
|
|
|
|
2022-12-01 21:14:46 +01:00
|
|
|
}
|
|
|
|
|