-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathflake.nix
51 lines (46 loc) · 1.38 KB
/
flake.nix
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
# SPDX-FileCopyrightText: 2023-2025 Akira Komamura
# SPDX-License-Identifier: Unlicense
{
inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
systems,
nixpkgs,
treefmt-nix,
...
}@inputs:
let
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in
{
packages = eachSystem (pkgs: {
# default = pkgs.hello;
});
devShells = eachSystem (pkgs: {
default = pkgs.mkShell (
with pkgs;
{
buildInputs = [
# Add development dependencies here
];
}
);
});
# Run `nix fmt [FILE_OR_DIR]...` to execute formatters configured in treefmt.nix.
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
checks = eachSystem (pkgs: {
# Throws an error if any of the source files are not correctly formatted
# when you run `nix flake check --print-build-logs`. Useful for CI
treefmt = treefmtEval.${pkgs.system}.config.build.check self;
});
};
}