-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathflake.nix
More file actions
85 lines (76 loc) · 2.01 KB
/
Copy pathflake.nix
File metadata and controls
85 lines (76 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# SPDX-FileCopyrightText: 2021 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: CC0-1.0
{
description = "My haskell application";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
let
# Default GHC version used for the default package outputs
defaultGhcVersion = "ghc963";
# Name of package
packageName = "static-ls";
# Function to create packages for a given GHC version
mkNixPkgs =
{
system,
ghcVersion,
}:
import nixpkgs {
inherit system;
overlays = [
(import ./nix/overlays ghcVersion)
];
};
# Given a pkg set, build static-ls
mkPackage =
pkgs:
pkgs.haskell.lib.dontCheck (
pkgs.haskellPackages.callCabal2nix packageName self rec {
# Dependency overrides go here
}
);
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = mkNixPkgs {
inherit system;
ghcVersion = defaultGhcVersion;
};
package = mkPackage pkgs;
in
{
packages.${packageName} = package;
packages.default = package;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
pkgs.haskell.packages.${pkgs.ghcVersion}.haskell-language-server # you must build it with your ghc to work
haskellPackages.fourmolu
haskellPackages.hiedb
sqlite
ghcid
cabal-install
alejandra
];
inputsFrom = [ package.env ];
shellHook = "PS1=\"[static-ls:\\w]$ \"";
};
# Expose a function that consumers can use to build with their desired
# GHC version
lib.mkPackage =
{ ghcVersion }:
(mkPackage (mkNixPkgs {
inherit system ghcVersion;
}));
}
);
}