atagen

roundabout

public
Star0
Watch0
caac091f257ad8d53409925aac0d377b716994f8
1
ssh://brewery@pls.lobotomise.me:33/atagen/roundabout.git
flake.nixNix94 lines2.6 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
      nixosModules.default = import ./nix/nixos-module.nix self;
20
21
      packages = forAllSystems (
22
        system:
23
        let
24
          pkgs = pkgsFor system;
25
          roundabout = pkgs.callPackage ./nix/package.nix { };
26
        in
27
        {
28
          inherit roundabout;
29
          default = roundabout;
30
          plugin = pkgs.callPackage ./nix/plugin.nix { inherit roundabout; };
31
          codex-plugin = pkgs.callPackage ./nix/codex-plugin.nix { inherit roundabout; };
32
          omp-plugin = pkgs.callPackage ./nix/omp-plugin.nix { inherit roundabout; };
33
        }
34
      );
35
36
      devShells = forAllSystems (
37
        system:
38
        let
39
          pkgs = pkgsFor system;
40
        in
41
        {
42
          default = pkgs.mkShell {
43
            packages = [
44
              pkgs.cargo
45
              pkgs.rustc
46
              pkgs.clippy
47
              pkgs.rustfmt
48
              pkgs.rust-analyzer
49
            ];
50
            env.RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
51
          };
52
        }
53
      );
54
55
      checks = forAllSystems (
56
        system:
57
        let
58
          pkgs = pkgsFor system;
59
          roundabout = self.packages.${system}.roundabout;
60
        in
61
        {
62
          inherit roundabout;
63
          plugin = self.packages.${system}.plugin;
64
          codex-plugin = self.packages.${system}.codex-plugin;
65
          omp-plugin = self.packages.${system}.omp-plugin;
66
          omp-hooks = pkgs.callPackage ./nix/omp-tests.nix { inherit roundabout; };
67
          clippy = roundabout.overrideAttrs (old: {
68
            pname = "roundabout-clippy";
69
            nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];
70
            buildPhase = ''
71
              runHook preBuild
72
              cargo clippy --offline --all-targets -- -D warnings
73
              runHook postBuild
74
            '';
75
            doCheck = false;
76
            installPhase = "touch $out";
77
          });
78
          fmt =
79
            pkgs.runCommand "roundabout-fmt"
80
              {
81
                nativeBuildInputs = [
82
                  pkgs.cargo
83
                  pkgs.rustfmt
84
                ];
85
              }
86
              ''
87
                cd ${self}
88
                cargo fmt --check
89
                touch $out
90
              '';
91
        }
92
      );
93
    };
94
}