Skip to content

Instantly share code, notes, and snippets.

@rajivr
Created March 22, 2021 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajivr/6d89527939213d8b4c0794e49805506c to your computer and use it in GitHub Desktop.
Save rajivr/6d89527939213d8b4c0794e49805506c to your computer and use it in GitHub Desktop.
nix-buffer example
let
compiler = "ghc884";
currentFlake = builtins.getFlake (builtins.toString ./.);
pkgs = currentFlake.inputs.nixpkgs.legacyPackages.x86_64-linux;
in
with pkgs;
nixBufferBuilders.withPackages [
haskell.compiler.${compiler}
haskell.packages.${compiler}.cabal-install
haskell.packages.${compiler}.haskell-language-server
]
{
description = "Chapter-02 Universal constructions and the algebra of types";
inputs.nixpkgs.url = "nixpkgs/nixos-20.09";
outputs = { self, nixpkgs }: {
devShell.x86_64-linux =
let
compiler = "ghc884";
pkgs = nixpkgs.legacyPackages.x86_64-linux;
gitignore = pkgs.nix-gitignore.gitignoreSourcePure [ ./.gitignore ];
myHaskellPackages = pkgs.haskell.packages.${compiler}.override {
overrides = hself: hsuper: {
Chapter02 =
hself.callCabal2nix
"Chapter02"
(gitignore ./.)
{ };
};
};
myHaskellPackagesShell = myHaskellPackages.shellFor {
packages = p: [
p.Chapter02
];
buildInputs = [
pkgs.haskell.packages.${compiler}.cabal-install
pkgs.haskell.packages.${compiler}.haskell-language-server
pkgs.haskell.packages.${compiler}.ormolu
];
withHoogle = false;
};
in
myHaskellPackagesShell;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment