refactor(nix): split formatter and app outputs

This commit is contained in:
2026-09-15 23:38:05 -04:00
parent e31fd9d7a2
commit 3d3c3f7844
4 changed files with 37 additions and 26 deletions

View File

@@ -76,8 +76,11 @@
outputs =
{ self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
in
import ./src/dotfiles {
inherit inputs self;
inherit inputs self system;
lib = nixpkgs.lib;
root = ./configs/nixos;
};

View File

@@ -1,25 +1,16 @@
{
inputs,
lib,
formatter,
system,
}:
let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
settings.formatter.nixfmt.excludes = [
"configs/nixos/hosts/*/hardware-configuration.nix"
];
};
styleCheck = pkgs.writeShellApplication {
name = "style-check";
runtimeInputs = [
treefmtEval.config.build.wrapper
formatter
pkgs.statix
pkgs.deadnix
];
@@ -31,9 +22,7 @@ let
};
in
{
formatter.${system} = treefmtEval.config.build.wrapper;
apps.${system}.style-check = {
style-check = {
type = "app";
program = lib.getExe styleCheck;
};

View File

@@ -3,6 +3,7 @@
inputs,
self,
root,
system,
}:
let
util = import ./util.nix { inherit lib; };
@@ -38,18 +39,22 @@ let
;
registry = registry.collected;
};
formatter = import ./formatter.nix {
inherit inputs system;
};
in
{
inherit
(import ./apps.nix {
inherit
inputs
lib
;
})
apps
formatter
;
formatter.${system} = formatter;
apps.${system} = import ./apps.nix {
inherit
inputs
lib
formatter
system
;
};
nixosConfigurations = import ./hosts.nix {
inherit

View File

@@ -0,0 +1,14 @@
{ inputs, system }:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
settings.formatter.nixfmt.excludes = [
"configs/nixos/hosts/*/hardware-configuration.nix"
];
};
in
treefmtEval.config.build.wrapper