Skip to content

Instantly share code, notes, and snippets.

@pwm
Last active March 25, 2024 13:14
Show Gist options
  • Save pwm/1380feaa134ec7f7d99d8b34a07908ad to your computer and use it in GitHub Desktop.
Save pwm/1380feaa134ec7f7d99d8b34a07908ad to your computer and use it in GitHub Desktop.
Drop-in devshell
# https://gist.github.com/pwm/1380feaa134ec7f7d99d8b34a07908ad
#
# Copy this file into the root dir of the project and run `nix-shell`
#
{ compiler ? "ghc948" }:
let
pkgs = import
(builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/f8e2ebd66d097614d51a56a755450d4ae1632df1.tar.gz";
sha256 = "03cxv9h218dj7kc5hb0yrclshgbq20plyrvnfdaw5payyy9gbsfr";
})
{
config.allowBroken = false; # flip to true if needed
config.allowUnfree = false; # flip to true if needed
};
gitignoreSrc = import
(pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore";
rev = "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5";
sha256 = "1rlja3ba9s1n0icy3aarwhx9hk1jyfgngzizbn1afwwdlpvdlqw0";
})
{ };
ourGHC = pkgs.haskell.packages.${compiler};
in
ourGHC.developPackage {
name = builtins.baseNameOf ./.;
root = gitignoreSrc.gitignoreSource ./.;
overrides = final: prev: { };
source-overrides = { };
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
buildTools = (attrs.buildTools or [ ]) ++ [
ourGHC.cabal-install
ourGHC.cabal2nix
ourGHC.haskell-language-server
# add more stuff here if needed in the shell
];
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment