Skip to content

Commit

Permalink
chore(flakes): Add flake-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
haruki7049 committed Oct 20, 2024
1 parent 600fe9e commit b9744a7
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
46 changes: 31 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 24 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,33 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
};

outputs = { self, systems, nixpkgs, treefmt-nix }:
let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems)
(system: f nixpkgs.legacyPackages.${system});
treefmtEval =
eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in {
# Use `nix fmt`
formatter =
eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
];

# Use `nix flake check`
checks = eachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
imports = [
inputs.treefmt-nix.flakeModule
];

perSystem = { pkgs, ... }: {
treefmt = {
projectRootFile = "treefmt.nix";
programs.nixfmt.enable = true;
programs.yamlfmt.enable = true;
};

devShells.default = pkgs.mkShell {
packages = [
pkgs.nil
];
};
};
};
}
5 changes: 0 additions & 5 deletions treefmt.nix

This file was deleted.

0 comments on commit b9744a7

Please sign in to comment.