flake: enable treefmt for formatting
- for now, uses only `nixfmt-rfc-style` - can be invoked with `nix flake check` and `nix fmt`
This commit is contained in:
parent
d25fffc899
commit
3a31c21ae2
2 changed files with 38 additions and 1 deletions
18
flake.nix
18
flake.nix
|
@ -14,6 +14,10 @@
|
|||
# deliberately do _not_ follow the nixpkgs input here, because paranoia and test coverage
|
||||
};
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nur.url = "github:nix-community/NUR";
|
||||
# TODO: possible make this a flake as well
|
||||
|
@ -25,7 +29,7 @@
|
|||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, nur, lanzaboote, utils, home-manager, ... }@inputs:
|
||||
{ self, nixpkgs, nur, lanzaboote, utils, home-manager, treefmt-nix, ... }@inputs:
|
||||
let
|
||||
# FIXME: allow different systems
|
||||
systems = utils.lib.system;
|
||||
|
@ -71,6 +75,10 @@
|
|||
inherit inputs system;
|
||||
};
|
||||
};
|
||||
treefmtConf = {pkgs, ...}:{
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt-rfc-style.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
overlays.default = import ./packages;
|
||||
|
@ -85,11 +93,19 @@
|
|||
inherit system;
|
||||
overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
};
|
||||
nixpkgs_unstable = import inputs.nixos-unstable {
|
||||
inherit system;
|
||||
overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
};
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
pkgs_unstable = inputs.nixos-unstable.legacyPackages.${system};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs_unstable treefmtConf;
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = [];
|
||||
};
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
checks.formatting = treefmtEval.config.build.check self;
|
||||
# expose nixpkgs with overlay; TODO: figure out role of config
|
||||
#legacyPackages = nixpkgs;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue