mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
flake.nix: nixfmt -> treefmt
Instead of managing our own formatter file, we can leverage a tool specifically tailored for formatting a repository and allowing configuration to be passed to formatters.
This commit is contained in:
parent
7137c8ae4e
commit
74b681d665
2 changed files with 41 additions and 9 deletions
27
flake.nix
27
flake.nix
|
|
@ -1,9 +1,16 @@
|
|||
{
|
||||
description = "Home Manager for Nix";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = { self, nixpkgs, ... }:
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, treefmt-nix, ... }:
|
||||
{
|
||||
nixosModules = rec {
|
||||
home-manager = ./nixos;
|
||||
|
|
@ -39,13 +46,17 @@
|
|||
lib = import ./lib { inherit (nixpkgs) lib; };
|
||||
} // (let
|
||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||
|
||||
treefmtEval = forAllSystems (
|
||||
system:
|
||||
treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} {
|
||||
# Formatting configuration
|
||||
programs = {
|
||||
nixfmt.enable = true;
|
||||
};
|
||||
});
|
||||
in {
|
||||
formatter = forAllSystems (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in pkgs.linkFarm "format" [{
|
||||
name = "bin/format";
|
||||
path = ./format;
|
||||
}]);
|
||||
formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper);
|
||||
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue