add treefmt config to also format css and json

This commit is contained in:
Vinzenz Schroeter 2025-11-09 14:47:03 +01:00
parent 908bc2dc8f
commit 9218e70999
5 changed files with 156 additions and 107 deletions

21
flake.lock generated
View file

@ -307,6 +307,7 @@
"servicepoint-cli": "servicepoint-cli", "servicepoint-cli": "servicepoint-cli",
"servicepoint-simulator": "servicepoint-simulator", "servicepoint-simulator": "servicepoint-simulator",
"servicepoint-tanks": "servicepoint-tanks", "servicepoint-tanks": "servicepoint-tanks",
"treefmt-nix": "treefmt-nix",
"zerforschen-plus": "zerforschen-plus" "zerforschen-plus": "zerforschen-plus"
} }
}, },
@ -410,6 +411,26 @@
"url": "https://git.berlin.ccc.de/vinzenz/servicepoint-tanks.git" "url": "https://git.berlin.ccc.de/vinzenz/servicepoint-tanks.git"
} }
}, },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1762410071,
"narHash": "sha256-aF5fvoZeoXNPxT0bejFUBXeUjXfHLSL7g+mjR/p5TEg=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "97a30861b13c3731a84e09405414398fbf3e109f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"xwayland-satellite-stable": { "xwayland-satellite-stable": {
"flake": false, "flake": false,
"locked": { "locked": {

View file

@ -19,6 +19,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
zerforschen-plus = { zerforschen-plus = {
url = "git+https://git.berlin.ccc.de/vinzenz/zerforschen.plus"; url = "git+https://git.berlin.ccc.de/vinzenz/zerforschen.plus";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -49,6 +54,7 @@
zerforschen-plus, zerforschen-plus,
nixpkgs-unstable, nixpkgs-unstable,
nix-vscode-extensions, nix-vscode-extensions,
treefmt-nix,
servicepoint-cli, servicepoint-cli,
servicepoint-simulator, servicepoint-simulator,
servicepoint-tanks, servicepoint-tanks,
@ -113,6 +119,14 @@
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
forDevice = f: lib.mapAttrs (device: value: f (value // { inherit device; })) devices; forDevice = f: lib.mapAttrs (device: value: f (value // { inherit device; })) devices;
supported-systems = lib.attrsets.mapAttrsToList (k: v: v.system) devices; supported-systems = lib.attrsets.mapAttrsToList (k: v: v.system) devices;
treefmt-config = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
jsonfmt.enable = true;
prettier.enable = true;
};
};
forAllSystems = forAllSystems =
f: f:
lib.genAttrs supported-systems ( lib.genAttrs supported-systems (
@ -120,6 +134,7 @@
f rec { f rec {
inherit system; inherit system;
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
treefmt-eval = treefmt-nix.lib.evalModule pkgs treefmt-config;
} }
); );
importModuleDir = importModuleDir =
@ -168,8 +183,6 @@
ronja = ./homeConfigurations/ronja; ronja = ./homeConfigurations/ronja;
}; };
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-tree);
nixosConfigurations = forDevice ( nixosConfigurations = forDevice (
{ {
device, device,
@ -268,5 +281,14 @@
++ additional-modules; ++ additional-modules;
} }
); );
formatter = forAllSystems ({ treefmt-eval, ... }: treefmt-eval.config.build.wrapper);
checks = forAllSystems (
{ treefmt-eval, ... }:
{
formatting = treefmt-eval.config.build.check self;
}
);
}; };
} }

View file

@ -87,6 +87,10 @@
"\[nix\]" = { "\[nix\]" = {
"editor.formatOnSave" = false; "editor.formatOnSave" = false;
}; };
"\[css\]" = {
"editor.formatOnSave" = false;
};
}; };
}; };
}; };

View file

@ -12,7 +12,7 @@ window#waybar {
color: #ffffff; color: #ffffff;
transition-property: background-color; transition-property: background-color;
transition-duration: .5s; transition-duration: 0.5s;
} }
window#waybar.hidden { window#waybar.hidden {
@ -20,7 +20,7 @@ window#waybar.hidden {
} }
window#waybar.termite { window#waybar.termite {
background-color: #3F3F3F; background-color: #3f3f3f;
} }
window#waybar.chromium { window#waybar.chromium {
@ -83,7 +83,7 @@ button:hover {
#workspaces button.focused, #workspaces button.focused,
#workspaces button.active { #workspaces button.active {
background-color: #64727D; background-color: #64727d;
} }
#workspaces button.urgent { #workspaces button.urgent {
@ -91,7 +91,7 @@ button:hover {
} }
#mode { #mode {
background-color: #64727D; background-color: #64727d;
box-shadow: inset 0 -3px #ffffff; box-shadow: inset 0 -3px #ffffff;
} }
@ -289,7 +289,8 @@ label:focus {
} }
*/ */
#language {/* #language {
/*
background: #00b093; background: #00b093;
color: #740864; */ color: #740864; */
padding: 0 5px; padding: 0 5px;
@ -297,7 +298,8 @@ label:focus {
min-width: 16px; min-width: 16px;
} }
#keyboard-state {/* #keyboard-state {
/*
background: #97e1ad; background: #97e1ad;
color: #000000; */ color: #000000; */
padding: 0 0px; padding: 0 0px;