diff --git a/flake-modules/hosts.nix b/flake-modules/hosts.nix index 46e190c..f8ca056 100644 --- a/flake-modules/hosts.nix +++ b/flake-modules/hosts.nix @@ -6,19 +6,17 @@ system = "x86_64-linux"; }; - # Test configuration using new home/ structure test = { hostName = "nimeses"; configFile = "test"; # Uses hosts/nimeses/test.nix system = "x86_64-linux"; }; - # Uncomment when ready: - # prometheus = { - # hostName = "prometheus"; - # configFile = "prometheus"; - # system = "x86_64-linux"; - # }; + prometheus = { + hostName = "prometheus"; + configFile = "prometheus"; + system = "x86_64-linux"; + }; # hephaistos = { # hostName = "hephaistos"; diff --git a/home/desktop/compositors/default.nix b/home/desktop/compositors/default.nix index 600899a..1b048cb 100644 --- a/home/desktop/compositors/default.nix +++ b/home/desktop/compositors/default.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.my.user.compositors; -in { +in +{ imports = [ ./hyprland ./niri @@ -19,7 +21,7 @@ in { terminal-filechooser = { enable = lib.mkEnableOption "terminal file chooser (yazi)"; - + terminal = lib.mkOption { type = lib.types.str; default = "ghostty"; @@ -80,7 +82,7 @@ in { focus = { followsMouse = lib.mkOption { type = lib.types.bool; - default = true; + default = false; description = "Focuses whatever window the mouse is on"; }; @@ -144,72 +146,76 @@ in { }; monitors = lib.mkOption { - type = lib.types.nullOr (lib.types.attrsOf (lib.types.submodule { - options = { - enable = lib.mkEnableOption "Enable this monitor"; + type = lib.types.nullOr ( + lib.types.attrsOf ( + lib.types.submodule { + options = { + enable = lib.mkEnableOption "Enable this monitor"; + + resolution = { + width = lib.mkOption { + type = lib.types.int; + description = "Monitor width in pixels"; + example = 2880; + }; + + height = lib.mkOption { + type = lib.types.int; + description = "Monitor height in pixels"; + example = 1920; + }; + }; - resolution = { - width = lib.mkOption { - type = lib.types.int; - description = "Monitor width in pixels"; - example = 2880; - }; + refreshRate = lib.mkOption { + type = lib.types.float; + description = "Monitor Refresh Rate in Hz"; + example = 120.0; + default = 60.0; + }; - height = lib.mkOption { - type = lib.types.int; - description = "Monitor height in pixels"; - example = 1920; - }; - }; + scale = lib.mkOption { + type = lib.types.float; + description = "Display scaling factor"; + default = 1.0; + example = 1.6; + }; - refreshRate = lib.mkOption { - type = lib.types.float; - description = "Monitor Refresh Rate in Hz"; - example = 120.0; - default = 60.0; - }; + position = { + x = lib.mkOption { + type = lib.types.int; + default = 0; + description = "X position in the layout"; + }; + + y = lib.mkOption { + type = lib.types.int; + default = 0; + description = "Y position in the layout"; + }; + }; - scale = lib.mkOption { - type = lib.types.float; - description = "Display scaling factor"; - default = 1.0; - example = 1.6; - }; + transform = lib.mkOption { + type = lib.types.enum [ + "0" # 0° - no rotation + "90" # 90° clockwise + "180" # 180° + "270" # 270° clockwise / 90° counter-clockwise + "flipped" # flipped horizontally + "flipped-90" + "flipped-180" + "flipped-270" + ]; + default = "0"; + description = "Monitor rotation/transform"; + }; - position = { - x = lib.mkOption { - type = lib.types.int; - default = 0; - description = "X position in the layout"; - }; + vrr.enable = lib.mkEnableOption "Enable variable refresh rate"; - y = lib.mkOption { - type = lib.types.int; - default = 0; - description = "Y position in the layout"; + primary = lib.mkEnableOption "Enable this monitor as primary"; }; - }; - - transform = lib.mkOption { - type = lib.types.enum [ - "0" # 0° - no rotation - "90" # 90° clockwise - "180" # 180° - "270" # 270° clockwise / 90° counter-clockwise - "flipped" # flipped horizontally - "flipped-90" - "flipped-180" - "flipped-270" - ]; - default = "0"; - description = "Monitor rotation/transform"; - }; - - vrr.enable = lib.mkEnableOption "Enable variable refresh rate"; - - primary = lib.mkEnableOption "Enable this monitor as primary"; - }; - })); + } + ) + ); default = null; example = { @@ -231,7 +237,7 @@ in { { assertions = [ { - assertion = cfg.enable -> (cfg.monitors != null && (builtins.attrNames cfg.monitors) != []); + assertion = cfg.enable -> (cfg.monitors != null && (builtins.attrNames cfg.monitors) != [ ]); message = '' You have to configure one Monitor when using compositors! @@ -247,10 +253,19 @@ in { } (lib.mkIf cfg.enable { - home.packages = with pkgs; - [] - ++ lib.optionals cfg.wayland.enable [xwayland-satellite-unstable wayland-utils] - ++ lib.optionals cfg.screenshots.enable [grim slurp wf-recorder swappy] + home.packages = + with pkgs; + [ ] + ++ lib.optionals cfg.wayland.enable [ + xwayland-satellite-unstable + wayland-utils + ] + ++ lib.optionals cfg.screenshots.enable [ + grim + slurp + wf-recorder + swappy + ] ++ lib.optionals cfg.terminal-filechooser.enable [ xdg-desktop-portal-termfilechooser xdg-terminal-exec @@ -276,13 +291,21 @@ in { fi if [ "$save" = "1" ]; then - exec ${pkgs.${cfg.terminal-filechooser.terminal}}/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" + exec ${ + pkgs.${cfg.terminal-filechooser.terminal} + }/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" elif [ "$directory" = "1" ]; then - exec ${pkgs.${cfg.terminal-filechooser.terminal}}/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" --cwd-file="$out.1" "$path" + exec ${ + pkgs.${cfg.terminal-filechooser.terminal} + }/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" --cwd-file="$out.1" "$path" elif [ "$multiple" = "1" ]; then - exec ${pkgs.${cfg.terminal-filechooser.terminal}}/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" + exec ${ + pkgs.${cfg.terminal-filechooser.terminal} + }/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" else - exec ${pkgs.${cfg.terminal-filechooser.terminal}}/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" + exec ${ + pkgs.${cfg.terminal-filechooser.terminal} + }/bin/${cfg.terminal-filechooser.terminal} --title=termfilechooser -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" fi ''; }; diff --git a/home/desktop/compositors/hyprland/default.nix b/home/desktop/compositors/hyprland/default.nix index 0b69647..8ec9521 100644 --- a/home/desktop/compositors/hyprland/default.nix +++ b/home/desktop/compositors/hyprland/default.nix @@ -4,7 +4,8 @@ pkgs, inputs, ... -}: let +}: +let cfg = config.my.user.compositors; # --- Workspace Bindings (1-9) --- @@ -79,7 +80,8 @@ "SUPER, N, exec, noctalia-shell ipc call launcher toggle" "SUPER, B, exec, noctalia-shell ipc call bar toggle" ]; -in { +in +{ options.my.user.compositors.hyprland = { enable = lib.mkEnableOption "Hyprland compositor"; @@ -92,7 +94,10 @@ in { }; layout = lib.mkOption { - type = lib.types.enum ["dwindle" "master"]; + type = lib.types.enum [ + "dwindle" + "master" + ]; default = "dwindle"; description = "which window layout to use"; }; @@ -107,22 +112,22 @@ in { xdg.portal = { enable = lib.mkDefault true; extraPortals = with pkgs; [ - xdg-desktop-portal-hyprland xdg-desktop-portal-gtk ]; config.hyprland = { - default = ["hyprland" "gtk"]; - } // lib.optionalAttrs cfg.terminal-filechooser.enable { - "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; + default = [ + "hyprland" + "gtk" + ]; + } + // lib.optionalAttrs cfg.terminal-filechooser.enable { + "org.freedesktop.impl.portal.FileChooser" = [ "termfilechooser" ]; }; }; - nix = { - package = lib.mkDefault pkgs.nix; - settings = { - substituters = ["https://hyprland.cachix.org"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; - }; + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; }; wayland.windowManager.hyprland = { @@ -130,25 +135,24 @@ in { package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; settings = { - monitor = - lib.mapAttrsToList ( - name: m: let - transformNum = - { - "0" = "0"; - "90" = "1"; - "180" = "2"; - "270" = "3"; - "flipped" = "4"; - "flipped-90" = "5"; - "flipped-180" = "6"; - "flipped-270" = "7"; - }.${ - m.transform - }; - in "${name},${toString m.resolution.width}x${toString m.resolution.height}@${toString (builtins.floor m.refreshRate)},${toString m.position.x}x${toString m.position.y},${toString m.scale},transform,${transformNum}" - ) - config.my.user.compositors.monitors; + monitor = lib.mapAttrsToList ( + name: m: + let + transformNum = + { + "0" = "0"; + "90" = "1"; + "180" = "2"; + "270" = "3"; + "flipped" = "4"; + "flipped-90" = "5"; + "flipped-180" = "6"; + "flipped-270" = "7"; + } + .${m.transform}; + in + "${name},${toString m.resolution.width}x${toString m.resolution.height}@${toString (builtins.floor m.refreshRate)},${toString m.position.x}x${toString m.position.y},${toString m.scale},transform,${transformNum}" + ) config.my.user.compositors.monitors; env = [ "NIXOS_OZONE_WL,1" @@ -164,12 +168,11 @@ in { ]; # --- Startup --- - exec-once = - [ - "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" - "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - ] - ++ lib.optional config.my.user.noctalia.enable "noctalia-shell"; + exec-once = [ + "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" + "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + ] + ++ lib.optional config.my.user.noctalia.enable "noctalia-shell"; general = { layout = cfg.hyprland.layout; @@ -213,10 +216,7 @@ in { input = { kb_layout = "de"; - follow_mouse = - if cfg.focus.followsMouse - then 1 - else 0; + follow_mouse = if cfg.focus.followsMouse then 1 else 0; touchpad = lib.mkIf cfg.input.touchpad.enable { natural_scroll = cfg.input.touchpad.naturalScroll; @@ -259,7 +259,7 @@ in { # --- Keybind List --- bind = - [] + [ ] ++ window_binds ++ workspace_binds ++ launching_binds diff --git a/home/desktop/compositors/niri/default.nix b/home/desktop/compositors/niri/default.nix index 2dd0f54..6d014a9 100644 --- a/home/desktop/compositors/niri/default.nix +++ b/home/desktop/compositors/niri/default.nix @@ -3,10 +3,18 @@ lib, pkgs, ... -}: let +}: +let cfg = config.my.user.compositors; - noctalia = cmd: ["noctalia-shell" "ipc" "call"] ++ (pkgs.lib.splitString " " cmd); + noctalia = + cmd: + [ + "noctalia-shell" + "ipc" + "call" + ] + ++ (pkgs.lib.splitString " " cmd); noctaliaBinds = { # --- Noctalia Binds (Using your helper) --- @@ -28,57 +36,81 @@ mouseBinds = { # Scroll through columns (windows) horizontally - "Mod+WheelScrollDown".action.focus-column-right = []; - "Mod+WheelScrollUp".action.focus-column-left = []; + "Mod+WheelScrollDown".action.focus-column-right = [ ]; + "Mod+WheelScrollUp".action.focus-column-left = [ ]; # Scroll through workspaces - "Mod+Ctrl+WheelScrollDown".action.focus-workspace-down = []; - "Mod+Ctrl+WheelScrollUp".action.focus-workspace-up = []; + "Mod+Ctrl+WheelScrollDown".action.focus-workspace-down = [ ]; + "Mod+Ctrl+WheelScrollUp".action.focus-workspace-up = [ ]; # Move windows with scroll - "Mod+Shift+WheelScrollDown".action.move-column-right = []; - "Mod+Shift+WheelScrollUp".action.move-column-left = []; + "Mod+Shift+WheelScrollDown".action.move-column-right = [ ]; + "Mod+Shift+WheelScrollUp".action.move-column-left = [ ]; }; screenshotsBinds = { # Full screen to clipboard - "Print".action.spawn = ["sh" "-c" "grim - | wl-copy"]; + "Print".action.spawn = [ + "sh" + "-c" + "grim - | wl-copy" + ]; # Full screen to file - "Shift+Print".action.spawn = ["sh" "-c" "grim ~/pictures/screenshot-$(date +%Y%m%d-%H%M%S).png"]; + "Shift+Print".action.spawn = [ + "sh" + "-c" + "grim ~/pictures/screenshot-$(date +%Y%m%d-%H%M%S).png" + ]; # Select area to clipboard - "Mod+Print".action.spawn = ["sh" "-c" "grim -g \"$(slurp)\" - | wl-copy"]; + "Mod+Print".action.spawn = [ + "sh" + "-c" + "grim -g \"$(slurp)\" - | wl-copy" + ]; # Select area to file - "Mod+Shift+Print".action.spawn = ["sh" "-c" "grim -g \"$(slurp)\" ~/pictures/screenshot-$(date +%Y%m%d-%H%M%S).png"]; + "Mod+Shift+Print".action.spawn = [ + "sh" + "-c" + "grim -g \"$(slurp)\" ~/pictures/screenshot-$(date +%Y%m%d-%H%M%S).png" + ]; # Select area and annotate with swappy - "Control+Print".action.spawn = ["sh" "-c" "grim -g \"$(slurp)\" - | swappy -f -"]; + "Control+Print".action.spawn = [ + "sh" + "-c" + "grim -g \"$(slurp)\" - | swappy -f -" + ]; }; defaultBinds = { - "Mod+Return".action.spawn = ["ghostty"]; - "Mod+e".action.spawn = ["ghostty" "-e" "yazi"]; - "Mod+o".action.toggle-overview = []; + "Mod+Return".action.spawn = [ "ghostty" ]; + "Mod+e".action.spawn = [ + "ghostty" + "-e" + "yazi" + ]; + "Mod+o".action.toggle-overview = [ ]; # --- Window Management --- - "Mod+q".action.close-window = []; - "Mod+j".action.focus-window-down = []; - "Mod+k".action.focus-window-up = []; - "Mod+h".action.focus-column-left-or-last = []; - "Mod+l".action.focus-column-right-or-first = []; + "Mod+q".action.close-window = [ ]; + "Mod+j".action.focus-window-down = [ ]; + "Mod+k".action.focus-window-up = [ ]; + "Mod+h".action.focus-column-left-or-last = [ ]; + "Mod+l".action.focus-column-right-or-first = [ ]; - "Mod+Shift+j".action.move-window-down = []; - "Mod+Shift+k".action.move-window-up = []; - "Mod+Shift+h".action.move-column-left-or-to-monitor-left = []; - "Mod+Shift+l".action.move-column-right-or-to-monitor-right = []; + "Mod+Shift+j".action.move-window-down = [ ]; + "Mod+Shift+k".action.move-window-up = [ ]; + "Mod+Shift+h".action.move-column-left-or-to-monitor-left = [ ]; + "Mod+Shift+l".action.move-column-right-or-to-monitor-right = [ ]; # "Consume": Pull the window from the right into the current column (Stacking it) - "Mod+Comma".action.consume-window-into-column = []; + "Mod+Comma".action.consume-window-into-column = [ ]; # "Expel": Kick the focused window out of the stack into its own column - "Mod+Period".action.expel-window-from-column = []; + "Mod+Period".action.expel-window-from-column = [ ]; # --- Resizing --- "Mod+Control+l".action.set-column-width = "+10%"; @@ -87,9 +119,9 @@ "Mod+Control+j".action.set-window-height = "-10%"; # --- Fullscreen / Maximize --- - "Mod+f".action.maximize-column = []; - "Mod+Shift+f".action.maximize-window-to-edges = []; - "Mod+Escape".action.quit = []; + "Mod+f".action.maximize-column = [ ]; + "Mod+Shift+f".action.maximize-window-to-edges = [ ]; + "Mod+Escape".action.quit = [ ]; # Switch to workspace "Mod+1".action.focus-workspace = 1; @@ -113,7 +145,8 @@ "Mod+Shift+8".action.move-window-to-workspace = 8; "Mod+Shift+9".action.move-window-to-workspace = 9; }; -in { +in +{ options.my.user.compositors.niri = { enable = lib.mkEnableOption "Niri compositor"; @@ -124,7 +157,7 @@ in { }; }; config = lib.mkIf cfg.niri.enable { - home.packages = [cfg.niri.package]; + home.packages = [ cfg.niri.package ]; xdg.portal = { enable = lib.mkDefault true; @@ -132,34 +165,37 @@ in { xdg-desktop-portal-gnome xdg-desktop-portal-gtk ]; - config.niri = lib.mkForce ({ - default = ["gnome" "gtk"]; - "org.freedesktop.impl.portal.ScreenCast" = ["gnome"]; - "org.freedesktop.impl.portal.Screenshot" = ["gnome"]; - "org.freedesktop.impl.portal.RemoteDesktop" = ["gnome"]; - "org.freedesktop.impl.portal.Inhibit" = ["gnome"]; - "org.freedesktop.impl.portal.Settings" = ["gnome"]; - "org.freedesktop.impl.portal.DynamicLauncher" = ["gnome"]; - "org.freedesktop.impl.portal.Wallpaper" = ["gnome"]; - "org.freedesktop.impl.portal.AppChooser" = ["gtk"]; - "org.freedesktop.impl.portal.Print" = ["gtk"]; - "org.freedesktop.impl.portal.Notification" = ["gtk"]; - "org.freedesktop.impl.portal.Account" = ["gtk"]; - "org.freedesktop.impl.portal.Background" = ["gtk"]; - "org.freedesktop.impl.portal.Email" = ["gtk"]; - "org.freedesktop.impl.portal.OpenURI" = ["gtk"]; - "org.freedesktop.impl.portal.Secret" = ["gnome-keyring"]; - } // lib.optionalAttrs cfg.terminal-filechooser.enable { - "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; - }); + config.niri = lib.mkForce ( + { + default = [ + "gnome" + "gtk" + ]; + "org.freedesktop.impl.portal.ScreenCast" = [ "gnome" ]; + "org.freedesktop.impl.portal.Screenshot" = [ "gnome" ]; + "org.freedesktop.impl.portal.RemoteDesktop" = [ "gnome" ]; + "org.freedesktop.impl.portal.Inhibit" = [ "gnome" ]; + "org.freedesktop.impl.portal.Settings" = [ "gnome" ]; + "org.freedesktop.impl.portal.DynamicLauncher" = [ "gnome" ]; + "org.freedesktop.impl.portal.Wallpaper" = [ "gnome" ]; + "org.freedesktop.impl.portal.AppChooser" = [ "gtk" ]; + "org.freedesktop.impl.portal.Print" = [ "gtk" ]; + "org.freedesktop.impl.portal.Notification" = [ "gtk" ]; + "org.freedesktop.impl.portal.Account" = [ "gtk" ]; + "org.freedesktop.impl.portal.Background" = [ "gtk" ]; + "org.freedesktop.impl.portal.Email" = [ "gtk" ]; + "org.freedesktop.impl.portal.OpenURI" = [ "gtk" ]; + "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; + } + // lib.optionalAttrs cfg.terminal-filechooser.enable { + "org.freedesktop.impl.portal.FileChooser" = [ "termfilechooser" ]; + } + ); }; - nix = { - package = lib.mkDefault pkgs.nix; - settings = { - substituters = ["https://niri.cachix.org"]; - trusted-public-keys = ["niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964="]; - }; + nix.settings = { + substituters = [ "https://niri.cachix.org" ]; + trusted-public-keys = [ "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" ]; }; systemd.user.services.libinput-gestures = lib.mkIf cfg.input.touchpad.enable { @@ -199,31 +235,28 @@ in { prefer-no-csd = true; - spawn-at-startup = - [ - {sh = "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP";} - {sh = "${pkgs.xwayland-satellite-unstable}/bin/xwayland-satellite";} - ] - ++ lib.optional cfg.input.touchpad.enable {argv = ["libinput-gestures-start"];} - ++ lib.optional config.my.user.noctalia.enable {command = ["noctalia-shell"];}; - - outputs = - lib.mapAttrs (name: m: { - scale = m.scale; - variable-refresh-rate = m.vrr.enable; - mode = { - width = m.resolution.width; - height = m.resolution.height; - refresh = m.refreshRate; - }; - position = { - x = m.position.x; - y = m.position.y; - }; - # TODO: Figure out correct transform format for Niri - # transform = m.transform; - }) - config.my.user.compositors.monitors; + spawn-at-startup = [ + { sh = "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"; } + { sh = "${pkgs.xwayland-satellite-unstable}/bin/xwayland-satellite"; } + ] + ++ lib.optional cfg.input.touchpad.enable { argv = [ "libinput-gestures-start" ]; } + ++ lib.optional config.my.user.noctalia.enable { command = [ "noctalia-shell" ]; }; + + outputs = lib.mapAttrs (name: m: { + scale = m.scale; + variable-refresh-rate = m.vrr.enable; + mode = { + width = m.resolution.width; + height = m.resolution.height; + refresh = m.refreshRate; + }; + position = { + x = m.position.x; + y = m.position.y; + }; + # TODO: Figure out correct transform format for Niri + # transform = m.transform; + }) config.my.user.compositors.monitors; layout = { gaps = cfg.appearance.gaps; @@ -239,45 +272,51 @@ in { background-color = "rgba(107, 229, 91, 0)"; center-focused-column = "never"; default-column-display = "normal"; - default-column-width = {proportion = 1.0;}; + default-column-width = { + proportion = 1.0; + }; }; layer-rules = - [] + [ ] ++ lib.optional config.my.user.noctalia.enable { - matches = [{namespace = "^noctalia-wallpaper.*";}]; + matches = [ { namespace = "^noctalia-wallpaper.*"; } ]; place-within-backdrop = true; }; window-rules = [ { - geometry-corner-radius = let - # Convert int to float by multiplying by 1.0 - radius = cfg.appearance.radius * 1.0; - in { - top-left = radius; - top-right = radius; - bottom-left = radius; - bottom-right = radius; - }; + geometry-corner-radius = + let + # Convert int to float by multiplying by 1.0 + radius = cfg.appearance.radius * 1.0; + in + { + top-left = radius; + top-right = radius; + bottom-left = radius; + bottom-right = radius; + }; clip-to-geometry = true; draw-border-with-background = false; } { - matches = [{is-focused = false;}]; + matches = [ { is-focused = false; } ]; opacity = cfg.appearance.opacity.inactive; } { - matches = [{is-focused = true;}]; + matches = [ { is-focused = true; } ]; opacity = cfg.appearance.opacity.active; } { - matches = [{app-id = "^com\.mitchellh\.ghostty$";}]; - default-column-width = {proportion = 0.5;}; + matches = [ { app-id = "^com\.mitchellh\.ghostty$"; } ]; + default-column-width = { + proportion = 0.5; + }; } { @@ -288,7 +327,9 @@ in { } ]; opacity = 0.95; - default-column-width = {proportion = 0.5;}; + default-column-width = { + proportion = 0.5; + }; } { @@ -321,7 +362,7 @@ in { }; binds = - {} + { } // defaultBinds // lib.optionalAttrs cfg.input.mouse.enable mouseBinds // lib.optionalAttrs config.my.user.noctalia.enable noctaliaBinds diff --git a/home/development/editors/default.nix b/home/development/editors/default.nix index 48c984a..67a69c2 100644 --- a/home/development/editors/default.nix +++ b/home/development/editors/default.nix @@ -1,11 +1,12 @@ { config, lib, - pkgs, ... -}: let +}: +let mue = config.my.user.editor; -in { +in +{ imports = [ ./vscode.nix ./nixvim.nix @@ -19,7 +20,14 @@ in { enable = lib.mkEnableOption "enable editor configuration"; defaultEditor = lib.mkOption { - type = lib.types.enum ["code" "nvim" "vi" "helix" "nano" "zed"]; + type = lib.types.enum [ + "code" + "nvim" + "vi" + "helix" + "nano" + "zeditor" + ]; default = "nvim"; description = "Which editor to choose be default"; }; @@ -28,57 +36,62 @@ in { config = lib.mkIf mue.enable { home.sessionVariables = { EDITOR = - if (mue.defaultEditor == "code") - then "code --wait" - else if (mue.defaultEditor == "nvim") - then "nvim" - else if (mue.defaultEditor == "helix") - then "hx" - else if (mue.defaultEditor == "vi") - then "vi" - else if (mue.defaultEditor == "zed") - then "zed --wait" - else "nano"; + if (mue.defaultEditor == "code") then + "code --wait" + else if (mue.defaultEditor == "nvim") then + "nvim" + else if (mue.defaultEditor == "helix") then + "hx" + else if (mue.defaultEditor == "vi") then + "vi" + else if (mue.defaultEditor == "zeditor") then + "zeditor --wait" + else + "nano"; VISUAL = - if (mue.defaultEditor == "code") - then "code --wait" - else if (mue.defaultEditor == "nvim") - then "nvim" - else if (mue.defaultEditor == "helix") - then "hx" - else if (mue.defaultEditor == "vi") - then "vi" - else if (mue.defaultEditor == "zed") - then "zed --wait" - else "nano"; + if (mue.defaultEditor == "code") then + "code --wait" + else if (mue.defaultEditor == "nvim") then + "nvim" + else if (mue.defaultEditor == "helix") then + "hx" + else if (mue.defaultEditor == "vi") then + "vi" + else if (mue.defaultEditor == "zeditor") then + "zeditor --wait" + else + "nano"; }; - xdg.mimeApps = let - editorDesktop = - if mue.defaultEditor == "code" - then "code.desktop" - else if mue.defaultEditor == "nvim" - then "nvim.desktop" - else if mue.defaultEditor == "helix" - then "helix.desktop" - else if mue.defaultEditor == "vi" - then "vi.desktop" - else if mue.defaultEditor == "zed" - then "zed.desktop" - else "nano.desktop"; - in { - enable = true; + xdg.mimeApps = + let + editorDesktop = + if mue.defaultEditor == "code" then + "code.desktop" + else if mue.defaultEditor == "nvim" then + "nvim.desktop" + else if mue.defaultEditor == "helix" then + "helix.desktop" + else if mue.defaultEditor == "vi" then + "vi.desktop" + else if mue.defaultEditor == "zed" then + "zeditor.desktop" + else + "nano.desktop"; + in + { + enable = true; - defaultApplications = { - "text/x-nix" = [editorDesktop]; - "text/plain" = [editorDesktop]; - }; + defaultApplications = { + "text/x-nix" = [ editorDesktop ]; + "text/plain" = [ editorDesktop ]; + }; - associations.added = { - "text/x-nix" = [editorDesktop]; - "text/plain" = [editorDesktop]; + associations.added = { + "text/x-nix" = [ editorDesktop ]; + "text/plain" = [ editorDesktop ]; + }; }; - }; }; } diff --git a/home/development/editors/zed.nix b/home/development/editors/zed.nix index 11ed711..b35f59c 100644 --- a/home/development/editors/zed.nix +++ b/home/development/editors/zed.nix @@ -3,132 +3,15 @@ lib, pkgs, ... -}: let +}: +let cfg = config.my.user.editor.zed; - cdl = config.development.languages; -in { +in +{ options.my.user.editor.zed = { enable = lib.mkEnableOption "Zed editor"; - - theme = lib.mkOption { - type = lib.types.str; - default = "VSCode Dark Modern"; - description = "Zed color theme"; - }; - - font = lib.mkOption { - type = lib.types.str; - default = "Zed Plex Sans"; - description = "Editor font family"; - }; - - fontSize = lib.mkOption { - type = lib.types.int; - default = 16; - description = "Editor font size"; - }; - - formatOnSave = lib.mkOption { - type = lib.types.bool; - default = true; - description = "Auto-format on save"; - }; - - editingMode = lib.mkOption { - type = lib.types.enum ["normal" "vim" "helix"]; - default = "normal"; - description = "which mode of editing will be used"; - }; - - extraSettings = lib.mkOption { - type = lib.types.attrs; - default = {}; - description = "Additional Zed settings"; - }; }; - config = lib.mkIf cfg.enable { - home.packages = [pkgs.zed-editor-fhs]; - - xdg.configFile."zed/settings.json".text = builtins.toJSON ( - { - theme = cfg.theme; - - buffer_font_family = cfg.font; - buffer_font_size = cfg.fontSize; - - ui_font_family = cfg.font; - ui_font_size = cfg.fontSize; - - format_on_save = - if cfg.formatOnSave - then "on" - else "off"; - - vim_mode = cfg.editingMode == "vim"; - helix_mode = cfg.editingMode == "helix"; - - autosave = "on_focus_change"; - tab_bar = { - show = true; - }; - tabs = { - git_status = true; - }; - terminal = { - dock = "bottom"; - }; - - # LSP settings - lsp = { - rust-analyzer = lib.mkIf cdl.rust.enable { - binary = { - path = "${pkgs.rust-analyzer}/bin/rust-analyzer"; - }; - }; - nixd = lib.mkIf cdl.nix.enable { - binary = { - path = "${pkgs.nixd}/bin/nixd"; - }; - }; - pyright = lib.mkIf cdl.python.enable { - binary = { - path = "${pkgs.pyright}/bin/pyright-langserver"; - }; - }; - bash-language-server = lib.mkIf cdl.bash.enable { - binary = { - path = "${pkgs.bash-language-server}/bin/bash-language-server"; - }; - }; - gopls = lib.mkIf cdl.go.enable { - binary = { - path = "${pkgs.gopls}/bin/gopls"; - }; - }; - typescript-language-server = lib.mkIf cdl.javascript.enable { - binary = { - path = "${pkgs.typescript-language-server}/bin/typescript-language-server"; - }; - }; - yaml-language-server = lib.mkIf cdl.yaml.enable { - binary = { - path = "${pkgs.yaml-language-server}/bin/yaml-language-server"; - }; - }; - marksman = lib.mkIf cdl.markdown.enable { - binary = { - path = "${pkgs.marksman}/bin/marksman"; - }; - }; - clangd = lib.mkIf cdl.c.enable { - binary = { - path = "${pkgs.clang-tools}/bin/clangd"; - }; - }; - }; - } - // cfg.extraSettings - ); + home.packages = [ pkgs.zed-editor-fhs ]; }; } diff --git a/hosts/prometheus/default.nix b/hosts/prometheus/default.nix new file mode 100644 index 0000000..e6bf2ea --- /dev/null +++ b/hosts/prometheus/default.nix @@ -0,0 +1,52 @@ +{ + pkgs, + ... +}: +{ + imports = [ + ./hardware-configuration.nix + + ../../profiles/core.nix + ../../profiles/desktop.nix + ../../profiles/performance.nix + ../../profiles/gaming.nix + ../../profiles/virtualisation.nix + ]; + + programs.niri.enable = true; + programs.hyprland.enable = true; + + networking.hostName = "nimeses"; + system.stateVersion = "25.05"; + + users.users.prometheus = { + isNormalUser = true; + description = "Prometheus"; + home = "/home/prometheus"; + shell = pkgs.zsh; + extraGroups = [ + "networkmanager" + "wheel" + "gamemode" + "libvirtd" + "kvm" + ]; + }; + + networking.firewall = { + enable = true; + trustedInterfaces = [ "tailscale0" ]; + }; + + services.tailscale.enable = true; + + environment.variables = { + QT_QPA_PLATFORMTHEME = "qt6ct"; + }; + + environment.systemPackages = with pkgs; [ + ntfs3g + git + wget + ]; +} diff --git a/hosts/prometheus/hardware-configuration.nix b/hosts/prometheus/hardware-configuration.nix new file mode 100644 index 0000000..c1ae127 --- /dev/null +++ b/hosts/prometheus/hardware-configuration.nix @@ -0,0 +1,69 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + modulesPath, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "uas" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/61edc440-5d0c-4777-ab5f-950064c2c8bb"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/99C8-389D"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + swapDevices = [ + { + device = "/var/swapfile"; + size = 32 * 1024; # 16GB + } + ]; + + # Enable OpenGL + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/prometheus/prometheus.nix b/hosts/prometheus/prometheus.nix new file mode 100644 index 0000000..8b68023 --- /dev/null +++ b/hosts/prometheus/prometheus.nix @@ -0,0 +1,190 @@ +{ + pkgs, + lib, + ... +}: +{ + imports = [ + ../../lib/host.nix + ../../home/base.nix + ../../home/desktop + ../../home/development + ]; + + config = { + programs.home-manager.enable = true; + + nix.package = lib.mkForce pkgs.nix; + + host = { + username = "prometheus"; + hostname = "prometheus"; + git = { + name = "N1meses"; + email = "nilshasenthal@gmail.com"; + gpgKey = ""; + }; + stateVersion = "25.05"; + }; + + home = { + homeDirectory = "/home/prometheus"; + + sessionVariables = { + GDK_SCALE = "1"; + GDK_DPI_SCALE = "1"; + QT_SCALE_FACTOR = "1"; + QT_AUTO_SCREEN_SCALE_FACTOR = "0"; + HYPRLAND_NO_DPMS = "1"; + NIXOS_OZONE_WL = "1"; + TERMCMD = "ghostty -e"; + }; + + packages = with pkgs; [ + dbus + + #cli + btop + cbonsai + croc + cmatrix + trash-cli + imv + grim + todo + nom + nvd + nix-tree + tldr + + #themeing + qt6.qtdeclarative + matugen + adw-gtk3 + nwg-look + gnome-themes-extra + gucharmap + glib + + #applications + discord + libreoffice-qt6-fresh + gimp + zathura + file-roller + ]; + }; + + home.pointerCursor = { + gtk.enable = true; + x11.enable = true; + package = pkgs.nordzy-cursor-theme; + name = "Nordzy-cursors"; + size = 24; + }; + + development.languages = { + nix.enable = true; + bash.enable = true; + python.enable = false; + rust.enable = true; + java.enable = false; + markdown.enable = true; + puml.enable = false; + }; + + development.tools = { + enable = true; + git.enhanced = true; + direnv.enable = true; + ai.enable = true; + }; + + my.user = { + editor = { + enable = true; + defaultEditor = "zeditor"; + zed.enable = true; + helix = { + enable = true; + theme = "nox-default"; + }; + }; + + services = { + enable = true; + gnomeKeyring.enable = true; + security.gpg-agent.enable = true; + storage.udiskie.enable = true; + }; + + browser = { + enable = true; + brave.enable = true; + defaultBrowser = "brave"; + }; + + dotfiles = { + ghostty.enable = true; + yazi.enable = true; + nh.enable = true; + fastfetch.enable = true; + gtk.enable = true; + starship.enable = true; + }; + + noctalia.enable = true; + + compositors = { + enable = true; + + monitors."LG Electronics LG TV SSCR2 0x01010101" = { + resolution = { + width = 3840; + height = 2160; + }; + refreshRate = 120.0; + scale = 1.25; + transform = "0"; + vrr.enable = true; + position = { + x = 0; + y = 0; + }; + }; + + wayland.enable = true; + + terminal-filechooser.enable = true; + + screenshots.enable = true; + + animations.enable = true; + + appearance = { + gaps = 8; + border = { + enable = true; + width = 2; + }; + }; + + input = { + mouse.enable = true; + }; + + mangowc = { + enable = false; + }; + + hyprland = { + enable = true; + }; + + niri = { + enable = true; + }; + }; + }; + }; +} diff --git a/lib/host.nix b/lib/host.nix index b0bc553..06f8927 100644 --- a/lib/host.nix +++ b/lib/host.nix @@ -104,20 +104,6 @@ in { Add to your config: host.hostname = "your-hostname"; ''; } - { - assertion = cfg.git.name != null; - message = '' - ERROR: host.git.name is not set! - Add to your config: host.git.name = "Your Name"; - ''; - } - { - assertion = cfg.git.email != null; - message = '' - ERROR: host.git.email is not set! - Add to your config: host.git.email = "your@email.com"; - ''; - } ]; # Home Manager settings @@ -125,7 +111,6 @@ in { home = lib.mkIf (cfg.username != null) { username = cfg.username; - homeDirectory = homeDir; stateVersion = cfg.stateVersion; }; diff --git a/profiles/core.nix b/profiles/core.nix index c82db00..f612d68 100644 --- a/profiles/core.nix +++ b/profiles/core.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ time.timeZone = lib.mkDefault "Europe/Berlin"; console.keyMap = lib.mkDefault "de"; @@ -37,19 +38,28 @@ initrd.systemd.enable = lib.mkDefault true; initrd.verbose = lib.mkDefault false; - supportedFilesystems = lib.mkDefault ["ntfs3"]; + supportedFilesystems = lib.mkDefault [ "ntfs3" ]; }; networking.networkmanager.enable = lib.mkDefault true; networking.firewall.enable = lib.mkDefault true; programs.zsh.enable = lib.mkDefault true; - environment.shells = lib.mkDefault [pkgs.zsh pkgs.bashInteractive]; + environment.shells = lib.mkDefault [ + pkgs.zsh + pkgs.bashInteractive + ]; nix.settings = { - experimental-features = ["nix-command" "flakes"]; + experimental-features = [ + "nix-command" + "flakes" + ]; auto-optimise-store = true; - trusted-users = ["@wheel" "root"]; + trusted-users = [ + "@wheel" + "root" + ]; download-buffer-size = 524288000; http-connections = 50;