|
7 | 7 | pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; |
8 | 8 | }; |
9 | 9 |
|
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 |
32 | 35 |
|
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; |
50 | 50 | }; |
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 | + }; |
57 | 66 | }; |
58 | 67 | }; |
59 | 68 | }; |
60 | 69 | }; |
61 | | - }; |
62 | 70 |
|
63 | | - devShells.default = pkgs.mkShell { |
64 | | - inherit packages; |
| 71 | + devShells.default = pkgs.mkShell { |
| 72 | + inherit packages; |
65 | 73 |
|
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 | + }; |
71 | 79 |
|
72 | | - devShells.export-pdf = pkgs.mkShell { |
73 | | - inherit packages; |
| 80 | + devShells.export-pdf = pkgs.mkShell { |
| 81 | + inherit packages; |
74 | 82 |
|
75 | | - shellHook = '' |
76 | | - echo "node `node --version`" |
| 83 | + shellHook = '' |
| 84 | + echo "node `node --version`" |
77 | 85 |
|
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 | + ); |
85 | 94 | } |
0 commit comments