adventofcode/2022/default.nix
2022-12-03 10:02:56 +01:00

38 lines
841 B
Nix

{
pkgs ? import <nixpkgs> {},
hc ? "ghc924"
}:
pkgs.stdenv.mkDerivation rec {
name = "aoc-2022";
buildInputs = [
pkgs.haskell.compiler.${hc}
pkgs.haskellPackages.split
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 "";
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
'';
}