refactor: desktop legacy module

This commit is contained in:
Nickolaj Jepsen 2025-12-12 04:02:55 +01:00
parent 5f56c011ab
commit d463f4d1af
31 changed files with 630 additions and 577 deletions

View file

@ -42,6 +42,7 @@ with lib; let
inputs.niri.nixosModules.niri
../modules/base
../modules/programs
../modules/desktop
(mkSystemImports hostname)
{nixpkgs.config.allowUnfree = true;}
]

View file

@ -0,0 +1,3 @@
{
fireproof.desktop.enable = true;
}

View file

@ -0,0 +1,3 @@
{
fireproof.desktop.enable = true;
}

View file

@ -0,0 +1,3 @@
{
fireproof.desktop.enable = true;
}

View file

@ -36,7 +36,7 @@ switch hostname=`hostname -s` target='':
#!/usr/bin/env -S bash -e
target="{{ target }}"
if [ -z "$target" ]; then
sudo {{ nixcmd }} run nixpkgs#nixos-rebuild -- switch --fast --flake .#{{ hostname }} {{ nix_output_monitor }}
sudo {{ nixcmd }} run nixpkgs#nixos-rebuild -- switch --show-trace --fast --flake .#{{ hostname }}
else
{{ nixcmd }} run nixpkgs#nixos-rebuild -- switch \
--flake .#{{ hostname }} \

View file

@ -1,70 +0,0 @@
{
inputs,
pkgs,
...
}: {
imports = [
./theme.nix
./background.nix
./bar.nix
];
systemd.user.services.niri-flake-polkit.enable = false;
fireproof.home-manager = {
imports = [
inputs.dankMaterialShell.homeModules.dankMaterialShell.default
];
programs.dankMaterialShell = {
enable = true;
enableDynamicTheming = false;
enableClipboard = false;
enableVPN = false;
enableCalendarEvents = false;
default.settings = {
# General Settings
weatherCoordinates = "56.1496278,10.2134046";
# Lock Screen
loginctlLockIntegration = true;
fadeToLockEnabled = true;
fadeToLockGracePeriod = 5;
acMonitorTimeout = 1800;
acLockTimeout = 600;
acSuspendTimeout = 0;
batteryMonitorTimeout = 600;
batteryLockTimeout = 300;
batterySuspendTimeout = 1800;
# Power Menu
powerMenuActions = [
"reboot"
"logout"
"poweroff"
"lock"
"suspend"
];
powerMenuDefaultAction = "lock";
};
};
systemd.user.services = {
# A hack to always serve fresh settings from default-settings.json
dms-clean-settings = {
Unit = {
Description = "Delete DankMaterialShell settings before dms starts";
Before = ["dms.service"];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/rm -f %h/.config/DankMaterialShell/settings.json";
};
Install.WantedBy = ["dms.service"];
};
};
};
}

View file

@ -1,43 +0,0 @@
{username, ...}: {
fireproof.home-manager = {
home.file.".config/DankMaterialShell/colors.json".text = builtins.toJSON {
name = "custom";
primary = "#CF6A4C";
primaryText = "#F2F0E5";
primaryContainer = "#403E3C";
secondary = "#CE5D97";
surface = "#343331";
surfaceText = "#DAD8CE";
surfaceVariant = "#1C1B1A";
surfaceVariantText = "#B7B5AC";
surfaceTint = "#CF6A4C";
background = "#100F0F";
backgroundText = "#F2F0E5";
outline = "#878580";
surfaceContainer = "#1C1B1A";
surfaceContainerHigh = "#282726";
surfaceContainerHighest = "#403E3C";
error = "#D14D41";
warning = "#D0A215";
info = "#4385BE";
matugen_type = "scheme-expressive";
};
programs.dankMaterialShell.default.settings = {
# Color theme
currentThemeName = "custom";
customThemeFile = "/home/${username}/.config/DankMaterialShell/colors.json";
widgetBackgroundColor = "sth";
widgetColorMode = "default";
# General
cornerRadius = 8;
# Font
fontFamily = "Inter Variable";
monoFontFamily = "Hack Nerd Font Mono";
fontWeight = 400;
fontScale = 1;
};
};
}

View file

@ -1,6 +0,0 @@
{pkgs, ...}: {
fonts.enableDefaultPackages = true;
fonts.packages = with pkgs; [
nerd-fonts.hack
];
}

View file

@ -1,10 +0,0 @@
{pkgs, ...}: {
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --user-menu";
};
};
};
}

View file

@ -1,47 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
nautilus
gnome-photos
];
services.gvfs.enable = true;
programs = {
dconf.enable = true;
nautilus-open-any-terminal.enable = true;
seahorse.enable = true;
evince.enable = true;
};
services.gnome.sushi.enable = true;
fireproof.home-manager = {
home.pointerCursor = {
gtk.enable = true;
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
size = 24;
};
gtk = {
enable = true;
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Qogir-dark";
package = pkgs.qogir-icon-theme;
};
gtk3.extraConfig = {gtk-application-prefer-dark-theme = true;};
gtk3.extraCss = builtins.readFile ./theme.css;
gtk4.extraConfig = {gtk-application-prefer-dark-theme = true;};
gtk4.extraCss = builtins.readFile ./theme.css;
};
dconf = {
enable = true;
settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
};
}

View file

@ -1,326 +0,0 @@
{
pkgs,
inputs,
config,
lib,
...
}: let
primaryMonitorName = (builtins.head config.monitors).name or "";
in {
# TODO: Move these to a separate module
programs.xwayland.enable = true;
fireproof.home-manager.programs.waybar = {
enable = true;
systemd.enable = true;
systemd.target = "niri.target";
settings = {
bar = {
layer = "top";
position = "top";
modules-left = ["clock" "niri/workspaces"];
modules-center = ["niri/window"];
modules-right = ["backlight" "battery" "pulseaudio" "tray"];
pulseaudio = {
format = "{volume}% {icon}";
format-muted = "󰝟 ";
format-icons = {
default = ["󰕿 " "󰖀 " "󰕾 "];
headphone = "󰋋 ";
};
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
};
};
style = ''
* {
font-family: Hack Nerd Font Mono;
font-size: 14px;
}
window#waybar, #clock, #pulseaudio, #battery, #backlight, #tray {
background: #1C1B1A;
color: #DAD8CE;
border-bottom: 2px solid #CF6A4C;
}
#workspaces button.focused {
background: #CF6A4C;
color: #1C1B1A;
box-shadow: 0 0 0 #CF6A4C;
}
/* Default */
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;
}
/* 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;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#window,
#workspaces {
margin: 0 4px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}'';
};
xdg.portal = {
enable = true;
extraPortals = [pkgs.xdg-desktop-portal-gtk];
config.common.default = "gnome";
xdgOpenUsePortal = true;
};
programs.niri = {
enable = true;
package = inputs.niri.packages."${pkgs.system}".niri-unstable;
};
fireproof.home-manager.programs.niri.settings = {
prefer-no-csd = true;
clipboard.disable-primary = true;
spawn-at-startup = [
{command = ["systemctl" "--user" "start" "hypridle"];}
{command = ["systemctl" "--user" "start" "hyprpaper"];}
{command = ["systemctl" "--user" "start" "mako"];}
{command = ["systemctl" "--user" "start" "waybar"];}
];
xwayland-satellite = {
enable = true;
path = lib.getExe inputs.niri.packages."${pkgs.system}".xwayland-satellite-unstable;
};
environment = {
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland"; # Attempt to fix screen recording issue
};
layout = {
gaps = 10;
focus-ring.enable = false;
insert-hint.display.color = "#CF6A4C";
border = {
enable = true;
width = 2;
active.color = "#CF6A4C";
inactive.color = "#343331";
};
tab-indicator = {
hide-when-single-tab = true;
place-within-column = true;
gap = 2;
position = "top";
corner-radius = 8;
};
};
input = {
focus-follows-mouse = {
enable = true;
max-scroll-amount = "0%";
};
mouse.accel-profile = "flat";
keyboard.xkb.layout = "eu";
};
window-rules = [
{
clip-to-geometry = true;
geometry-corner-radius = {
top-left = 8.0;
top-right = 8.0;
bottom-left = 8.0;
bottom-right = 8.0;
};
}
];
workspaces = lib.mkIf (primaryMonitorName != "") {
"01" = {
open-on-output = primaryMonitorName;
};
"02" = {
open-on-output = primaryMonitorName;
};
"03" = {
open-on-output = primaryMonitorName;
};
"04" = {
open-on-output = primaryMonitorName;
};
"05" = {
open-on-output = primaryMonitorName;
};
};
binds = {
"XF86AudioRaiseVolume" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "increment" "3"];
};
"XF86AudioLowerVolume" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "decrement" "3"];
};
"XF86AudioMute" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "mute"];
};
"XF86AudioMicMute" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "micmute"];
};
"XF86MonBrightnessUp" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "brightness" "increment" "5"];
};
"XF86MonBrightnessDown" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "brightness" "decrement" "5"];
};
"Mod+N" = {
action.spawn = ["dms" "ipc" "notifications" "toggle"];
hotkey-overlay.title = "Toggle Notification Center";
};
"Mod+V" = {
action.spawn = ["dms" "ipc" "clipboard" "toggle"];
hotkey-overlay.title = "Toggle Clipboard Manager";
};
"Mod+Space" = {
action.spawn = ["dms" "ipc" "spotlight" "toggle"];
hotkey-overlay.title = "Toggle Application Launcher";
};
"Mod+P" = {
action.spawn = ["dms" "ipc" "powermenu" "toggle"];
hotkey-overlay.title = "Toggle Power Menu";
};
"Mod+Left".action.focus-column-or-monitor-left = {};
"Mod+Down".action.focus-window-or-monitor-down = {};
"Mod+Up".action.focus-window-or-monitor-up = {};
"Mod+Right".action.focus-column-or-monitor-right = {};
"Mod+H".action.focus-column-or-monitor-left = {};
"Mod+J".action.focus-window-or-monitor-down = {};
"Mod+K".action.focus-window-or-monitor-up = {};
"Mod+L".action.focus-column-or-monitor-right = {};
"Mod+Shift+Left".action.move-column-left-or-to-monitor-left = {};
"Mod+Shift+Down".action.move-window-down = {};
"Mod+Shift+Up".action.move-window-up = {};
"Mod+Shift+Right".action.move-column-right-or-to-monitor-right = {};
"Mod+Shift+H".action.move-column-left-or-to-monitor-left = {};
"Mod+Shift+J".action.move-window-down = {};
"Mod+Shift+K".action.move-window-up = {};
"Mod+Shift+L".action.move-column-right-or-to-monitor-right = {};
"Mod+Home".action.focus-column-first = {};
"Mod+End".action.focus-column-last = {};
"Mod+Shift+Home".action.move-column-to-first = {};
"Mod+Shift+End".action.move-column-to-last = {};
"Mod+Ctrl+Left".action.focus-monitor-left = {};
"Mod+Ctrl+Down".action.focus-monitor-down = {};
"Mod+Ctrl+Up".action.focus-monitor-up = {};
"Mod+Ctrl+Right".action.focus-monitor-right = {};
"Mod+Ctrl+H".action.focus-monitor-left = {};
"Mod+Ctrl+J".action.focus-monitor-down = {};
"Mod+Ctrl+K".action.focus-monitor-up = {};
"Mod+Ctrl+L".action.focus-monitor-right = {};
"Mod+F".action.maximize-column = {};
"Mod+Shift+F".action.fullscreen-window = {};
"Mod+M".action.toggle-column-tabbed-display = {};
"Mod+A".action.toggle-overview = {};
"Mod+S".action.toggle-window-floating = {};
"Mod+C".action.switch-preset-column-width = {};
"Mod+Z".action.set-column-width = "-5%";
"Mod+X".action.set-column-width = "+5%";
"Mod+Ctrl+X".action.expand-column-to-available-width = {};
"Mod+Shift+Z".action.set-window-height = "-5%";
"Mod+Shift+X".action.set-window-height = "+5%";
"Mod+Shift+WheelScrollDown".action.focus-workspace-down = {};
"Mod+Shift+WheelScrollUp".action.focus-workspace-up = {};
"Mod+WheelScrollDown".action.focus-column-right = {};
"Mod+WheelScrollUp".action.focus-column-left = {};
"Mod+WheelScrollRight".action.focus-column-right = {};
"Mod+WheelScrollLeft".action.focus-column-left = {};
"Mod+Shift+WheelScrollRight".action.move-column-right = {};
"Mod+Shift+WheelScrollLeft".action.move-column-left = {};
"Mod+q".action.focus-workspace = "01";
"Mod+w".action.focus-workspace = "02";
"Mod+e".action.focus-workspace = "03";
"Mod+r".action.focus-workspace = "04";
"Mod+t".action.focus-workspace = "05";
"Mod+Shift+q".action.move-column-to-workspace = "01";
"Mod+Shift+w".action.move-column-to-workspace = "02";
"Mod+Shift+e".action.move-column-to-workspace = "03";
"Mod+Shift+r".action.move-column-to-workspace = "04";
"Mod+Shift+t".action.move-column-to-workspace = "05";
"Mod+Comma".action.consume-or-expel-window-left = {};
"Mod+Period".action.consume-or-expel-window-right = {};
"Print".action.screenshot = {};
"Ctrl+Print".action.screenshot-screen = {};
"Alt+Print".action.screenshot-window = {};
"Mod+Slash".action.show-hotkey-overlay = {};
"Mod+Return".action.spawn = ["ghostty"];
"Mod+Backspace".action.close-window = {};
};
outputs = lib.mkIf (config.monitors != []) (
lib.listToAttrs (map (monitor: {
inherit (monitor) name;
value = {
inherit (monitor) position;
mode = {
inherit (monitor.resolution) width height;
refresh = monitor.refreshRateNiri or null;
};
focus-at-startup = monitor.name == primaryMonitorName;
transform.rotation =
if (monitor.transform != null)
then monitor.transform * 90
else 0;
};
})
config.monitors)
);
};
}

View file

@ -1,7 +0,0 @@
_: {
qt = {
enable = true;
platformTheme = "gnome";
style = "adwaita-dark";
};
}

View file

@ -1,25 +0,0 @@
{
pkgsUnstable,
username,
config,
...
}: {
age.secrets.llm-api-key = {
rekeyFile = ../../secrets/llm-api-key.env.age;
mode = "0600";
owner = username;
};
environment.systemPackages = with pkgsUnstable; [
aider-chat
];
fireproof.home-manager = {
home.file.".aider.conf.yml".text = ''
# Aider configuration file
# This file is used to configure the Aider chat client
# It is a YAML file
sonnet: true
env-file: ${config.age.secrets.llm-api-key.path}
'';
};
}

View file

@ -9,7 +9,6 @@
./dev/docker.nix
./dev/tilt.nix
./dev/postgres.nix
./dev/aider.nix
./dev/clickhouse.nix
./dev/playwright.nix
./dev/nats.nix

View file

@ -1,14 +1,5 @@
{
imports = [
./hardware/monitors.nix
./hardware/audio.nix
./desktop/fonts.nix
./desktop/greetd.nix
./desktop/niri.nix
./desktop/gtk/default.nix
./desktop/qt.nix
./desktop/dms/default.nix
./desktop/screenshot.nix
./apps/spotify.nix
./apps/firefox.nix
./apps/chromium.nix

View file

@ -1,5 +1,5 @@
_: {
config = {
{ lib, config, ... }: {
config = lib.mkIf config.fireproof.desktop.enable {
security.rtkit.enable = true;
services.pipewire = {
enable = true;

View file

@ -0,0 +1,26 @@
{
config,
lib,
...
}: {
options.fireproof.desktop = {
enable = lib.mkEnableOption "Enable desktop environment with niri, greetd, and all desktop features";
};
imports = [
./monitors.nix
./audio.nix
./fonts.nix
./greetd.nix
./niri.nix
./qt.nix
./screenshot.nix
./gtk/default.nix
./dms/default.nix
];
config = lib.mkIf config.fireproof.desktop.enable {
# All desktop-related configuration is handled by the individual modules
# which check for fireproof.desktop.enable
};
}

View file

@ -1,6 +1,7 @@
{
pkgs,
config,
lib,
pkgs,
...
}: let
background = pkgs.stdenvNoCC.mkDerivation {
@ -34,24 +35,26 @@
geometryPng
];
in {
fireproof.home-manager = {
# Use hyprpaper as we can't currently set wallpapers through DMS
services.hyprpaper = {
enable = true;
settings = {
preload = pngs;
wallpaper = [",${builtins.head pngs}"];
config = lib.mkIf config.fireproof.desktop.enable {
fireproof.home-manager = {
# Use hyprpaper as we can't currently set wallpapers through DMS
services.hyprpaper = {
enable = true;
settings = {
preload = pngs;
wallpaper = [",${builtins.head pngs}"];
};
};
};
programs.dankMaterialShell.default.settings = {
# Disables wallpaper management in DMS to avoid conflicts with Hyprpaper
screenPreferences.wallpaper = [];
};
programs.dankMaterialShell.default.settings = {
# Disables wallpaper management in DMS to avoid conflicts with Hyprpaper
screenPreferences.wallpaper = [];
};
programs.dankMaterialShell.default.session = {
# Attempt to set a default wallpaper on first run
wallpaperPath = unknownPng;
programs.dankMaterialShell.default.session = {
# Attempt to set a default wallpaper on first run
wallpaperPath = unknownPng;
};
};
};
}

View file

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 282 KiB

Before After
Before After

View file

@ -1,4 +1,8 @@
{config, ...}: let
{
config,
lib,
...
}: let
commonBarSettings = {
enabled = true;
position = 0;
@ -74,18 +78,20 @@
}
// commonBarSettings;
in {
fireproof.home-manager = {
programs.dankMaterialShell.default.settings = {
launcherLogoMode = "os";
launcherLogoContrast = 1;
launcherLogoSizeOffset = 3;
config = lib.mkIf config.fireproof.desktop.enable {
fireproof.home-manager = {
programs.dankMaterialShell.default.settings = {
launcherLogoMode = "os";
launcherLogoContrast = 1;
launcherLogoSizeOffset = 3;
centeringMode = "geometric";
centeringMode = "geometric";
runningAppsCurrentWorkspace = true;
runningAppsGroupByApp = true;
runningAppsCurrentWorkspace = true;
runningAppsGroupByApp = true;
barConfigs = [primaryBar secondaryBar];
barConfigs = [primaryBar secondaryBar];
};
};
};
}

View file

@ -0,0 +1,74 @@
{
config,
lib,
inputs,
pkgs,
...
}: {
imports = [
./theme.nix
./background.nix
./bar.nix
];
config = lib.mkIf config.fireproof.desktop.enable {
systemd.user.services.niri-flake-polkit.enable = false;
fireproof.home-manager = {
imports = [
inputs.dankMaterialShell.homeModules.dankMaterialShell.default
];
programs.dankMaterialShell = {
enable = true;
enableDynamicTheming = false;
enableClipboard = false;
enableVPN = false;
enableCalendarEvents = false;
default.settings = {
# General Settings
weatherCoordinates = "56.1496278,10.2134046";
# Lock Screen
loginctlLockIntegration = true;
fadeToLockEnabled = true;
fadeToLockGracePeriod = 5;
acMonitorTimeout = 1800;
acLockTimeout = 600;
acSuspendTimeout = 0;
batteryMonitorTimeout = 600;
batteryLockTimeout = 300;
batterySuspendTimeout = 1800;
# Power Menu
powerMenuActions = [
"reboot"
"logout"
"poweroff"
"lock"
"suspend"
];
powerMenuDefaultAction = "lock";
};
};
systemd.user.services = {
# A hack to always serve fresh settings from default-settings.json
dms-clean-settings = {
Unit = {
Description = "Delete DankMaterialShell settings before dms starts";
Before = ["dms.service"];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/rm -f %h/.config/DankMaterialShell/settings.json";
};
Install.WantedBy = ["dms.service"];
};
};
};
};
}

View file

@ -0,0 +1,50 @@
{
config,
lib,
username,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
fireproof.home-manager = {
home.file.".config/DankMaterialShell/colors.json".text = builtins.toJSON {
name = "custom";
primary = "#CF6A4C";
primaryText = "#F2F0E5";
primaryContainer = "#403E3C";
secondary = "#CE5D97";
surface = "#343331";
surfaceText = "#DAD8CE";
surfaceVariant = "#1C1B1A";
surfaceVariantText = "#B7B5AC";
surfaceTint = "#CF6A4C";
background = "#100F0F";
backgroundText = "#F2F0E5";
outline = "#878580";
surfaceContainer = "#1C1B1A";
surfaceContainerHigh = "#282726";
surfaceContainerHighest = "#403E3C";
error = "#D14D41";
warning = "#D0A215";
info = "#4385BE";
matugen_type = "scheme-expressive";
};
programs.dankMaterialShell.default.settings = {
# Color theme
currentThemeName = "custom";
customThemeFile = "/home/${username}/.config/DankMaterialShell/colors.json";
widgetBackgroundColor = "sth";
widgetColorMode = "default";
# General
cornerRadius = 8;
# Font
fontFamily = "Inter Variable";
monoFontFamily = "Hack Nerd Font Mono";
fontWeight = 400;
fontScale = 1;
};
};
};
}

13
modules/desktop/fonts.nix Normal file
View file

@ -0,0 +1,13 @@
{
config,
lib,
pkgs,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
fonts.enableDefaultPackages = true;
fonts.packages = with pkgs; [
nerd-fonts.hack
];
};
}

View file

@ -0,0 +1,17 @@
{
config,
lib,
pkgs,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --user-menu";
};
};
};
};
}

View file

@ -0,0 +1,54 @@
{
config,
lib,
pkgs,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
environment.systemPackages = with pkgs; [
nautilus
gnome-photos
];
services.gvfs.enable = true;
programs = {
dconf.enable = true;
nautilus-open-any-terminal.enable = true;
seahorse.enable = true;
evince.enable = true;
};
services.gnome.sushi.enable = true;
fireproof.home-manager = {
home.pointerCursor = {
gtk.enable = true;
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
size = 24;
};
gtk = {
enable = true;
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Qogir-dark";
package = pkgs.qogir-icon-theme;
};
gtk3.extraConfig = {gtk-application-prefer-dark-theme = true;};
gtk3.extraCss = builtins.readFile ./theme.css;
gtk4.extraConfig = {gtk-application-prefer-dark-theme = true;};
gtk4.extraCss = builtins.readFile ./theme.css;
};
dconf = {
enable = true;
settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
};
};
}

328
modules/desktop/niri.nix Normal file
View file

@ -0,0 +1,328 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
primaryMonitorName = (builtins.head config.monitors).name or "";
in {
config = lib.mkIf config.fireproof.desktop.enable {
# TODO: Move these to a separate module
programs.xwayland.enable = true;
fireproof.home-manager.programs.waybar = {
enable = true;
systemd.enable = true;
systemd.target = "niri.target";
settings = {
bar = {
layer = "top";
position = "top";
modules-left = ["clock" "niri/workspaces"];
modules-center = ["niri/window"];
modules-right = ["backlight" "battery" "pulseaudio" "tray"];
pulseaudio = {
format = "{volume}% {icon}";
format-muted = "󰝟 ";
format-icons = {
default = ["󰕿 " "󰖀 " "󰕾 "];
headphone = "󰋋 ";
};
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
};
};
style = ''
* {
font-family: Hack Nerd Font Mono;
font-size: 14px;
}
window#waybar, #clock, #pulseaudio, #battery, #backlight, #tray {
background: #1C1B1A;
color: #DAD8CE;
border-bottom: 2px solid #CF6A4C;
}
#workspaces button.focused {
background: #CF6A4C;
color: #1C1B1A;
box-shadow: 0 0 0 #CF6A4C;
}
/* Default */
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;
}
/* 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;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#window,
#workspaces {
margin: 0 4px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}'';
};
xdg.portal = {
enable = true;
extraPortals = [pkgs.xdg-desktop-portal-gtk];
config.common.default = "gnome";
xdgOpenUsePortal = true;
};
programs.niri = {
enable = true;
package = inputs.niri.packages."${pkgs.system}".niri-unstable;
};
fireproof.home-manager.programs.niri.settings = {
prefer-no-csd = true;
clipboard.disable-primary = true;
spawn-at-startup = [
{command = ["systemctl" "--user" "start" "hypridle"];}
{command = ["systemctl" "--user" "start" "hyprpaper"];}
{command = ["systemctl" "--user" "start" "mako"];}
{command = ["systemctl" "--user" "start" "waybar"];}
];
xwayland-satellite = {
enable = true;
path = lib.getExe inputs.niri.packages."${pkgs.system}".xwayland-satellite-unstable;
};
environment = {
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland"; # Attempt to fix screen recording issue
};
layout = {
gaps = 10;
focus-ring.enable = false;
insert-hint.display.color = "#CF6A4C";
border = {
enable = true;
width = 2;
active.color = "#CF6A4C";
inactive.color = "#343331";
};
tab-indicator = {
hide-when-single-tab = true;
place-within-column = true;
gap = 2;
position = "top";
corner-radius = 8;
};
};
input = {
focus-follows-mouse = {
enable = true;
max-scroll-amount = "0%";
};
mouse.accel-profile = "flat";
keyboard.xkb.layout = "eu";
};
window-rules = [
{
clip-to-geometry = true;
geometry-corner-radius = {
top-left = 8.0;
top-right = 8.0;
bottom-left = 8.0;
bottom-right = 8.0;
};
}
];
workspaces = lib.mkIf (primaryMonitorName != "") {
"01" = {
open-on-output = primaryMonitorName;
};
"02" = {
open-on-output = primaryMonitorName;
};
"03" = {
open-on-output = primaryMonitorName;
};
"04" = {
open-on-output = primaryMonitorName;
};
"05" = {
open-on-output = primaryMonitorName;
};
};
binds = {
"XF86AudioRaiseVolume" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "increment" "3"];
};
"XF86AudioLowerVolume" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "decrement" "3"];
};
"XF86AudioMute" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "mute"];
};
"XF86AudioMicMute" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "audio" "micmute"];
};
"XF86MonBrightnessUp" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "brightness" "increment" "5"];
};
"XF86MonBrightnessDown" = {
allow-when-locked = true;
action.spawn = ["dms" "ipc" "brightness" "decrement" "5"];
};
"Mod+N" = {
action.spawn = ["dms" "ipc" "notifications" "toggle"];
hotkey-overlay.title = "Toggle Notification Center";
};
"Mod+V" = {
action.spawn = ["dms" "ipc" "clipboard" "toggle"];
hotkey-overlay.title = "Toggle Clipboard Manager";
};
"Mod+Space" = {
action.spawn = ["dms" "ipc" "spotlight" "toggle"];
hotkey-overlay.title = "Toggle Application Launcher";
};
"Mod+P" = {
action.spawn = ["dms" "ipc" "powermenu" "toggle"];
hotkey-overlay.title = "Toggle Power Menu";
};
"Mod+Left".action.focus-column-or-monitor-left = {};
"Mod+Down".action.focus-window-or-monitor-down = {};
"Mod+Up".action.focus-window-or-monitor-up = {};
"Mod+Right".action.focus-column-or-monitor-right = {};
"Mod+H".action.focus-column-or-monitor-left = {};
"Mod+J".action.focus-window-or-monitor-down = {};
"Mod+K".action.focus-window-or-monitor-up = {};
"Mod+L".action.focus-column-or-monitor-right = {};
"Mod+Shift+Left".action.move-column-left-or-to-monitor-left = {};
"Mod+Shift+Down".action.move-window-down = {};
"Mod+Shift+Up".action.move-window-up = {};
"Mod+Shift+Right".action.move-column-right-or-to-monitor-right = {};
"Mod+Shift+H".action.move-column-left-or-to-monitor-left = {};
"Mod+Shift+J".action.move-window-down = {};
"Mod+Shift+K".action.move-window-up = {};
"Mod+Shift+L".action.move-column-right-or-to-monitor-right = {};
"Mod+Home".action.focus-column-first = {};
"Mod+End".action.focus-column-last = {};
"Mod+Shift+Home".action.move-column-to-first = {};
"Mod+Shift+End".action.move-column-to-last = {};
"Mod+Ctrl+Left".action.focus-monitor-left = {};
"Mod+Ctrl+Down".action.focus-monitor-down = {};
"Mod+Ctrl+Up".action.focus-monitor-up = {};
"Mod+Ctrl+Right".action.focus-monitor-right = {};
"Mod+Ctrl+H".action.focus-monitor-left = {};
"Mod+Ctrl+J".action.focus-monitor-down = {};
"Mod+Ctrl+K".action.focus-monitor-up = {};
"Mod+Ctrl+L".action.focus-monitor-right = {};
"Mod+F".action.maximize-column = {};
"Mod+Shift+F".action.fullscreen-window = {};
"Mod+M".action.toggle-column-tabbed-display = {};
"Mod+A".action.toggle-overview = {};
"Mod+S".action.toggle-window-floating = {};
"Mod+C".action.switch-preset-column-width = {};
"Mod+Z".action.set-column-width = "-5%";
"Mod+X".action.set-column-width = "+5%";
"Mod+Ctrl+X".action.expand-column-to-available-width = {};
"Mod+Shift+Z".action.set-window-height = "-5%";
"Mod+Shift+X".action.set-window-height = "+5%";
"Mod+Shift+WheelScrollDown".action.focus-workspace-down = {};
"Mod+Shift+WheelScrollUp".action.focus-workspace-up = {};
"Mod+WheelScrollDown".action.focus-column-right = {};
"Mod+WheelScrollUp".action.focus-column-left = {};
"Mod+WheelScrollRight".action.focus-column-right = {};
"Mod+WheelScrollLeft".action.focus-column-left = {};
"Mod+Shift+WheelScrollRight".action.move-column-right = {};
"Mod+Shift+WheelScrollLeft".action.move-column-left = {};
"Mod+q".action.focus-workspace = "01";
"Mod+w".action.focus-workspace = "02";
"Mod+e".action.focus-workspace = "03";
"Mod+r".action.focus-workspace = "04";
"Mod+t".action.focus-workspace = "05";
"Mod+Shift+q".action.move-column-to-workspace = "01";
"Mod+Shift+w".action.move-column-to-workspace = "02";
"Mod+Shift+e".action.move-column-to-workspace = "03";
"Mod+Shift+r".action.move-column-to-workspace = "04";
"Mod+Shift+t".action.move-column-to-workspace = "05";
"Mod+Comma".action.consume-or-expel-window-left = {};
"Mod+Period".action.consume-or-expel-window-right = {};
"Print".action.screenshot = {};
"Ctrl+Print".action.screenshot-screen = {};
"Alt+Print".action.screenshot-window = {};
"Mod+Slash".action.show-hotkey-overlay = {};
"Mod+Return".action.spawn = ["ghostty"];
"Mod+Backspace".action.close-window = {};
};
outputs = lib.mkIf (config.monitors != []) (
lib.listToAttrs (map (monitor: {
inherit (monitor) name;
value = {
inherit (monitor) position;
mode = {
inherit (monitor.resolution) width height;
refresh = monitor.refreshRateNiri or null;
};
focus-at-startup = monitor.name == primaryMonitorName;
transform.rotation =
if (monitor.transform != null)
then monitor.transform * 90
else 0;
};
})
config.monitors)
);
};
};
}

13
modules/desktop/qt.nix Normal file
View file

@ -0,0 +1,13 @@
{
config,
lib,
...
}: {
config = lib.mkIf config.fireproof.desktop.enable {
qt = {
enable = true;
platformTheme = "gnome";
style = "adwaita-dark";
};
};
}

View file

@ -1,6 +1,7 @@
{
pkgs,
config,
lib,
pkgs,
...
}: let
screenshotPkg = pkgs.writeShellScriptBin "screenshot" ''
@ -8,7 +9,9 @@
${lib.getExe pkgs.grim} -t ppm -g "$AREA" - | ${lib.getExe pkgs.satty} -f - --initial-tool=arrow --early-exit --copy-command=${pkgs.wl-clipboard}/bin/wl-copy --action-on-enter="save-to-clipboard" --disable-notifications
'';
in {
environment.systemPackages = [
screenshotPkg
];
config = lib.mkIf config.fireproof.desktop.enable {
environment.systemPackages = [
screenshotPkg
];
};
}