Cabal init

This commit is contained in:
2025-10-08 10:07:00 +02:00
parent ff82290cef
commit 93c680a033
8 changed files with 253 additions and 1 deletions

79
flake.nix Normal file
View File

@ -0,0 +1,79 @@
{
description = "Estinien goes flakes";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
nixConfig.allow-import-from-derivation = true; # cabal2nix uses IFD
outputs = { self, nixpkgs, flake-utils }:
let
ghcVer = "ghc910";
makeHaskellOverlay = overlay: final: prev: {
haskell = prev.haskell // {
packages = prev.haskell.packages // {
${ghcVer} = prev.haskell.packages."${ghcVer}".override (oldArgs: {
overrides =
prev.lib.composeExtensions (oldArgs.overrides or (_: _: { }))
(overlay prev);
});
};
};
};
out = system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowBroken = true;
};
in
{
packages = rec {
default = estinien;
estinien = pkgs.haskell.packages.${ghcVer}.estinien;
};
checks = {
inherit (self.packages.${system}) estinien;
};
# for debugging
# inherit pkgs;
devShells.default =
let haskellPackages = pkgs.haskell.packages.${ghcVer};
in
haskellPackages.shellFor {
packages = p: [ self.packages.${system}.estinien ];
withHoogle = true;
buildInputs =
(with pkgs; [
zlib
]) ++
(with haskellPackages; [
haskell-language-server
cabal-install
]);
# Change the prompt to show that you are in a devShell
# shellHook = "export PS1='\\e[1;34mdev > \\e[0m'";
};
};
in
flake-utils.lib.eachDefaultSystem out // {
# this stuff is *not* per-system
overlays = {
default = makeHaskellOverlay (prev: hfinal: hprev:
let hlib = prev.haskell.lib; in
{
estinien = hprev.callCabal2nix "estinien" ./. { };
rando = hlib.dontCheck hprev.rando;
});
};
};
}