📑 Treefmt formatter for nix, json, css, sh and more

This commit is contained in:
Martin Berg Alstad 2025-01-05 20:36:01 +01:00
parent b30376cdcf
commit 573f2c459e
Signed by: martials
GPG Key ID: A3824877B269F2E2
11 changed files with 390 additions and 274 deletions

1
.prettierrc.toml Normal file
View File

@ -0,0 +1 @@
trailingComma = "none"

6
fmt
View File

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Format all .nix files using the new default nix formatter # Format all files matched by treefmt.toml
# TODO doesn't work when run using ./fmt
nix fmt ./**.nix treefmt --on-unmatched info

View File

@ -1,344 +1,453 @@
/* TODO Variables */ /* TODO Variables */
* { * {
all: unset; all: unset;
font-size: 14px; font-size: 14px;
font-family: "JetBrains Mono", monospace; font-family: "JetBrains Mono", monospace;
transition: 200ms; transition: 200ms;
} }
trough highlight { trough highlight {
background: #cdd6f4; background: #cdd6f4;
} }
scale trough { scale trough {
margin: 0 1rem; margin: 0 1rem;
background-color: #313244; background-color: #313244;
min-height: 8px; min-height: 8px;
min-width: 70px; min-width: 70px;
} }
slider { slider {
background-color: #89b4fa; background-color: #89b4fa;
} }
.floating-notifications.background .notification-row .notification-background { .floating-notifications.background .notification-row .notification-background {
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.8), inset 0 0 0 1px #313244; box-shadow:
border-radius: 12.6px; 0 0 8px 0 rgba(0, 0, 0, 0.8),
margin: 18px; inset 0 0 0 1px #313244;
background-color: #1e1e2e; border-radius: 12.6px;
color: #cdd6f4; margin: 18px;
padding: 0; background-color: #1e1e2e;
color: #cdd6f4;
padding: 0;
} }
.floating-notifications.background .notification-row .notification-background .notification { .floating-notifications.background
padding: 7px; .notification-row
border-radius: 12.6px; .notification-background
.notification {
padding: 7px;
border-radius: 12.6px;
} }
.floating-notifications.background .notification-row .notification-background .notification.critical { .floating-notifications.background
box-shadow: inset 0 0 7px 0 #f38ba8; .notification-row
.notification-background
.notification.critical {
box-shadow: inset 0 0 7px 0 #f38ba8;
} }
.floating-notifications.background .notification-row .notification-background .notification .notification-content { .floating-notifications.background
margin: 7px; .notification-row
.notification-background
.notification
.notification-content {
margin: 7px;
} }
.floating-notifications.background .notification-row .notification-background .notification .notification-content .summary { .floating-notifications.background
color: #cdd6f4; .notification-row
.notification-background
.notification
.notification-content
.summary {
color: #cdd6f4;
} }
.floating-notifications.background .notification-row .notification-background .notification .notification-content .time { .floating-notifications.background
color: #a6adc8; .notification-row
.notification-background
.notification
.notification-content
.time {
color: #a6adc8;
} }
.floating-notifications.background .notification-row .notification-background .notification .notification-content .body { .floating-notifications.background
color: #cdd6f4; .notification-row
.notification-background
.notification
.notification-content
.body {
color: #cdd6f4;
} }
.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * { .floating-notifications.background
min-height: 3.4em; .notification-row
.notification-background
.notification
> *:last-child
> * {
min-height: 3.4em;
} }
.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * .notification-action { .floating-notifications.background
border-radius: 7px; .notification-row
color: #cdd6f4; .notification-background
background-color: #313244; .notification
box-shadow: inset 0 0 0 1px #45475a; > *:last-child
margin: 7px; > *
.notification-action {
border-radius: 7px;
color: #cdd6f4;
background-color: #313244;
box-shadow: inset 0 0 0 1px #45475a;
margin: 7px;
} }
.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * .notification-action:hover { .floating-notifications.background
box-shadow: inset 0 0 0 1px #45475a; .notification-row
background-color: #313244; .notification-background
color: #cdd6f4; .notification
> *:last-child
> *
.notification-action:hover {
box-shadow: inset 0 0 0 1px #45475a;
background-color: #313244;
color: #cdd6f4;
} }
.floating-notifications.background .notification-row .notification-background .notification > *:last-child > * .notification-action:active { .floating-notifications.background
box-shadow: inset 0 0 0 1px #45475a; .notification-row
background-color: #74c7ec; .notification-background
color: #cdd6f4; .notification
> *:last-child
> *
.notification-action:active {
box-shadow: inset 0 0 0 1px #45475a;
background-color: #74c7ec;
color: #cdd6f4;
} }
/* Close Button */ /* Close Button */
.floating-notifications.background .notification-row .notification-background .close-button { .floating-notifications.background
margin: 7px; .notification-row
padding: 2px; .notification-background
border-radius: 6.3px; .close-button {
color: #1e1e2e; margin: 7px;
background-color: #f38ba8; padding: 2px;
border-radius: 6.3px;
color: #1e1e2e;
background-color: #f38ba8;
} }
.floating-notifications.background .notification-row .notification-background .close-button:hover { .floating-notifications.background
background-color: #eba0ac; .notification-row
color: #1e1e2e; .notification-background
.close-button:hover {
background-color: #eba0ac;
color: #1e1e2e;
} }
.floating-notifications.background .notification-row .notification-background .close-button:active { .floating-notifications.background
background-color: #f38ba8; .notification-row
color: #1e1e2e; .notification-background
.close-button:active {
background-color: #f38ba8;
color: #1e1e2e;
} }
.control-center { .control-center {
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.8), inset 0 0 0 1px #313244; box-shadow:
border-radius: 12.6px; 0 0 8px 0 rgba(0, 0, 0, 0.8),
margin: 18px; inset 0 0 0 1px #313244;
background-color: #1e1e2e; border-radius: 12.6px;
color: #cdd6f4; margin: 18px;
padding: 14px; background-color: #1e1e2e;
color: #cdd6f4;
padding: 14px;
} }
.control-center .widget-title > label { .control-center .widget-title > label {
color: #cdd6f4; color: #cdd6f4;
font-size: 1.3em; font-size: 1.3em;
} }
.control-center .widget-title button { .control-center .widget-title button {
border-radius: 7px; border-radius: 7px;
color: #cdd6f4; color: #cdd6f4;
background-color: #313244; background-color: #313244;
box-shadow: inset 0 0 0 1px #45475a; box-shadow: inset 0 0 0 1px #45475a;
padding: 8px; padding: 8px;
} }
.control-center .widget-title button:hover { .control-center .widget-title button:hover {
box-shadow: inset 0 0 0 1px #45475a; box-shadow: inset 0 0 0 1px #45475a;
background-color: #585b70; background-color: #585b70;
color: #cdd6f4; color: #cdd6f4;
} }
.control-center .widget-title button:active { .control-center .widget-title button:active {
box-shadow: inset 0 0 0 1px #45475a; box-shadow: inset 0 0 0 1px #45475a;
background-color: #74c7ec; background-color: #74c7ec;
color: #1e1e2e; color: #1e1e2e;
} }
.control-center .notification-row .notification-background { .control-center .notification-row .notification-background {
border-radius: 7px; border-radius: 7px;
color: #cdd6f4; color: #cdd6f4;
background-color: #313244; background-color: #313244;
box-shadow: inset 0 0 0 1px #45475a; box-shadow: inset 0 0 0 1px #45475a;
margin-top: 14px; margin-top: 14px;
} }
.control-center .notification-row .notification-background .notification { .control-center .notification-row .notification-background .notification {
padding: 7px; padding: 7px;
border-radius: 7px; border-radius: 7px;
} }
.control-center .notification-row .notification-background .notification.critical { .control-center
box-shadow: inset 0 0 7px 0 #f38ba8; .notification-row
.notification-background
.notification.critical {
box-shadow: inset 0 0 7px 0 #f38ba8;
} }
.control-center .notification-row .notification-background .notification .notification-content { .control-center
margin: 7px; .notification-row
.notification-background
.notification
.notification-content {
margin: 7px;
} }
.control-center .notification-row .notification-background .notification .notification-content .summary { .control-center
color: #cdd6f4; .notification-row
.notification-background
.notification
.notification-content
.summary {
color: #cdd6f4;
} }
.control-center .notification-row .notification-background .notification .notification-content .time { .control-center
color: #a6adc8; .notification-row
.notification-background
.notification
.notification-content
.time {
color: #a6adc8;
} }
.control-center .notification-row .notification-background .notification .notification-content .body { .control-center
color: #cdd6f4; .notification-row
.notification-background
.notification
.notification-content
.body {
color: #cdd6f4;
} }
.control-center .notification-row .notification-background .notification > *:last-child > * { .control-center
min-height: 3.4em; .notification-row
.notification-background
.notification
> *:last-child
> * {
min-height: 3.4em;
} }
.control-center .notification-row .notification-background .notification > *:last-child > * .notification-action { .control-center
border-radius: 7px; .notification-row
color: #cdd6f4; .notification-background
background-color: #11111b; .notification
box-shadow: inset 0 0 0 1px #45475a; > *:last-child
margin: 7px; > *
.notification-action {
border-radius: 7px;
color: #cdd6f4;
background-color: #11111b;
box-shadow: inset 0 0 0 1px #45475a;
margin: 7px;
} }
.control-center .notification-row .notification-background .notification > *:last-child > * .notification-action:hover { .control-center
box-shadow: inset 0 0 0 1px #45475a; .notification-row
background-color: #313244; .notification-background
color: #cdd6f4; .notification
> *:last-child
> *
.notification-action:hover {
box-shadow: inset 0 0 0 1px #45475a;
background-color: #313244;
color: #cdd6f4;
} }
.control-center .notification-row .notification-background .notification > *:last-child > * .notification-action:active { .control-center
box-shadow: inset 0 0 0 1px #45475a; .notification-row
background-color: #74c7ec; .notification-background
color: #cdd6f4; .notification
> *:last-child
> *
.notification-action:active {
box-shadow: inset 0 0 0 1px #45475a;
background-color: #74c7ec;
color: #cdd6f4;
} }
.control-center .notification-row .notification-background .close-button { .control-center .notification-row .notification-background .close-button {
margin: 7px; margin: 7px;
padding: 2px; padding: 2px;
border-radius: 6.3px; border-radius: 6.3px;
color: #1e1e2e; color: #1e1e2e;
background-color: #eba0ac; background-color: #eba0ac;
} }
.close-button { .close-button {
border-radius: 6.3px; border-radius: 6.3px;
} }
.control-center .notification-row .notification-background .close-button:hover { .control-center .notification-row .notification-background .close-button:hover {
background-color: #f38ba8; background-color: #f38ba8;
color: #1e1e2e; color: #1e1e2e;
} }
.control-center .notification-row .notification-background .close-button:active { .control-center
background-color: #f38ba8; .notification-row
color: #1e1e2e; .notification-background
.close-button:active {
background-color: #f38ba8;
color: #1e1e2e;
} }
.control-center .notification-row .notification-background:hover { .control-center .notification-row .notification-background:hover {
box-shadow: inset 0 0 0 1px #45475a; box-shadow: inset 0 0 0 1px #45475a;
background-color: #7f849c; background-color: #7f849c;
color: #cdd6f4; color: #cdd6f4;
} }
.control-center .notification-row .notification-background:active { .control-center .notification-row .notification-background:active {
box-shadow: inset 0 0 0 1px #45475a; box-shadow: inset 0 0 0 1px #45475a;
background-color: #74c7ec; background-color: #74c7ec;
color: #cdd6f4; color: #cdd6f4;
} }
.notification.critical progress { .notification.critical progress {
background-color: #f38ba8; background-color: #f38ba8;
} }
.notification.low progress, .notification.low progress,
.notification.normal progress { .notification.normal progress {
background-color: #89b4fa; background-color: #89b4fa;
} }
.control-center-dnd { .control-center-dnd {
margin-top: 5px; margin-top: 5px;
border-radius: 8px; border-radius: 8px;
background: #313244; background: #313244;
border: 1px solid #45475a; border: 1px solid #45475a;
box-shadow: none; box-shadow: none;
} }
.control-center-dnd:checked { .control-center-dnd:checked {
background: #313244; background: #313244;
} }
.control-center-dnd slider { .control-center-dnd slider {
background: #45475a; background: #45475a;
border-radius: 8px; border-radius: 8px;
} }
.widget-dnd { .widget-dnd {
margin: 0px; margin: 0px;
font-size: 1.1rem; font-size: 1.1rem;
} }
.widget-dnd > switch { .widget-dnd > switch {
font-size: initial; font-size: initial;
border-radius: 8px; border-radius: 8px;
background: #313244; background: #313244;
border: 1px solid #45475a; border: 1px solid #45475a;
box-shadow: none; box-shadow: none;
} }
.widget-dnd > switch:checked { .widget-dnd > switch:checked {
background: #313244; background: #313244;
} }
.widget-dnd > switch slider { .widget-dnd > switch slider {
background: #45475a; background: #45475a;
border-radius: 8px; border-radius: 8px;
border: 1px solid #6c7086; border: 1px solid #6c7086;
} }
.widget-mpris .widget-mpris-player { .widget-mpris .widget-mpris-player {
background: #313244; background: #313244;
padding: 7px; padding: 7px;
} }
.widget-mpris .widget-mpris-title { .widget-mpris .widget-mpris-title {
font-size: 1.2rem; font-size: 1.2rem;
} }
.widget-mpris .widget-mpris-subtitle { .widget-mpris .widget-mpris-subtitle {
font-size: 0.8rem; font-size: 0.8rem;
} }
.widget-menubar > box > .menu-button-bar > button > label { .widget-menubar > box > .menu-button-bar > button > label {
font-size: 3rem; font-size: 3rem;
padding: 0.5rem 2rem; padding: 0.5rem 2rem;
} }
.widget-menubar > box > .menu-button-bar > :last-child { .widget-menubar > box > .menu-button-bar > :last-child {
color: #f38ba8; color: #f38ba8;
} }
.power-buttons button:hover, .power-buttons button:hover,
.powermode-buttons button:hover, .powermode-buttons button:hover,
.screenshot-buttons button:hover { .screenshot-buttons button:hover {
background: #313244; background: #313244;
} }
.control-center .widget-label > label { .control-center .widget-label > label {
color: #cdd6f4; color: #cdd6f4;
font-size: 2rem; font-size: 2rem;
} }
.widget-buttons-grid { .widget-buttons-grid {
padding-top: 1rem; padding-top: 1rem;
} }
.widget-buttons-grid > flowbox > flowboxchild > button label { .widget-buttons-grid > flowbox > flowboxchild > button label {
font-size: 2.5rem; font-size: 2.5rem;
} }
.widget-volume { .widget-volume {
padding-top: 1rem; padding-top: 1rem;
} }
.widget-volume label { .widget-volume label {
font-size: 1.5rem; font-size: 1.5rem;
color: #74c7ec; color: #74c7ec;
} }
.widget-volume trough highlight { .widget-volume trough highlight {
background: #74c7ec; background: #74c7ec;
} }
.widget-backlight trough highlight { .widget-backlight trough highlight {
background: #f9e2af; background: #f9e2af;
} }
.widget-backlight label { .widget-backlight label {
font-size: 1.5rem; font-size: 1.5rem;
color: #f9e2af; color: #f9e2af;
} }
.widget-backlight .KB { .widget-backlight .KB {
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.image { .image {
padding-right: 0.5rem; padding-right: 0.5rem;
} }

View File

@ -5,13 +5,8 @@
// Waybar position (top|bottom|left|right) // Waybar position (top|bottom|left|right)
// "width": 1280, // Waybar width // "width": 1280, // Waybar width
// Choose the order of the modules // Choose the order of the modules
"modules-left": [ "modules-left": ["hyprland/workspaces", "custom/music"],
"hyprland/workspaces", "modules-center": ["hyprland/window"],
"custom/music"
],
"modules-center": [
"hyprland/window"
],
"modules-right": [ "modules-right": [
"hyprland/language", "hyprland/language",
"wireplumber", "wireplumber",
@ -60,28 +55,14 @@
"backlight": { "backlight": {
"device": "intel_backlight", "device": "intel_backlight",
"format": "{icon}", "format": "{icon}",
"format-icons": [ "format-icons": ["", "", "", "", "", "", "", "", ""]
"",
"",
"",
"",
"",
"",
"",
"",
""
]
}, },
"wireplumber": { "wireplumber": {
// "scroll-step": 1, // %, can be a float // "scroll-step": 1, // %, can be a float
"format": "{icon} {volume}%", "format": "{icon} {volume}%",
"format-muted": " ", "format-muted": " ",
"format-icons": { "format-icons": {
"default": [ "default": ["", " ", " "]
"",
" ",
" "
]
}, },
"on-click": "pavucontrol" "on-click": "pavucontrol"
}, },

View File

@ -1,37 +1,37 @@
@import "mocha.css"; @import "mocha.css";
* { * {
font-family: JetBrainsMono Nerd Font; font-family: JetBrainsMono Nerd Font;
font-size: 15px; font-size: 15px;
min-height: 0; min-height: 0;
} }
#waybar { #waybar {
background: transparent; background: transparent;
color: @text; color: @text;
margin: 5px 5px; margin: 5px 5px;
} }
#workspaces { #workspaces {
border-radius: 1rem; border-radius: 1rem;
background-color: @surface0; background-color: @surface0;
margin: 5px 5px 5px 1rem; margin: 5px 5px 5px 1rem;
} }
#workspaces button { #workspaces button {
color: @lavender; color: @lavender;
border-radius: 1rem; border-radius: 1rem;
padding: 0.4rem; padding: 0.4rem;
} }
#workspaces button.active { #workspaces button.active {
color: @sky; color: @sky;
border-radius: 1rem; border-radius: 1rem;
} }
#workspaces button:hover { #workspaces button:hover {
color: @sapphire; color: @sapphire;
border-radius: 1rem; border-radius: 1rem;
} }
#language, #language,
@ -44,61 +44,61 @@
#wireplumber, #wireplumber,
#custom-lock, #custom-lock,
#custom-power { #custom-power {
background-color: @surface0; background-color: @surface0;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
margin: 5px 0; margin: 5px 0;
} }
#clock { #clock {
color: @blue; color: @blue;
} }
#backlight { #backlight {
color: @yellow; color: @yellow;
} }
#backlight { #backlight {
border-radius: 0; border-radius: 0;
} }
#language { #language {
color: @red; color: @red;
border-radius: 1rem 0 0 1rem; border-radius: 1rem 0 0 1rem;
margin-left: 1rem; margin-left: 1rem;
} }
#wireplumber { #wireplumber {
color: @maroon; color: @maroon;
} }
#custom-music { #custom-music {
color: @mauve; color: @mauve;
border-radius: 1rem; border-radius: 1rem;
} }
#window { #window {
color: @mauve; color: @mauve;
border-radius: 1rem; border-radius: 1rem;
} }
#custom-lock { #custom-lock {
border-radius: 1rem 0 0 1rem; border-radius: 1rem 0 0 1rem;
color: @lavender; color: @lavender;
} }
#custom-power { #custom-power {
margin-right: 1rem; margin-right: 1rem;
border-radius: 0 1rem 1rem 0; border-radius: 0 1rem 1rem 0;
color: @red; color: @red;
} }
#custom-notification { #custom-notification {
margin-right: 1rem; margin-right: 1rem;
border-radius: 0 1rem 1rem 0; border-radius: 0 1rem 1rem 0;
color: @sapphire; color: @sapphire;
} }
#tray { #tray {
margin-right: 1rem; margin-right: 1rem;
border-radius: 1rem; border-radius: 1rem;
} }

View File

@ -1,51 +1,53 @@
* { * {
background-image: none; background-image: none;
box-shadow: none; box-shadow: none;
} }
window { window {
background-color: rgba(30, 30, 46, 0.90); background-color: rgba(30, 30, 46, 0.9);
} }
button { button {
border-radius: 0; border-radius: 0;
border-color: #f5c2e7; border-color: #f5c2e7;
text-decoration-color: #cdd6f4; text-decoration-color: #cdd6f4;
color: #cdd6f4; color: #cdd6f4;
background-color: #181825; background-color: #181825;
border-style: solid; border-style: solid;
border-width: 1px; border-width: 1px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
background-size: 25%; background-size: 25%;
} }
button:focus, button:active, button:hover { button:focus,
/* 20% Overlay 2, 80% mantle */ button:active,
background-color: rgb(48, 50, 66); button:hover {
outline-style: none; /* 20% Overlay 2, 80% mantle */
background-color: rgb(48, 50, 66);
outline-style: none;
} }
#lock { #lock {
background-image: url("./lock.svg"); background-image: url("./lock.svg");
} }
#logout { #logout {
background-image: url("./logout.svg"); background-image: url("./logout.svg");
} }
#suspend { #suspend {
background-image: url("./suspend.svg"); background-image: url("./suspend.svg");
} }
#hibernate { #hibernate {
background-image: url("./hibernate.svg"); background-image: url("./hibernate.svg");
} }
#shutdown { #shutdown {
background-image: url("./shutdown.svg"); background-image: url("./shutdown.svg");
} }
#reboot { #reboot {
background-image: url("./reboot.svg"); background-image: url("./reboot.svg");
} }

View File

@ -12,8 +12,13 @@
nodejs nodejs
pnpm pnpm
gcc # Required for C, Rust and others gcc # Required for C, Rust and others
# Formatters # Language servers
nixd nixd
# Formatters
nixfmt-rfc-style
treefmt
nodePackages.prettier
shfmt
]; ];
virtualisation.docker = { virtualisation.docker = {

View File

@ -2,9 +2,9 @@
{ {
programs.steam = { programs.steam = {
enable = true; enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
}; };
} }

View File

@ -1,16 +1,16 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
stylix = { stylix = {
enable = true; enable = true;
image = ../catppuccin.png; image = ../catppuccin.png;
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
polarity = "dark"; polarity = "dark";
opacity.terminal = 0.8; opacity.terminal = 0.8;
override = { override = {
base02 = "b0b0b0"; # Comments in shell base02 = "b0b0b0"; # Comments in shell
base03 = "b0b0b0"; # Comments in nvim base03 = "b0b0b0"; # Comments in nvim
base04 = "b0b0b0"; # Secondary text in shell base04 = "b0b0b0"; # Secondary text in shell
};
}; };
};
} }

2
test
View File

@ -3,4 +3,4 @@
# Rebuild and switch the environment if successful # Rebuild and switch the environment if successful
git add . git add .
./fmt ./fmt
nh os test . nh os test . "$@"

18
treefmt.toml Normal file
View File

@ -0,0 +1,18 @@
[formatter.nixfmt-rfc-style]
command = "nixfmt"
includes = ["*.nix"]
[formatter.prettier]
command = "prettier"
includes = ["*.css", "*.json", "*.jsonc", "*.yaml"]
options = ["--write"]
[formatter.shell]
command = "shfmt"
includes = ["fmt", "test", "switch"]
excludes = []
options = [
"--indent", "2",
"--simplify",
"--write",
]