Skip to content

Commit b9744a7

Browse files
committed
chore(flakes): Add flake-parts
1 parent 600fe9e commit b9744a7

File tree

3 files changed

+55
-35
lines changed

3 files changed

+55
-35
lines changed

flake.lock

Lines changed: 31 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,33 @@
33

44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/23.11";
6+
flake-parts.url = "github:hercules-ci/flake-parts";
67
treefmt-nix.url = "github:numtide/treefmt-nix";
78
};
89

9-
outputs = { self, systems, nixpkgs, treefmt-nix }:
10-
let
11-
eachSystem = f:
12-
nixpkgs.lib.genAttrs (import systems)
13-
(system: f nixpkgs.legacyPackages.${system});
14-
treefmtEval =
15-
eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
16-
in {
17-
# Use `nix fmt`
18-
formatter =
19-
eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
10+
outputs =
11+
inputs:
12+
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
13+
systems = [
14+
"x86_64-linux"
15+
];
2016

21-
# Use `nix flake check`
22-
checks = eachSystem (pkgs: {
23-
formatting = treefmtEval.${pkgs.system}.config.build.check self;
24-
});
17+
imports = [
18+
inputs.treefmt-nix.flakeModule
19+
];
20+
21+
perSystem = { pkgs, ... }: {
22+
treefmt = {
23+
projectRootFile = "treefmt.nix";
24+
programs.nixfmt.enable = true;
25+
programs.yamlfmt.enable = true;
26+
};
27+
28+
devShells.default = pkgs.mkShell {
29+
packages = [
30+
pkgs.nil
31+
];
32+
};
33+
};
2534
};
2635
}

treefmt.nix

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)