/ flake.nix
flake.nix
 1  {
 2    description = "blog.mulatta.io";
 3  
 4    outputs =
 5      inputs@{ flake-parts, ... }:
 6      flake-parts.lib.mkFlake { inherit inputs; } {
 7        systems = import inputs.systems;
 8  
 9        imports = [
10          ./nix/shell.nix
11          ./nix/formatter.nix
12          ./nix/packages.nix
13        ];
14  
15        perSystem =
16          {
17            pkgs,
18            lib,
19            self',
20            system,
21            ...
22          }:
23          {
24            _module.args.pkgs = import inputs.nixpkgs {
25              inherit system;
26              config.allowUnfree = true;
27            };
28  
29            checks =
30              let
31                packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
32                devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
33              in
34              {
35                inherit (self') formatter;
36              }
37              // packages
38              // devShells
39              // {
40                link-check = pkgs.testers.lycheeLinkCheck {
41                  site = self'.packages.blog;
42                  remap = {
43                    "https://blog.mulatta.io/" = "${self'.packages.blog}/";
44                  };
45                  extraConfig = {
46                    base = "https://blog.mulatta.io/";
47                    root_dir = "${self'.packages.blog}";
48                    index_files = [ "index.html" ];
49                    exclude_path = [
50                      ".*/tags/.*"
51                      ".*/categories/.*"
52                    ];
53                  };
54                };
55              };
56          };
57      };
58  
59    inputs = {
60      # keep-sorted start
61      flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
62      flake-parts.url = "github:hercules-ci/flake-parts";
63      nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
64      systems.url = "github:nix-systems/default";
65      treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
66      treefmt-nix.url = "github:numtide/treefmt-nix";
67      # keep-sorted end
68    };
69  }