-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
102 lines (91 loc) · 2.79 KB
/
Copy pathflake.nix
File metadata and controls
102 lines (91 loc) · 2.79 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
description = "blog.galowicz.de static page generator";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};
outputs =
{ self
, flake-parts
, nixpkgs
, pre-commit-hooks
}:
flake-parts.lib.mkFlake { inherit self; } {
systems = [ "x86_64-linux" ];
perSystem = { config, system, ... }:
let
pkgs = nixpkgs.legacyPackages.${system};
haskellSrc = pkgs.lib.sourceByRegex ./. [
"^LICENSE$"
"^Setup.hs$"
"^blog.cabal$"
"^src.*"
];
inherit (pkgs) haskellPackages;
blog-generator = pkgs.haskellPackages.callCabal2nix "blog" haskellSrc { };
blogSrc = pkgs.lib.sourceByRegex ./. [
"^css.*"
"^images.*"
"^posts.*"
"^templates.*"
"^.*\.md"
];
release = pkgs.stdenv.mkDerivation {
name = "blog.galowicz.de-content";
src = blogSrc;
buildInputs = [ blog-generator ];
LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
buildPhase = ''
blog-generator clean
blog-generator build
'';
installPhase = ''
cp -r _site $out
'';
};
in
{
packages = {
inherit blog-generator release;
default = release;
};
devShells.default = haskellPackages.shellFor {
packages = _: [ blog-generator ];
buildInputs = with pkgs; [
cabal-install
ghcid
hlint
nixpkgs-fmt
nodePackages.markdownlint-cli
];
# `hoogle server --local`
withHoogle = true;
shellHook = ''
${config.checks.pre-commit-check.shellHook}
'';
};
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
brittany.enable = true;
cabal-fmt.enable = true;
cspell = {
enable = true;
entry = "${pkgs.nodePackages.cspell}/bin/cspell --words-only";
types = [ "markdown" ];
excludes = [ "impressum.md" "datenschutz.md" ];
};
deadnix.enable = true;
nixpkgs-fmt.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
statix.enable = true;
};
};
};
};
};
}