forked from NixOS/nixfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
71 lines (64 loc) · 1.41 KB
/
default.nix
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
# © 2019 Serokell <[email protected]>
# © 2019 Lars Jellema <[email protected]>
# © 2024 Silvan Mosberger <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0
let
sources = import ./npins;
in
{
system ? builtins.currentSystem,
nixpkgs ? sources.nixpkgs,
serokell-nix ? sources.serokell-nix,
}:
let
overlay = self: super: {
haskell = super.haskell // {
packageOverrides = self: super: { nixfmt = self.callCabal2nix "nixfmt" src { }; };
};
};
pkgs = import nixpkgs {
inherit system;
overlays = [
overlay
(import (serokell-nix + "/overlay"))
];
config = { };
};
inherit (pkgs) haskell lib;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./nixfmt.cabal
./src
./main
./LICENSE
];
};
build = lib.pipe pkgs.haskellPackages.nixfmt [
haskell.lib.justStaticExecutables
haskell.lib.dontHaddock
(drv: lib.lazyDerivation { derivation = drv; })
];
in
build
// {
packages = {
nixfmt = build;
inherit (pkgs) reuse;
};
shell = pkgs.haskellPackages.shellFor {
packages = p: [ p.nixfmt ];
nativeBuildInputs = with pkgs; [
cabal-install
stylish-haskell
haskellPackages.haskell-language-server
shellcheck
npins
];
};
checks = {
hlint = pkgs.build.haskell.hlint ./.;
stylish-haskell = pkgs.build.haskell.stylish-haskell ./.;
};
}