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-simulator": "servicepoint-simulator",
"servicepoint-tanks": "servicepoint-tanks",
"treefmt-nix": "treefmt-nix",
"zerforschen-plus": "zerforschen-plus"
}
},
@ -410,6 +411,26 @@
"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": {
"flake": false,
"locked": {

View file

@ -19,6 +19,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
zerforschen-plus = {
url = "git+https://git.berlin.ccc.de/vinzenz/zerforschen.plus";
inputs.nixpkgs.follows = "nixpkgs";
@ -49,6 +54,7 @@
zerforschen-plus,
nixpkgs-unstable,
nix-vscode-extensions,
treefmt-nix,
servicepoint-cli,
servicepoint-simulator,
servicepoint-tanks,
@ -113,6 +119,14 @@
inherit (nixpkgs) lib;
forDevice = f: lib.mapAttrs (device: value: f (value // { inherit device; })) 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 =
f:
lib.genAttrs supported-systems (
@ -120,6 +134,7 @@
f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
treefmt-eval = treefmt-nix.lib.evalModule pkgs treefmt-config;
}
);
importModuleDir =
@ -168,8 +183,6 @@
ronja = ./homeConfigurations/ronja;
};
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-tree);
nixosConfigurations = forDevice (
{
device,
@ -268,5 +281,14 @@
++ 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\]" = {
"editor.formatOnSave" = false;
};
"\[css\]" = {
"editor.formatOnSave" = false;
};
};
};
};

View file

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