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

@ -1,23 +1,23 @@
{ {
"default": [ "default": [
{ {
"type": "reject" "type": "reject"
}
],
"transports": {
"docker-daemon": {
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"docker": {
"docker.io/library/debian": [
{
"type": "insecureAcceptAnything"
}
]
}
} }
],
"transports": {
"docker-daemon": {
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"docker": {
"docker.io/library/debian": [
{
"type": "insecureAcceptAnything"
}
]
}
}
} }

View file

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

View file

@ -1,31 +1,31 @@
* { * {
/* `otf-font-awesome` is required to be installed for icons */ /* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, sans-serif; font-family: FontAwesome, sans-serif;
font-size: 13px; font-size: 13px;
color: #dcdfe1; color: #dcdfe1;
} }
window#waybar { window#waybar {
background: black; background: black;
/* border: none; */ /* border: none; */
box-shadow: none; box-shadow: none;
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 {
opacity: 0.2; opacity: 0.2;
} }
window#waybar.termite { window#waybar.termite {
background-color: #3F3F3F; background-color: #3f3f3f;
} }
window#waybar.chromium { window#waybar.chromium {
background-color: #000000; background-color: #000000;
border: none; border: none;
} }
/* /*
window#waybar .modules-left, window#waybar .modules-left,
@ -37,62 +37,62 @@ window#waybar .modules-right {
} }
*/ */
box.horizontal { box.horizontal {
padding: 4px 4px 0px 4px; padding: 4px 4px 0px 4px;
} }
#workspaces, #workspaces,
#window, #window,
#tray { #tray {
background-color: rgba(15, 27, 53, 0.9); background-color: rgba(15, 27, 53, 0.9);
padding: 4px 6px; padding: 4px 6px;
margin-left: 6px; margin-left: 6px;
margin-right: 6px; margin-right: 6px;
border-radius: 15px; border-radius: 15px;
border-width: 0px; border-width: 0px;
} }
button { button {
/* Use box-shadow instead of border so the text isn't offset */ /* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent; box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */ /* Avoid rounded borders under each button name */
border: none; border: none;
border-radius: 0; border-radius: 0;
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover { button:hover {
background: inherit; background: inherit;
box-shadow: inset 0 -3px #ffffff; box-shadow: inset 0 -3px #ffffff;
} }
/* you can set a style on hover for any module like this */ /* you can set a style on hover for any module like this */
#pulseaudio:hover { #pulseaudio:hover {
background-color: #a37800; background-color: #a37800;
} }
#workspaces button { #workspaces button {
padding: 0 5px; padding: 0 5px;
background-color: transparent; background-color: transparent;
color: #ffffff; color: #ffffff;
border-radius: 15px; border-radius: 15px;
} }
#workspaces button:hover { #workspaces button:hover {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }
#workspaces button.focused, #workspaces button.focused,
#workspaces button.active { #workspaces button.active {
background-color: #64727D; background-color: #64727d;
} }
#workspaces button.urgent { #workspaces button.urgent {
background-color: #eb4d4b; background-color: #eb4d4b;
} }
#mode { #mode {
background-color: #64727D; background-color: #64727d;
box-shadow: inset 0 -3px #ffffff; box-shadow: inset 0 -3px #ffffff;
} }
#clock, #clock,
@ -111,23 +111,23 @@ button:hover {
#scratchpad, #scratchpad,
#power-profiles-daemon, #power-profiles-daemon,
#mpd { #mpd {
padding: 0 10px; padding: 0 10px;
color: #ffffff; color: #ffffff;
} }
#window, #window,
#workspaces { #workspaces {
margin: 0 4px; margin: 0 4px;
} }
/* If workspaces is the leftmost module, omit left margin */ /* If workspaces is the leftmost module, omit left margin */
.modules-left>widget:first-child>#workspaces { .modules-left > widget:first-child > #workspaces {
margin-left: 0; margin-left: 0;
} }
/* If workspaces is the rightmost module, omit right margin */ /* If workspaces is the rightmost module, omit right margin */
.modules-right>widget:last-child>#workspaces { .modules-right > widget:last-child > #workspaces {
margin-right: 0; margin-right: 0;
} }
/* /*
#clock { #clock {
@ -146,37 +146,37 @@ button:hover {
} }
*/ */
@keyframes blink { @keyframes blink {
to { to {
background-color: #ffffff; background-color: #ffffff;
color: #000000; color: #000000;
} }
} }
/* Using steps() instead of linear as a timing function to limit cpu usage */ /* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) { #battery.critical:not(.charging) {
background-color: #f53c3c; background-color: #f53c3c;
color: #ffffff; color: #ffffff;
animation-name: blink; animation-name: blink;
animation-duration: 0.5s; animation-duration: 0.5s;
animation-timing-function: steps(12); animation-timing-function: steps(12);
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
#power-profiles-daemon { #power-profiles-daemon {
padding-right: 15px; padding-right: 15px;
} }
#power-profiles-daemon.performance { #power-profiles-daemon.performance {
color: #f53c3c; color: #f53c3c;
} }
#power-profiles-daemon.balanced { #power-profiles-daemon.balanced {
color: #2980b9; color: #2980b9;
} }
#power-profiles-daemon.power-saver { #power-profiles-daemon.power-saver {
color: #2ecc71; color: #2ecc71;
} }
/* /*
label:focus { label:focus {
@ -253,13 +253,13 @@ label:focus {
} }
*/ */
#tray>.passive { #tray > .passive {
-gtk-icon-effect: dim; -gtk-icon-effect: dim;
} }
#tray>.needs-attention { #tray > .needs-attention {
-gtk-icon-effect: highlight; -gtk-icon-effect: highlight;
background-color: #eb4d4b; background-color: #eb4d4b;
} }
/* /*
#idle_inhibitor { #idle_inhibitor {
@ -289,55 +289,57 @@ label:focus {
} }
*/ */
#language {/* #language {
/*
background: #00b093; background: #00b093;
color: #740864; */ color: #740864; */
padding: 0 5px; padding: 0 5px;
margin: 0 5px; margin: 0 5px;
min-width: 16px; min-width: 16px;
} }
#keyboard-state {/* #keyboard-state {
/*
background: #97e1ad; background: #97e1ad;
color: #000000; */ color: #000000; */
padding: 0 0px; padding: 0 0px;
margin: 0 5px; margin: 0 5px;
min-width: 16px; min-width: 16px;
} }
#keyboard-state>label { #keyboard-state > label {
padding: 0 5px; padding: 0 5px;
} }
#keyboard-state>label.locked { #keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }
#scratchpad { #scratchpad {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }
#scratchpad.empty { #scratchpad.empty {
background-color: transparent; background-color: transparent;
} }
#privacy { #privacy {
padding: 0; padding: 0;
} }
#privacy-item { #privacy-item {
padding: 0 5px; padding: 0 5px;
color: white; color: white;
} }
#privacy-item.screenshare { #privacy-item.screenshare {
background-color: #cf5700; background-color: #cf5700;
} }
#privacy-item.audio-in { #privacy-item.audio-in {
background-color: #1ca000; background-color: #1ca000;
} }
#privacy-item.audio-out { #privacy-item.audio-out {
background-color: #0069d4; background-color: #0069d4;
} }