advent-of-code-2024/flake.nix

39 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-11-26 20:34:30 +01:00
{
description = "A Hello World for AoC";
inputs.nixpkgs.url = "nixpkgs";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-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: {
aoc24 = final.haskellPackages.callCabal2nix "aoc24" ./. {};
});
packages = forAllSystems (system: {
aoc24 = nixpkgsFor.${system}.aoc24;
});
defaultPackage = forAllSystems (system: self.packages.${system}.aoc24);
checks = self.packages;
devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskellPackages;
in haskellPackages.shellFor {
packages = p: [self.packages.${system}.aoc24];
withHoogle = true;
buildInputs = with haskellPackages; [
haskell-language-server
ghcid
cabal-install
2024-12-11 09:27:50 +01:00
fourmolu
2024-11-26 20:34:30 +01:00
];
# Change the prompt to show that you are in a devShell
shellHook = ''
hpack
'';
});
};
}