refactor(nix): move style app wiring into dotfiles
This commit is contained in:
@@ -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
|
||||||
|
|||||||
42
flake.nix
42
flake.nix
@@ -75,42 +75,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{
|
{ self, nixpkgs, ... }@inputs:
|
||||||
self,
|
import ./src/dotfiles {
|
||||||
nixpkgs,
|
inherit inputs self;
|
||||||
treefmt-nix,
|
lib = nixpkgs.lib;
|
||||||
...
|
root = ./configs/nixos;
|
||||||
}@inputs:
|
|
||||||
let
|
|
||||||
system = "x86_64-linux";
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
|
||||||
nixStyleCheck = pkgs.writeShellApplication {
|
|
||||||
name = "nix-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}.nix-style-check = {
|
|
||||||
type = "app";
|
|
||||||
program = "${nixStyleCheck}/bin/nix-style-check";
|
|
||||||
};
|
|
||||||
|
|
||||||
nixosConfigurations = (import ./src/dotfiles {
|
|
||||||
inherit inputs self;
|
|
||||||
lib = nixpkgs.lib;
|
|
||||||
root = ./configs/nixos;
|
|
||||||
}).nixosConfigurations;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
40
src/dotfiles/apps.nix
Normal file
40
src/dotfiles/apps.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
projectRootFile = "flake.nix";
|
|
||||||
|
|
||||||
programs.nixfmt.enable = true;
|
|
||||||
|
|
||||||
settings.formatter.nixfmt.excludes = [
|
|
||||||
"configs/nixos/hosts/*/hardware-configuration.nix"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user