Add treefmt-nix for formatting all the files

This commit is contained in:
ulic-youthlic 2025-06-06 11:02:49 +08:00
parent 1a9a4243fe
commit ceecc82aae
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
11 changed files with 151 additions and 52 deletions

View file

@ -4,9 +4,10 @@ ignore-parent = true
ignore-hidden = false
ignore-files = true
ignore-vcs = true
extend-exclude = ["secrets/", ".git/", "public-key.txt"]
extend-exclude = ["secrets/*", ".git/*", "**/public-key.txt"]
[default]
binary = false
check-filename = true
check-file = true
unicode = true

View file

@ -1,2 +1 @@
{
}
{}

View file

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 212 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Before After
Before After

37
flake.lock generated
View file

@ -605,6 +605,22 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1747958103,
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"inputs": {
"flake-parts": [
@ -665,7 +681,8 @@
"nixpkgs": "nixpkgs_2",
"nur-rycee": "nur-rycee",
"sops-nix": "sops-nix",
"stylix": "stylix"
"stylix": "stylix",
"treefmt-nix": "treefmt-nix_2"
}
},
"rust-overlay": {
@ -904,6 +921,24 @@
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1748243702,
"narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"xwayland-satellite-stable": {
"flake": false,
"locked": {

View file

@ -133,6 +133,12 @@
utils.follows = "flake-utils";
};
};
treefmt-nix = {
type = "github";
owner = "numtide";
repo = "treefmt-nix";
};
};
outputs = {
self,
@ -153,6 +159,7 @@
systems = flake-utils.lib.defaultSystems;
imports = [
inputs.home-manager.flakeModules.home-manager
inputs.treefmt-nix.flakeModule
nixos
home
deploy
@ -169,11 +176,10 @@
allowUnfree = true;
};
};
formatter = pkgs.alejandra;
packages = import ./pkgs (
args
// {
inherit inputs;
inherit inputs rootPath;
}
);
devShells.default = pkgs.mkShell {
@ -185,6 +191,62 @@
nvfetcher
];
};
treefmt = {
programs = {
alejandra = {
enable = true;
excludes = ["pkgs/_sources/*.nix"];
};
biome = {
enable = true;
includes = ["*.json"];
excludes = ["pkgs/_sources/*.json"];
settings = {
javascript.formatter.enabled = false;
css.formatter.enabled = false;
};
};
dprint = {
enable = true;
includes = ["*.md" "*.toml" "*.yaml"];
excludes = ["secrets/*.yaml"];
settings = {
plugins = pkgs.dprint-plugins.getPluginList (plugins:
with plugins; [
dprint-plugin-toml
dprint-plugin-markdown
g-plane-pretty_yaml
]);
};
};
just = {
enable = true;
includes = [".justfile"];
};
typos = let
config = ./.typos.toml |> builtins.readFile |> builtins.fromTOML;
in {
enable = true;
includes = ["*"];
excludes = ["assets/*"] ++ config.files.extend-exclude;
configFile = "${toString ./.typos.toml}";
# Disable all extra option in treefmt module.
# Use config file.
sort = false;
isolated = false;
hidden = false;
noIgnore = false;
noIgnoreDot = false;
noIgnoreGlobal = false;
noIgnoreParent = false;
noIgnoreVCS = false;
binary = false;
noCheckFilenames = false;
noCheckFiles = false;
noUnicode = false;
};
};
};
};
flake = {
overlays = {

View file

@ -51,7 +51,6 @@ repo_root_style = "bold green"
use_os_path_sep = false
read_only = " 󰌾"
[aws]
symbol = " "
@ -210,4 +209,3 @@ symbol = " "
[zig]
symbol = " "

View file

@ -1,10 +1,11 @@
{
pkgs,
inputs,
rootPath,
...
}: let
srcs = pkgs.callPackage ./_sources/generated.nix {};
callPackage = pkgs.lib.callPackageWith (pkgs // {inherit inputs srcs callPackage;});
callPackage = pkgs.lib.callPackageWith (pkgs // {inherit inputs srcs callPackage rootPath;});
in
{
pinentry-selector = callPackage ./pinentry-selector.nix {};
@ -13,7 +14,7 @@ in
rime-ice = callPackage ./rime-ice.nix {};
dioxionary = callPackage ./dioxionary.nix {};
spotifyx = callPackage ./spotifyx.nix {};
radicle-explorer = callPackage ./radicle-explorer {};
radicle-explorer = callPackage ./radicle-explorer.nix {};
TrackersListCollection = callPackage ./TrackersListCollection.nix {};
wshowkeys-mao = callPackage ./wshowkeys-mao.nix {};
OuterWildsTextAdventure = callPackage ./OuterWildsTextAdventure.nix {};

View file

@ -1,4 +1,7 @@
{pkgs}:
{
pkgs,
rootPath,
}:
(pkgs.radicle-explorer.withConfig {
preferredSeeds = [
{
@ -26,7 +29,7 @@
postInstall =
(prev.postInstall or "")
+ ''
ln -s ${./youthlic-seed-header.png} $out/images/youthlic-seed-header.png
ln -s ${./youthlic-seed-avatar.jpg} $out/images/youthlic-seed-avatar.jpg
ln -s ${rootPath + "/assets/radicle-explorer/youthlic-seed-header.png"} $out/images/youthlic-seed-header.png
ln -s ${rootPath + "/assets/radicle-explorer/youthlic-seed-avatar.jpg"} $out/images/youthlic-seed-avatar.jpg
'';
})

View file

@ -92,7 +92,7 @@ allow = [
"MIT",
# "Apache-2.0",
# "Apache-2.0 WITH LLVM-exception",
"GPL-3.0"
"GPL-3.0",
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the