|
17 | 17 | let |
18 | 18 | inherit (nixpkgs) lib; |
19 | 19 | eachSystem = f: lib.genAttrs lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.${system}); |
| 20 | + |
| 21 | + src = lib.cleanSourceWith { |
| 22 | + filter = path: _type: !lib.hasSuffix ".nix" path; |
| 23 | + src = lib.cleanSource ./.; |
| 24 | + }; |
| 25 | + |
| 26 | + formattingOptions = { |
| 27 | + projectRootFile = "flake.lock"; |
| 28 | + programs = { |
| 29 | + nixpkgs-fmt.enable = true; |
| 30 | + rustfmt.enable = true; |
| 31 | + taplo.enable = true; |
| 32 | + yamlfmt.enable = true; |
| 33 | + mdformat.enable = true; |
| 34 | + }; |
| 35 | + }; |
20 | 36 | in |
21 | 37 | { |
22 | 38 | checks = eachSystem (pkgs: { |
23 | 39 | azure-node-bindings = pkgs.rustPlatform.buildRustPackage { |
| 40 | + inherit src; |
24 | 41 | name = "azure-node-bindings"; |
25 | | - src = lib.cleanSourceWith { |
26 | | - filter = path: _type: !lib.hasSuffix ".nix" path; |
27 | | - src = lib.cleanSource ./.; |
28 | | - }; |
29 | 42 | cargoLock.lockFile = ./Cargo.lock; |
30 | 43 | doCheck = true; |
31 | 44 | nativeCheckInputs = with pkgs; [ cargo rustc clippy rustfmt ]; |
|
36 | 49 | }; |
37 | 50 |
|
38 | 51 | docs = pkgs.rustPlatform.buildRustPackage { |
39 | | - pname = "azure-node-bindings-docs"; |
40 | | - version = "0.1.0"; |
41 | | - src = lib.cleanSourceWith { |
42 | | - filter = path: _type: !lib.hasSuffix ".nix" path; |
43 | | - src = lib.cleanSource ./.; |
44 | | - }; |
| 52 | + inherit src; |
| 53 | + name = "azure-node-bindings-docs"; |
45 | 54 | cargoLock.lockFile = ./Cargo.lock; |
46 | 55 | buildPhase = "cargo doc --no-deps"; |
47 | 56 | installPhase = '' |
|
51 | 60 | ''; |
52 | 61 | doCheck = false; |
53 | 62 | }; |
| 63 | + |
| 64 | + fmt = |
| 65 | + let |
| 66 | + treefmt = |
| 67 | + let |
| 68 | + treefmt = import inputs.treefmt; |
| 69 | + in |
| 70 | + treefmt.evalModule pkgs formattingOptions; |
| 71 | + in |
| 72 | + treefmt.config.build.check ./.; |
54 | 73 | } // lib.optionalAttrs pkgs.stdenv.isLinux { |
55 | 74 | nixos-azurite = import ./nixos/modules/azurite/test.nix { inherit pkgs self lib; }; |
56 | 75 | nixos-azurite-blob = import ./nixos/modules/azurite-blob/test.nix { inherit pkgs self lib; }; |
57 | 76 | nixos-azurite-queue = import ./nixos/modules/azurite-queue/test.nix { inherit pkgs self lib; }; |
58 | 77 | nixos-azurite-table = import ./nixos/modules/azurite-table/test.nix { inherit pkgs self lib; }; |
59 | 78 | }); |
| 79 | + |
60 | 80 | nixosModules = { |
61 | 81 | azurite = import ./nixos/modules/azurite; |
62 | 82 | azurite-blob = import ./nixos/modules/azurite-blob; |
63 | 83 | azurite-table = import ./nixos/modules/azurite-table; |
64 | 84 | azurite-queue = import ./nixos/modules/azurite-queue; |
65 | 85 | }; |
| 86 | + |
66 | 87 | devShells = eachSystem (pkgs: { |
67 | 88 | default = pkgs.mkShell { |
68 | 89 | buildInputs = with pkgs; [ |
|
75 | 96 | ]; |
76 | 97 | }; |
77 | 98 | }); |
| 99 | + |
78 | 100 | formatter = eachSystem (pkgs: |
79 | 101 | let |
80 | 102 | treefmt = inputs.treefmt.lib; |
81 | | - formattingOptions = { |
82 | | - projectRootFile = "flake.lock"; |
83 | | - programs = { |
84 | | - nixpkgs-fmt.enable = true; |
85 | | - rustfmt.enable = true; |
86 | | - taplo.enable = true; |
87 | | - yamlfmt.enable = true; |
88 | | - mdformat.enable = true; |
89 | | - }; |
90 | | - }; |
91 | 103 | in |
92 | 104 | treefmt.mkWrapper pkgs formattingOptions); |
93 | 105 | }; |
|
0 commit comments