Merge pull request #5 from srid/magthe

Improvements from @magthe's blog post
This commit is contained in:
Sridhar Ratnakumar 2022-03-17 11:41:59 -04:00 committed by GitHub
commit 7b7e26c83a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

3
.gitignore vendored
View file

@ -23,3 +23,6 @@ cabal.project.local~
.ghc.environment.*
result
result-*
# direnv
.direnv

8
flake.lock generated
View file

@ -33,17 +33,17 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1645013224,
"narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=",
"lastModified": 1647350163,
"narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970",
"rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970",
"rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d",
"type": "github"
}
},

View file

@ -1,7 +1,7 @@
{
description = "haskell-template's description";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/b66b39216b1fef2d8c33cc7a5c72d8da80b79970";
nixpkgs.url = "github:nixos/nixpkgs/3eb07eeafb52bcbf02ce800f032f18d666a9498d";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
flake-compat.url = "github:edolstra/flake-compat";
@ -11,12 +11,13 @@
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ ];
pkgs =
import nixpkgs { inherit system overlays; config.allowBroken = true; };
# Because: https://zimbatm.com/notes/1000-instances-of-nixpkgs
pkgs = nixpkgs.legacyPackages.${system};
# Change GHC version here. To get the appropriate value, run:
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
project = returnShellEnv:
hp.developPackage {
inherit returnShellEnv;
@ -31,13 +32,14 @@
# Assumes that you have the 'NanoID' flake input defined.
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hp; [
pkgs.haskell.lib.addBuildTools drv (with hp; pkgs.lib.lists.optionals returnShellEnv [
# Specify your build/dev dependencies here.
cabal-fmt
cabal-install
ghcid
haskell-language-server
ormolu
hlint
pkgs.nixpkgs-fmt
]);
};