tronly-typed/flake.nix

58 lines
1.9 KiB
Nix

{
description = "Dev Setup";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = {nixpkgs, flake-utils, ...}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# Avoids unnecessary recompiles
filteredSource = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type:
let baseName = baseNameOf (toString path);
in pkgs.lib.cleanSourceFilter path type && !(
baseName == "flake.nix" ||
baseName == "flake.lock" ||
baseName == "dist-newstyle" ||
builtins.match "^cabal\.project\..*$" baseName != null ||
baseName == "hls.sh" ||
baseName == ".envrc" ||
baseName == "hie.yaml" ||
baseName == ".hlint.yaml" ||
baseName == ".hspec" ||
baseName == "ci"
);
};
ghcOverrides = hself: hsuper: rec {
tronly-typed = pkgs.haskell.lib.overrideSrc (hsuper.callPackage ./default.nix {}) {
src = filteredSource;
};
};
ghc96Pkgs = pkgs.haskell.packages.ghc96.override {
overrides = ghcOverrides;
};
in rec {
packages = rec {
dev-env = ghc96Pkgs.shellFor {
packages = p: [p.tronly-typed];
buildInputs = [
pkgs.haskellPackages.cabal-install
pkgs.haskell-language-server
pkgs.haskellPackages.implicit-hie
pkgs.cabal2nix
pkgs.ormolu
# For cabal
pkgs.pkg-config
pkgs.binutils
];
};
tronly-typed = ghc96Pkgs.tronly-typed;
};
defaultPackage = packages.tronly-typed;
});
}