summary refs log tree commit diff
path: root/flake.nix
blob: 38ff191c448dd655b431f86799ebe940d8115916 (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
63
64
65
66
{
  description = "Scraper that can parse all of Victoria University of Wellington's courses, and output them in a computer-readable JSON file.";

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

    crane.url = "github:ipetkov/crane";
    advisory-db = {
      url = "github:rustsec/advisory-db";
      flake = false;
    };
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.rust-analyzer-src.follows = "";
    };

    git-hooks-nix.url = "github:cachix/git-hooks.nix";
    treefmt-nix.url = "github:numtide/treefmt-nix";
  };

  outputs = inputs @ {flake-parts, ...}:
    flake-parts.lib.mkFlake {inherit inputs;} {
      imports = [
        inputs.git-hooks-nix.flakeModule
        inputs.treefmt-nix.flakeModule
        ./nix/package.nix
      ];

      systems = ["x86_64-linux" "aarch64-linux"];

      perSystem = {
        config,
        pkgs,
        ...
      }: {
        devShells.default = pkgs.mkShell {
          shellHook = ''
            ${config.pre-commit.installationScript}
          '';

          buildInputs = with pkgs; [cargo-nextest];
        };

        pre-commit.settings.hooks = {
          alejandra.enable = true;
          editorconfig-checker = {
            args = ["--config" ".editorconfig-checker.json"];
            enable = true;
          };
        };

        treefmt = {
          flakeFormatter = true;
          programs = {
            alejandra.enable = true;
            just.enable = true;
            rustfmt.enable = true;
            taplo.enable = true;
          };
          projectRootFile = "flake.nix";
        };
      };
    };
}