📑 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
# Format all .nix files using the new default nix formatter
# TODO doesn't work when run using ./fmt
nix fmt ./**.nix
# Format all files matched by treefmt.toml
treefmt --on-unmatched info

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,9 +2,9 @@
{
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
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
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
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
};
}

View File

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

2
test
View File

@ -3,4 +3,4 @@
# Rebuild and switch the environment if successful
git add .
./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",
]