3 Commits

Author SHA1 Message Date
9ebd79f107 refactor(nix): move style app wiring into dotfiles 2026-09-15 23:21:37 -04:00
a779bebdbb refactor(nix): simplify style tool outputs 2026-09-15 22:56:00 -04:00
44cf655f76 chore(nix): add style tooling 2026-09-15 22:47:22 -04:00
6 changed files with 84 additions and 7 deletions

View File

@@ -99,6 +99,7 @@
# tech debt # tech debt
- better remote deployment - better remote deployment
- expose remote deployment as a flake app, replacing the Fish-only `deploy-to` workflow
- centralize shared system group names, starting with the `storage` group - centralize shared system group names, starting with the `storage` group
## nix refactor ## nix refactor

23
flake.lock generated
View File

@@ -465,7 +465,8 @@
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nixvim": "nixvim", "nixvim": "nixvim",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"stylix": "stylix" "stylix": "stylix",
"treefmt-nix": "treefmt-nix"
} }
}, },
"sops-nix": { "sops-nix": {
@@ -617,6 +618,26 @@
"repo": "base16-zed", "repo": "base16-zed",
"type": "github" "type": "github"
} }
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1786901030,
"narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -62,6 +62,12 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Repository formatter and Nix lint wiring.
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# CachyOS kernel and binary cache. # CachyOS kernel and binary cache.
# This must not follow this flake's nixpkgs because Chaotic builds against its own pinned package set. # This must not follow this flake's nixpkgs because Chaotic builds against its own pinned package set.
# Its cache serves the kernel only when the overlay stays on the cache-friendly path. # Its cache serves the kernel only when the overlay stays on the cache-friendly path.
@@ -70,11 +76,9 @@
outputs = outputs =
{ self, nixpkgs, ... }@inputs: { self, nixpkgs, ... }@inputs:
{ import ./src/dotfiles {
nixosConfigurations = (import ./src/dotfiles { inherit inputs self;
inherit inputs self; lib = nixpkgs.lib;
lib = nixpkgs.lib; root = ./configs/nixos;
root = ./configs/nixos;
}).nixosConfigurations;
}; };
} }

40
src/dotfiles/apps.nix Normal file
View File

@@ -0,0 +1,40 @@
{
inputs,
lib,
}:
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
pkgs.statix
pkgs.deadnix
];
text = ''
treefmt --fail-on-change
statix check .
deadnix --fail --no-lambda-pattern-names --no-underscore .
'';
};
in
{
formatter.${system} = treefmtEval.config.build.wrapper;
apps.${system}.style-check = {
type = "app";
program = lib.getExe styleCheck;
};
}

View File

@@ -38,6 +38,13 @@ let
; ;
registry = registry.collected; registry = registry.collected;
}; };
flakeApps = import ./apps.nix {
inherit
inputs
lib
;
};
in in
{ {
nixosConfigurations = import ./hosts.nix { nixosConfigurations = import ./hosts.nix {
@@ -52,3 +59,4 @@ in
root = root + "/hosts"; root = root + "/hosts";
}; };
} }
// flakeApps

3
statix.toml Normal file
View File

@@ -0,0 +1,3 @@
disabled = [
"repeated_keys",
]