summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix31
-rw-r--r--modules/treefmt.nix6
2 files changed, 35 insertions, 2 deletions
diff --git a/flake.nix b/flake.nix
index 3a552bf..5613a2c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -19,13 +19,40 @@
url = "github:Wilkuu-2/tatuin/flake";
inputs.nixpkgs.follows = "nixpkgs";
};
+
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
outputs =
- { self, nixpkgs, nixpkgs-stable, ... }@inputs:
+ { self, nixpkgs, nixpkgs-stable, treefmt-nix, ... }@inputs: let
+ lib = nixpkgs.lib;
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ ];
+ forAllSystems = f: (lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system }));
+ treefmtEval = forAllSystems (pkgs: treefmt-nix.lib.evalModule pkgs ./modules/treefmt.nix);
+ in
{
# packages."x86_64-linux".full-iso = self.nixosConfigurations.full-iso.config.system.build.isoImage;
- formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
+ packages = (
+ forAllSystems (pkgs: {
+
+ })
+ );
+ # for `nix fmt`
+ formatter = (
+ forAllSystems (pkgs: treefmtEval.${pkgs.stdenv.hostPlatform.system}.config.build.wrapper)
+ );
+ # for `nix flake check`
+ checks = (
+ forAllSystems (pkgs: {
+ formatting = treefmtEval.${pkgs.system}.config.build.check self;
+ })
+ );
nixosConfigurations = {
apocalypse = nixpkgs.lib.nixosSystem {
diff --git a/modules/treefmt.nix b/modules/treefmt.nix
new file mode 100644
index 0000000..ab36cdb
--- /dev/null
+++ b/modules/treefmt.nix
@@ -0,0 +1,6 @@
+{pkgs, ...}: {
+ # Used to find the project root
+ projectRootFile = "flake.nix";
+ programs.nixfmt.enable = true;
+ programs.deadnix.enable = true;
+}