atagen

roundabout

public
Star0
Watch0
93b435e669a5f6986da74da157a887bf25f9007a
1
ssh://brewery@pls.lobotomise.me:33/atagen/roundabout.git
flake.nixNix87 lines2.1 KB
1
{
2
  description = "one build at a time, please";
3
4
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5
6
  outputs =
7
    { self, nixpkgs }:
8
    let
9
      inherit (nixpkgs) lib;
10
      forAllSystems = lib.genAttrs [
11
        "x86_64-linux"
12
        "aarch64-linux"
13
        "x86_64-darwin"
14
        "aarch64-darwin"
15
      ];
16
      pkgsFor = system: nixpkgs.legacyPackages.${system};
17
    in
18
    {
19
      packages = forAllSystems (
20
        system:
21
        let
22
          pkgs = pkgsFor system;
23
          roundabout = pkgs.callPackage ./nix/package.nix { };
24
        in
25
        {
26
          inherit roundabout;
27
          default = roundabout;
28
          plugin = pkgs.callPackage ./nix/plugin.nix { inherit roundabout; };
29
        }
30
      );
31
32
      devShells = forAllSystems (
33
        system:
34
        let
35
          pkgs = pkgsFor system;
36
        in
37
        {
38
          default = pkgs.mkShell {
39
            packages = [
40
              pkgs.cargo
41
              pkgs.rustc
42
              pkgs.clippy
43
              pkgs.rustfmt
44
              pkgs.rust-analyzer
45
            ];
46
            env.RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
47
          };
48
        }
49
      );
50
51
      checks = forAllSystems (
52
        system:
53
        let
54
          pkgs = pkgsFor system;
55
          roundabout = self.packages.${system}.roundabout;
56
        in
57
        {
58
          inherit roundabout;
59
          plugin = self.packages.${system}.plugin;
60
          clippy = roundabout.overrideAttrs (old: {
61
            pname = "roundabout-clippy";
62
            nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];
63
            buildPhase = ''
64
              runHook preBuild
65
              cargo clippy --offline --all-targets -- -D warnings
66
              runHook postBuild
67
            '';
68
            doCheck = false;
69
            installPhase = "touch $out";
70
          });
71
          fmt =
72
            pkgs.runCommand "roundabout-fmt"
73
              {
74
                nativeBuildInputs = [
75
                  pkgs.cargo
76
                  pkgs.rustfmt
77
                ];
78
              }
79
              ''
80
                cd ${self}
81
                cargo fmt --check
82
                touch $out
83
              '';
84
        }
85
      );
86
    };
87
}