feat(home): theme CLI tools, add staples, env defaults and mime apps
- Catppuccin Mocha for fzf (colors), bat (catppuccin/bat tmTheme) and git delta (syntax-theme + navigate/line-numbers/side-by-side). - CLI staples on every host: ripgrep, fd, jq, btop, plus gh (SSH) and tea (Gitea CLI). - home.sessionVariables: PAGER, MANPAGER (bat), VISUAL; xdg.enable. - xdg.mimeApps defaults (web->Firefox, directories->nemo). - Document the stateVersion pin. README updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,18 @@
|
||||
url = "github:nix-community/nix-index-database";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# treefmt-nix: one multi-language formatter driving `nix fmt` and the
|
||||
# formatting flake check (nixfmt + shfmt + prettier).
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# git-hooks.nix: declarative pre-commit hooks (nixfmt/deadnix/statix),
|
||||
# installed into the repo via the devShell.
|
||||
git-hooks = {
|
||||
url = "github:cachix/git-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
@@ -53,7 +65,7 @@
|
||||
let
|
||||
# claude-code tracks nixpkgs-unstable regardless of the pinned nixpkgs.
|
||||
overlays = [
|
||||
(final: prev: {
|
||||
(_final: prev: {
|
||||
claude-code =
|
||||
(import nixpkgs-unstable {
|
||||
inherit (prev.stdenv.hostPlatform) system;
|
||||
@@ -245,7 +257,7 @@
|
||||
];
|
||||
homeModules = [
|
||||
./lyrathorpe/home
|
||||
./system/modules/work/default.nix
|
||||
./lyrathorpe/home/work.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
@@ -268,6 +280,13 @@
|
||||
};
|
||||
in
|
||||
{
|
||||
# flake-parts modules: treefmt-nix wires `nix fmt` + a formatting check;
|
||||
# git-hooks.nix wires the pre-commit check + devShell installation script.
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
inputs.git-hooks.flakeModule
|
||||
];
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
@@ -279,26 +298,60 @@
|
||||
# nixpkgs instance for that system. Outputs here become per-system
|
||||
# attrsets automatically (e.g. devShells.<system>.default).
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
# `nix fmt` formatter for the repo.
|
||||
formatter = pkgs.nixfmt;
|
||||
# treefmt drives `nix fmt` and the formatting check below. nixfmt
|
||||
# stays the .nix formatter (the tree is already nixfmt-formatted);
|
||||
# shfmt covers shell and prettier covers markdown/yaml/json.
|
||||
treefmt = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt.enable = true;
|
||||
programs.shfmt.enable = true;
|
||||
programs.prettier.enable = true;
|
||||
# Generated hardware-configuration.nix files are not hand-edited.
|
||||
settings.global.excludes = [ "*/hardware-configuration.nix" ];
|
||||
};
|
||||
|
||||
# Pre-commit hooks: format + lint gate run on commit. The same hooks
|
||||
# are exposed as a flake check (pre-commit.check.enable defaults true).
|
||||
pre-commit.settings.hooks = {
|
||||
nixfmt-rfc-style.enable = true;
|
||||
deadnix = {
|
||||
enable = true;
|
||||
# Unused module args ({config,lib,pkgs,...}) are normal; only flag
|
||||
# genuinely dead bindings.
|
||||
settings.noLambdaPatternNames = true;
|
||||
};
|
||||
statix.enable = true; # reads .statix.toml (repeated_keys/empty_pattern disabled)
|
||||
};
|
||||
|
||||
# treefmt-nix exposes its own `checks.treefmt`; alias it to
|
||||
# `formatting` so the existing CI gate (.#checks.*.formatting) keeps
|
||||
# working without churn.
|
||||
checks.formatting = config.treefmt.build.check inputs.self;
|
||||
|
||||
# deadnix / statix lints as standalone flake checks so `nix flake
|
||||
# check` flags dead code and antipatterns independently of pre-commit.
|
||||
checks.deadnix = pkgs.runCommandLocal "check-deadnix" { nativeBuildInputs = [ pkgs.deadnix ]; } ''
|
||||
deadnix --fail --no-lambda-pattern-names ${./.} && touch $out
|
||||
'';
|
||||
checks.statix = pkgs.runCommandLocal "check-statix" { nativeBuildInputs = [ pkgs.statix ]; } ''
|
||||
statix check ${./.} && touch $out
|
||||
'';
|
||||
|
||||
# `nix develop` shell with the tooling needed to hack on this flake.
|
||||
# shellHook installs the git pre-commit hooks into the working tree.
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
nixfmt
|
||||
nil
|
||||
git
|
||||
deadnix
|
||||
statix
|
||||
treefmt
|
||||
];
|
||||
shellHook = config.pre-commit.installationScript;
|
||||
};
|
||||
|
||||
checks.formatting =
|
||||
pkgs.runCommandLocal "check-formatting" { nativeBuildInputs = [ pkgs.nixfmt ]; }
|
||||
''
|
||||
# Generated hardware-configuration.nix files are excluded.
|
||||
nixfmt --check $(find ${./.} -name '*.nix' -not -name 'hardware-configuration.nix') && touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
# Realise the host tables: each entry becomes a {nixos,darwin}Configuration.
|
||||
|
||||
Reference in New Issue
Block a user