refactor(nix): split formatter and app outputs
This commit is contained in:
@@ -76,8 +76,11 @@
|
|||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{ self, nixpkgs, ... }@inputs:
|
{ self, nixpkgs, ... }@inputs:
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
in
|
||||||
import ./src/dotfiles {
|
import ./src/dotfiles {
|
||||||
inherit inputs self;
|
inherit inputs self system;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
root = ./configs/nixos;
|
root = ./configs/nixos;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,25 +1,16 @@
|
|||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
|
formatter,
|
||||||
|
system,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
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 {
|
styleCheck = pkgs.writeShellApplication {
|
||||||
name = "style-check";
|
name = "style-check";
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
treefmtEval.config.build.wrapper
|
formatter
|
||||||
pkgs.statix
|
pkgs.statix
|
||||||
pkgs.deadnix
|
pkgs.deadnix
|
||||||
];
|
];
|
||||||
@@ -31,9 +22,7 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
formatter.${system} = treefmtEval.config.build.wrapper;
|
style-check = {
|
||||||
|
|
||||||
apps.${system}.style-check = {
|
|
||||||
type = "app";
|
type = "app";
|
||||||
program = lib.getExe styleCheck;
|
program = lib.getExe styleCheck;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
inputs,
|
inputs,
|
||||||
self,
|
self,
|
||||||
root,
|
root,
|
||||||
|
system,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
util = import ./util.nix { inherit lib; };
|
util = import ./util.nix { inherit lib; };
|
||||||
@@ -38,18 +39,22 @@ let
|
|||||||
;
|
;
|
||||||
registry = registry.collected;
|
registry = registry.collected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
formatter = import ./formatter.nix {
|
||||||
|
inherit inputs system;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit
|
formatter.${system} = formatter;
|
||||||
(import ./apps.nix {
|
|
||||||
inherit
|
apps.${system} = import ./apps.nix {
|
||||||
inputs
|
inherit
|
||||||
lib
|
inputs
|
||||||
;
|
lib
|
||||||
})
|
formatter
|
||||||
apps
|
system
|
||||||
formatter
|
;
|
||||||
;
|
};
|
||||||
|
|
||||||
nixosConfigurations = import ./hosts.nix {
|
nixosConfigurations = import ./hosts.nix {
|
||||||
inherit
|
inherit
|
||||||
|
|||||||
14
src/dotfiles/formatter.nix
Normal file
14
src/dotfiles/formatter.nix
Normal 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
|
||||||
Reference in New Issue
Block a user