summaryrefslogtreecommitdiffstatshomepage
path: root/flake.nix
blob: 0a4ada0d55fc7c9306c41af1f7b947f806bd9e5e (plain) (blame)
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
{
  description = "workspace configuration for git-bug";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    flake-parts.url = "github:hercules-ci/flake-parts";

    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # A workaround for the currently-broken mdformat packages
    fmt-pkgs.url = "github:nixos/nixpkgs/b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef";
  };

  outputs =
    { nixpkgs, ... }@inputs:
    let
      systems = inputs.flake-utils.lib.defaultSystems;
    in
    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
      inherit systems;

      imports = [ inputs.treefmt-nix.flakeModule ];

      perSystem =
        { pkgs, system, ... }:
        let
          fp = inputs.fmt-pkgs.legacyPackages.${system};
        in
        {
          treefmt = import ./treefmt.nix { pkgs = fp; };

          checks = pkgs.lib.attrsets.mapAttrs' (f: _: {
            name = pkgs.lib.strings.removeSuffix ".nix" f;
            value = import ./nix/checks/${f} {
              inherit pkgs;
              src = ./.;
            };
          }) (pkgs.lib.attrsets.filterAttrs (_: t: t == "regular") (builtins.readDir ./nix/checks));

          devShells.default = pkgs.mkShell {
            packages = with pkgs; [
              codespell
              delve
              gh
              git
              git-cliff
              go
              golangci-lint
              gopls
              nodejs
              pinact
            ];

            shellHook = builtins.readFile ./flake-hook.bash;
          };
        };
    };
}