bf-repl/flake.nix

71 lines
1.9 KiB
Nix
Raw Permalink Normal View History

2022-10-14 01:06:22 +02:00
{
description = "My haskell project";
inputs.nixpkgs.url = "nixpkgs/nixos-22.05";
outputs = { self, nixpkgs }: let
packageName = "bf-repl";
compiler = "ghc924";
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
haskellOverlay = (final: prev: {
haskellPackages = let
hpkgs = prev.haskell.packages.${compiler};
inherit (prev.lib.trivial) flip pipe;
inherit (prev.haskell.lib)
appendPatch
appendConfigureFlags
dontCheck
dontHaddock
doJailbreak;
in hpkgs.override {
overrides = hpFinal: hpPrev: {
Cabal = hpPrev.Cabal_3_6_3_0;
text = hpPrev.text_2_0;
parsec = hpPrev.parsec_3_1_15_1;
${packageName} = doJailbreak (hpkgs.callCabal2nix packageName ./. { });
};
};
});
pkgsForAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ haskellOverlay ];
};
in f system pkgs);
in {
packages = pkgsForAllSystems (system: pkgs: {
${packageName} = pkgs.haskellPackages.${packageName};
default = self.packages.${system}.${packageName};
});
devShells = pkgsForAllSystems (system: pkgs: {
default = pkgs.haskellPackages.shellFor {
packages = p: [ p.${packageName} ];
withHoogle = false;
buildInputs = with pkgs.haskellPackages; [
cabal-install
ghcid
haskell-language-server
hlint
];
shellHook = "export PS1='\\e[1;34m[nix] ${packageName}> \\e[0m'";
};
});
apps = pkgsForAllSystems (system: pkgs: {
${packageName} = {
program = "${self.packages.${system}.${packageName}}/bin/${packageName}";
type = "app";
};
default = self.apps.${system}.${packageName};
});
hydraJobs = {
};
};
}