advent-of-code-2023/flake.nix

38 lines
1.2 KiB
Nix
Raw Normal View History

2023-12-23 22:49:47 +01:00
{
description = "A Hello World for AoC";
inputs.nixpkgs.url = "nixpkgs";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
overlay = (final: prev: {
aoc23 = final.haskellPackages.callCabal2nix "aoc23" ./. {};
});
packages = forAllSystems (system: {
aoc23 = nixpkgsFor.${system}.aoc23;
});
defaultPackage = forAllSystems (system: self.packages.${system}.aoc23);
checks = self.packages;
devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskellPackages;
in haskellPackages.shellFor {
packages = p: [self.packages.${system}.aoc23];
withHoogle = true;
buildInputs = with haskellPackages; [
haskell-language-server
ghcid
cabal-install
];
# Change the prompt to show that you are in a devShell
shellHook = ''
hpack
'';
});
};
}