Skip to content

Commit 7b394aa

Browse files
committed
feat: nix flake update, add pandoc & nixfmt
1 parent 13f7422 commit 7b394aa

File tree

3 files changed

+86
-77
lines changed

3 files changed

+86
-77
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ TODOs.md
2121
.direnv/
2222
.pre-commit-config.yaml
2323
.temp
24-
*.epub
24+
*.epub

flake.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 73 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,79 +7,88 @@
77
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
88
};
99

10-
outputs = {
11-
self,
12-
nixpkgs,
13-
flake-utils,
14-
pre-commit-hooks,
15-
}:
16-
flake-utils.lib.eachDefaultSystem (system: let
17-
overlays = [
18-
(self: super: rec {
19-
nodejs = super.nodejs_22;
20-
pnpm = super.pnpm.override {inherit nodejs;};
21-
yarn = super.yarn.override {inherit nodejs;};
22-
prettier = super.nodePackages.prettier;
23-
})
24-
];
25-
pkgs = import nixpkgs {inherit overlays system;};
26-
pkgs_chromium = import nixpkgs {inherit system;};
27-
packages = with pkgs; [
28-
nodejs
29-
pnpm
30-
yarn
31-
prettier
10+
outputs =
11+
{
12+
self,
13+
nixpkgs,
14+
flake-utils,
15+
pre-commit-hooks,
16+
}:
17+
flake-utils.lib.eachDefaultSystem (
18+
system:
19+
let
20+
overlays = [
21+
(self: super: rec {
22+
nodejs = super.nodejs_22;
23+
pnpm = super.pnpm.override { inherit nodejs; };
24+
yarn = super.yarn.override { inherit nodejs; };
25+
prettier = super.nodePackages.prettier;
26+
})
27+
];
28+
pkgs = import nixpkgs { inherit overlays system; };
29+
pkgs_chromium = import nixpkgs { inherit system; };
30+
packages = with pkgs; [
31+
nodejs
32+
pnpm
33+
yarn
34+
prettier
3235

33-
git
34-
typos
35-
alejandra
36-
];
37-
in {
38-
checks = {
39-
pre-commit-check = pre-commit-hooks.lib.${system}.run {
40-
src = ./.;
41-
hooks = {
42-
alejandra.enable = true; # formatter
43-
# Source code spell checker
44-
typos = {
45-
enable = true;
46-
settings = {
47-
write = true; # Automatically fix typos
48-
ignored-words = [];
49-
# configPath = "./.typos.toml"; # relative to the flake root
36+
git
37+
typos
38+
nixfmt
39+
pandoc
40+
];
41+
in
42+
{
43+
checks = {
44+
pre-commit-check = pre-commit-hooks.lib.${system}.run {
45+
src = ./.;
46+
hooks = {
47+
nixfmt-rfc-style = {
48+
enable = true;
49+
settings.width = 100;
5050
};
51-
};
52-
prettier = {
53-
enable = true;
54-
settings = {
55-
write = true; # Automatically format files
56-
configPath = "./.prettierrc.yaml"; # relative to the flake root
51+
# Source code spell checker
52+
typos = {
53+
enable = true;
54+
settings = {
55+
write = true; # Automatically fix typos
56+
# configPath = ".typos.toml"; # relative to the flake root
57+
# exclude = "";
58+
};
59+
};
60+
prettier = {
61+
enable = true;
62+
settings = {
63+
write = true; # Automatically format files
64+
configPath = ".prettierrc.yaml"; # relative to the flake root
65+
};
5766
};
5867
};
5968
};
6069
};
61-
};
6270

63-
devShells.default = pkgs.mkShell {
64-
inherit packages;
71+
devShells.default = pkgs.mkShell {
72+
inherit packages;
6573

66-
shellHook = ''
67-
echo "node `node --version`"
68-
${self.checks.${system}.pre-commit-check.shellHook}
69-
'';
70-
};
74+
shellHook = ''
75+
echo "node `node --version`"
76+
${self.checks.${system}.pre-commit-check.shellHook}
77+
'';
78+
};
7179

72-
devShells.export-pdf = pkgs.mkShell {
73-
inherit packages;
80+
devShells.export-pdf = pkgs.mkShell {
81+
inherit packages;
7482

75-
shellHook = ''
76-
echo "node `node --version`"
83+
shellHook = ''
84+
echo "node `node --version`"
7785
78-
# Set Puppeteer to not download Chrome, cause it doesn't work on NixOS
79-
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
80-
# Set Puppeteer to use Chromium from Nixpkgs
81-
export PUPPETEER_EXECUTABLE_PATH=${pkgs_chromium.chromium.outPath}/bin/chromium
82-
'';
83-
};
84-
});
86+
# Set Puppeteer to not download Chrome, cause it doesn't work on NixOS
87+
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
88+
# Set Puppeteer to use Chromium from Nixpkgs
89+
export PUPPETEER_EXECUTABLE_PATH=${pkgs_chromium.chromium.outPath}/bin/chromium
90+
'';
91+
};
92+
}
93+
);
8594
}

0 commit comments

Comments
 (0)