From 9218e7099935815c14cf6b1b687ccb3413362467 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sun, 9 Nov 2025 14:47:03 +0100 Subject: [PATCH] add treefmt config to also format css and json --- flake.lock | 21 +++ flake.nix | 26 ++- .../vinzenz/.config/containers/policy.json | 40 ++-- homeConfigurations/vinzenz/vscode.nix | 4 + homeConfigurations/vinzenz/waybar.css | 172 +++++++++--------- 5 files changed, 156 insertions(+), 107 deletions(-) diff --git a/flake.lock b/flake.lock index 2a6ee84..7911ae4 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/flake.nix b/flake.nix index 140b27e..5b04ab0 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + } + ); }; } diff --git a/homeConfigurations/vinzenz/.config/containers/policy.json b/homeConfigurations/vinzenz/.config/containers/policy.json index d1f9b60..245b3df 100644 --- a/homeConfigurations/vinzenz/.config/containers/policy.json +++ b/homeConfigurations/vinzenz/.config/containers/policy.json @@ -1,23 +1,23 @@ { - "default": [ - { - "type": "reject" - } - ], - "transports": { - "docker-daemon": { - "": [ - { - "type": "insecureAcceptAnything" - } - ] - }, - "docker": { - "docker.io/library/debian": [ - { - "type": "insecureAcceptAnything" - } - ] - } + "default": [ + { + "type": "reject" } + ], + "transports": { + "docker-daemon": { + "": [ + { + "type": "insecureAcceptAnything" + } + ] + }, + "docker": { + "docker.io/library/debian": [ + { + "type": "insecureAcceptAnything" + } + ] + } + } } diff --git a/homeConfigurations/vinzenz/vscode.nix b/homeConfigurations/vinzenz/vscode.nix index 3ddfa78..481d02f 100644 --- a/homeConfigurations/vinzenz/vscode.nix +++ b/homeConfigurations/vinzenz/vscode.nix @@ -87,6 +87,10 @@ "\[nix\]" = { "editor.formatOnSave" = false; }; + + "\[css\]" = { + "editor.formatOnSave" = false; + }; }; }; }; diff --git a/homeConfigurations/vinzenz/waybar.css b/homeConfigurations/vinzenz/waybar.css index 516adb0..2a33940 100644 --- a/homeConfigurations/vinzenz/waybar.css +++ b/homeConfigurations/vinzenz/waybar.css @@ -1,31 +1,31 @@ * { - /* `otf-font-awesome` is required to be installed for icons */ - font-family: FontAwesome, sans-serif; - font-size: 13px; - color: #dcdfe1; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, sans-serif; + font-size: 13px; + color: #dcdfe1; } window#waybar { - background: black; - /* border: none; */ - box-shadow: none; + background: black; + /* border: none; */ + box-shadow: none; - color: #ffffff; - transition-property: background-color; - transition-duration: .5s; + color: #ffffff; + transition-property: background-color; + transition-duration: 0.5s; } window#waybar.hidden { - opacity: 0.2; + opacity: 0.2; } window#waybar.termite { - background-color: #3F3F3F; + background-color: #3f3f3f; } window#waybar.chromium { - background-color: #000000; - border: none; + background-color: #000000; + border: none; } /* window#waybar .modules-left, @@ -37,62 +37,62 @@ window#waybar .modules-right { } */ box.horizontal { - padding: 4px 4px 0px 4px; + padding: 4px 4px 0px 4px; } #workspaces, #window, #tray { - background-color: rgba(15, 27, 53, 0.9); - padding: 4px 6px; - margin-left: 6px; - margin-right: 6px; - border-radius: 15px; - border-width: 0px; + background-color: rgba(15, 27, 53, 0.9); + padding: 4px 6px; + margin-left: 6px; + margin-right: 6px; + border-radius: 15px; + border-width: 0px; } button { - /* Use box-shadow instead of border so the text isn't offset */ - box-shadow: inset 0 -3px transparent; - /* Avoid rounded borders under each button name */ - border: none; - border-radius: 0; + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; } /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ button:hover { - background: inherit; - box-shadow: inset 0 -3px #ffffff; + background: inherit; + box-shadow: inset 0 -3px #ffffff; } /* you can set a style on hover for any module like this */ #pulseaudio:hover { - background-color: #a37800; + background-color: #a37800; } #workspaces button { - padding: 0 5px; - background-color: transparent; - color: #ffffff; - border-radius: 15px; + padding: 0 5px; + background-color: transparent; + color: #ffffff; + border-radius: 15px; } #workspaces button:hover { - background: rgba(0, 0, 0, 0.2); + background: rgba(0, 0, 0, 0.2); } #workspaces button.focused, #workspaces button.active { - background-color: #64727D; + background-color: #64727d; } #workspaces button.urgent { - background-color: #eb4d4b; + background-color: #eb4d4b; } #mode { - background-color: #64727D; - box-shadow: inset 0 -3px #ffffff; + background-color: #64727d; + box-shadow: inset 0 -3px #ffffff; } #clock, @@ -111,23 +111,23 @@ button:hover { #scratchpad, #power-profiles-daemon, #mpd { - padding: 0 10px; - color: #ffffff; + padding: 0 10px; + color: #ffffff; } #window, #workspaces { - margin: 0 4px; + margin: 0 4px; } /* If workspaces is the leftmost module, omit left margin */ -.modules-left>widget:first-child>#workspaces { - margin-left: 0; +.modules-left > widget:first-child > #workspaces { + margin-left: 0; } /* If workspaces is the rightmost module, omit right margin */ -.modules-right>widget:last-child>#workspaces { - margin-right: 0; +.modules-right > widget:last-child > #workspaces { + margin-right: 0; } /* #clock { @@ -146,37 +146,37 @@ button:hover { } */ @keyframes blink { - to { - background-color: #ffffff; - color: #000000; - } + to { + background-color: #ffffff; + color: #000000; + } } /* Using steps() instead of linear as a timing function to limit cpu usage */ #battery.critical:not(.charging) { - background-color: #f53c3c; - color: #ffffff; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: steps(12); - animation-iteration-count: infinite; - animation-direction: alternate; + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; } #power-profiles-daemon { - padding-right: 15px; + padding-right: 15px; } #power-profiles-daemon.performance { - color: #f53c3c; + color: #f53c3c; } #power-profiles-daemon.balanced { - color: #2980b9; + color: #2980b9; } #power-profiles-daemon.power-saver { - color: #2ecc71; + color: #2ecc71; } /* label:focus { @@ -253,13 +253,13 @@ label:focus { } */ -#tray>.passive { - -gtk-icon-effect: dim; +#tray > .passive { + -gtk-icon-effect: dim; } -#tray>.needs-attention { - -gtk-icon-effect: highlight; - background-color: #eb4d4b; +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; } /* #idle_inhibitor { @@ -289,55 +289,57 @@ label:focus { } */ -#language {/* +#language { + /* background: #00b093; color: #740864; */ - padding: 0 5px; - margin: 0 5px; - min-width: 16px; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; } -#keyboard-state {/* +#keyboard-state { + /* background: #97e1ad; color: #000000; */ - padding: 0 0px; - margin: 0 5px; - min-width: 16px; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; } -#keyboard-state>label { - padding: 0 5px; +#keyboard-state > label { + padding: 0 5px; } -#keyboard-state>label.locked { - background: rgba(0, 0, 0, 0.2); +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); } #scratchpad { - background: rgba(0, 0, 0, 0.2); + background: rgba(0, 0, 0, 0.2); } #scratchpad.empty { - background-color: transparent; + background-color: transparent; } #privacy { - padding: 0; + padding: 0; } #privacy-item { - padding: 0 5px; - color: white; + padding: 0 5px; + color: white; } #privacy-item.screenshare { - background-color: #cf5700; + background-color: #cf5700; } #privacy-item.audio-in { - background-color: #1ca000; + background-color: #1ca000; } #privacy-item.audio-out { - background-color: #0069d4; + background-color: #0069d4; }