Simplify nixpkgs workaround (#84)

- Apply that overlay only on macOS
- Make use of the overlay system
- Update nixpkgs and haskell-flake
This commit is contained in:
Sridhar Ratnakumar 2023-02-05 14:31:22 -05:00 committed by GitHub
parent 385039139c
commit d176ed4159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 20 deletions

12
flake.lock generated
View file

@ -35,11 +35,11 @@
},
"haskell-flake": {
"locked": {
"lastModified": 1674483307,
"narHash": "sha256-NlohHWCqOsMY4q2fmKR6VAAX4y09Cr85Ezgbx4Q2hbc=",
"lastModified": 1675623979,
"narHash": "sha256-eD01oAbmfWhAVHesQrsZkGdueV7xtV1AmhGDEvJV2XA=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "8688fb2deaa193795467eedb4d2473dbeaba19b4",
"rev": "014aa621ec2e910766f8fbe03dc9638984a359eb",
"type": "github"
},
"original": {
@ -102,11 +102,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1674361931,
"narHash": "sha256-lUIZItHbW+LmJAz9V9puLq2rHlewcUgg1RPehkQIkzc=",
"lastModified": 1675584158,
"narHash": "sha256-SBkchaDzCHxnPNRDdtZ5ko5caHio9iS0Mbyn/xXbXxs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ef479383e13698c8d5ccf8a608485dc8ce1d4f80",
"rev": "d840126a0890621e7b220894d749132dd4bde6a0",
"type": "github"
},
"original": {

View file

@ -18,32 +18,41 @@
inputs.flake-root.flakeModule
inputs.mission-control.flakeModule
];
perSystem = { self', lib, config, pkgs, ... }: {
perSystem = { self', system, lib, config, pkgs, ... }: {
# The "main" project. You can have multiple projects, but this template
# has only one.
haskellProjects.main = {
packages = {
haskell-template.root = ./.;
};
buildTools = hp:
overrides =
let
# Workaround for https://github.com/NixOS/nixpkgs/issues/140774
fixCyclicReference = drv:
pkgs.haskell.lib.overrideCabal drv (_: {
enableSeparateBinOutput = false;
});
nixpkgsWorkaround =
let
disableSeparateBinOutput =
pkgs.haskell.lib.compose.overrideCabal (_: { enableSeparateBinOutput = false; });
in
{
self: super: lib.optionalAttrs (system == "aarch64-darwin") {
ghcid = disableSeparateBinOutput super.ghcid;
ormolu = disableSeparateBinOutput super.ormolu;
};
projectOverrides = self: super: {
# Add your own overrides here.
};
in
lib.composeManyExtensions [
nixpkgsWorkaround
projectOverrides
];
devShell = {
tools = hp: {
treefmt = config.treefmt.build.wrapper;
ghcid = fixCyclicReference hp.ghcid;
haskell-language-server = hp.haskell-language-server.overrideScope (lself: lsuper: {
ormolu = fixCyclicReference hp.ormolu;
});
} // config.treefmt.build.programs;
# overrides = self: super: with pkgs.haskell.lib; {};
hlsCheck.enable = false;
hlintCheck.enable = true;
};
};
# Auto formatters. This also adds a flake check to ensure that the
# source tree was auto formatted.