-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
173 lines (161 loc) · 4.96 KB
/
flake.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
description = "Track the publish dates of your favorite comics";
inputs = {
emacs-overlay = {
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
url = "github:nix-community/emacs-overlay";
};
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
pre-commit-hooks-nix = {
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
url = "github:cachix/pre-commit-hooks.nix";
};
};
outputs = inputs@{ self, emacs-overlay, flake-utils, nixpkgs, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.pre-commit-hooks-nix.flakeModule
];
flake = {
overlays = {
default =
nixpkgs.lib.composeManyExtensions
(nixpkgs.lib.attrValues
(nixpkgs.lib.filterAttrs
(n: _: n != "default")
self.overlays));
myEmacs = nixpkgs.lib.composeExtensions emacs-overlay.overlay (final: prev: {
myEmacs = prev.emacsWithPackagesFromUsePackage {
alwaysEnsure = true;
config = ./emacs.el;
};
});
};
};
systems = [
"x86_64-linux"
];
perSystem = { config, lib, pkgs, self', system, ... }: {
_module.args.pkgs = import nixpkgs {
overlays = [ self.overlays.default ];
inherit system;
};
apps = {
ComiCal = flake-utils.lib.mkApp {
drv = pkgs.haskell.lib.justStaticExecutables self'.packages.ComiCal;
};
default = self'.apps.ComiCal;
};
devShells.default = pkgs.mkShell {
FONTCONFIG_FILE = with pkgs; makeFontsConf {
fontDirectories = [
(nerdfonts.override { fonts = [ "Iosevka" ]; })
];
};
inputsFrom = [
# TODO: make this its own chunk and describe it
self'.packages.ComiCal.env
config.pre-commit.devShell
];
nativeBuildInputs = with pkgs; [
cabal-install
haskellPackages.pointfree
myEmacs
ghcid
haskell-language-server
noweb
python3Packages.pygments
(
texlive.combine {
inherit (texlive) scheme-small;
inherit noweb;
# tufte-latex and deps
inherit (texlive)
catchfile
fmtcount
framed
fvextra
hardwrap
mathpazo
titlesec
tufte-latex
xstring
;
# my preferred packages
inherit (texlive)
datetime
dirtytalk
fancyref
latexmk
minted
todonotes
xetex
;
}
)
python3Packages.pywatchman
semver-tool
coreutils
perl
];
};
packages = {
ComiCal = pkgs.haskellPackages.callCabal2nix "ComiCal" self { };
default = self'.packages.ComiCal;
};
pre-commit.settings = {
hooks = {
deadnix = {
enable = true;
settings.noLambdaArg = true;
};
hlint.enable = true;
make-srcs = {
always_run = true;
description = "Ensure literate sources are tangled";
enable = true;
entry =
let
make-srcs = pkgs.writeShellApplication {
name = "make-srcs";
runtimeInputs = with pkgs; [
coreutils
gnumake
noweb
perl
];
text = "make srcs";
};
in
"${make-srcs}/bin/make-srcs";
};
nixpkgs-fmt.enable = true;
ormolu = {
enable = true;
# TODO: create PR to add noCabal
entry =
let
inherit (config.pre-commit.settings.hooks.ormolu) settings;
extensions =
lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) settings.defaultExtensions);
noCabal = "--no-cabal";
in
lib.mkForce "${pkgs.ormolu}/bin/ormolu --mode inplace ${extensions} ${noCabal}";
settings.defaultExtensions = [
"OverloadedStrings"
"TemplateHaskell"
];
};
};
};
};
};
}