Skip to content

Commit

Permalink
build: add flake.nix
Browse files Browse the repository at this point in the history
run `nix develop` to get a development environment
  • Loading branch information
Matthieu Coudron committed Dec 16, 2021
1 parent 8aeef87 commit b885943
Show file tree
Hide file tree
Showing 2 changed files with 263 additions and 0 deletions.
195 changes: 195 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
description = "My haskell library";

nixConfig = {
extra-substituters = [
"https://haskell-language-server.cachix.org"
];
extra-trusted-public-keys = [
"haskell-language-server.cachix.org-1:juFfHrwkOxqIOZShtC4YC1uT1bBcq2RSvC7OMKx0Nz8="
];
};

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

flake-utils.url = "github:numtide/flake-utils";

hls.url = "github:haskell/haskell-language-server/854d2c5a1aa3095c93e3f38ef3731be89b4ab09a";

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, hls, ... }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let

compilerVersion = "8107";

haskellOverlay = hnew: hold: with pkgs.haskell.lib; {
};

pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = false; allowBroken = true;};
};

hsPkgs = pkgs.haskell.packages."ghc${compilerVersion}";

# modifier used in haskellPackages.developPackage
myModifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hsPkgs; [
cabal-install
hls.packages.${system}."haskell-language-server-${compilerVersion}"
pkgs.openssl.dev
pkgs.zlib
]);

mkPackage =
hsPkgs.developPackage {
root = pkgs.lib.cleanSource ./. ;
name = "cabal2nix";
returnShellEnv = false;
withHoogle = true;
overrides = haskellOverlay;
modifier = myModifier;
};

in {
packages = {
cabal2nix = self.packages.${system}.cabal2nix-8107;
cabal2nix-8107 = mkPackage;
};

defaultPackage = self.packages.${system}.cabal2nix;
});
}

0 comments on commit b885943

Please sign in to comment.