From 1133e01eff3efebedb8833b032825bc7d8833ffb Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Tue, 7 Jan 2025 20:18:30 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=A6=20Created=20config=20files=20w?= =?UTF-8?q?ith=20common=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Created common.nix for various configs - Created theme.nix for theme related configs - Moved some code to more logical files - Moved some standalone files into nix multiline strings, in order to inject data --- common.nix | 23 + configuration.nix | 44 +- home-manager/default.nix | 5 +- home-manager/hyprland/binds.nix | 5 - home-manager/hyprland/default.nix | 1 + home-manager/hyprland/hyprcursor/default.nix | 23 +- home-manager/hyprland/hyprcursor/manifest.hl | 4 - home-manager/hyprland/hypridle/default.nix | 1 - home-manager/hyprland/hyprlock/default.nix | 41 +- home-manager/hyprland/hyprshot.nix | 19 + home-manager/hyprland/settings.nix | 99 +--- home-manager/hyprland/swaync/default.nix | 462 ++++++++++++++++++- home-manager/hyprland/swaync/mocha.css | 453 ------------------ modules/default.nix | 3 +- modules/fonts.nix | 5 + modules/gnome/default.nix | 6 +- modules/gnome/nautilus.nix | 8 +- modules/hardware/audio.nix | 10 +- modules/hardware/default.nix | 2 - modules/hardware/graphics/nvidia.nix | 2 - modules/hyprland/default.nix | 4 +- modules/hyprland/waybar.nix | 12 - modules/locale.nix | 6 +- modules/networking.nix | 7 +- modules/nix-helper.nix | 6 +- modules/qt.nix | 11 + modules/sddm.nix | 11 +- modules/security.nix | 2 +- modules/steam.nix | 2 - modules/stylix.nix | 7 +- theme.nix | 41 ++ 31 files changed, 650 insertions(+), 675 deletions(-) create mode 100644 common.nix delete mode 100644 home-manager/hyprland/hyprcursor/manifest.hl create mode 100644 home-manager/hyprland/hyprshot.nix delete mode 100644 home-manager/hyprland/swaync/mocha.css delete mode 100644 modules/hyprland/waybar.nix create mode 100644 modules/qt.nix create mode 100644 theme.nix diff --git a/common.nix b/common.nix new file mode 100644 index 0000000..203de02 --- /dev/null +++ b/common.nix @@ -0,0 +1,23 @@ +rec { + keymaps = { + layout = "gb,no"; + options = "grp:alt_shift_toggle"; # Toggle using ALT + SHIFT + }; + + username = "martin"; + hostname = "nixos"; + + dir = { + home = "/home/${username}"; + pictures = "${dir.home}/Pictures"; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.version = "24.11"; + terminal = "kitty"; +} diff --git a/configuration.nix b/configuration.nix index fafd928..6cb70bb 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,26 +1,26 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { pkgs, outputs, ... }: - +let + common = import ./common.nix; +in { imports = [ ./modules ]; nixpkgs.overlays = [ outputs.overlays.unstable-packages ]; # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.martin = { + users.users.${common.username} = { isNormalUser = true; - description = "martin"; + description = common.username; extraGroups = [ "networkmanager" "wheel" @@ -42,9 +42,6 @@ xdg-utils xdg-desktop-portal xdg-desktop-portal-gtk - kdePackages.qtwayland - kdePackages.qtsvg - kdePackages.qt6ct protonmail-desktop stremio fastfetch @@ -63,31 +60,12 @@ "flakes" ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - - programs = { - kdeconnect.enable = true; - }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; + programs.kdeconnect.enable = true; services = { flatpak.enable = true; xserver.enable = true; }; - qt.enable = true; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.11"; # Did you read the comment? + system.stateVersion = common.system.version; } diff --git a/home-manager/default.nix b/home-manager/default.nix index 5d26d24..947b084 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -4,7 +4,8 @@ ... }: let - username = "martin"; + common = import ../common.nix; + username = common.username; homeDir = "/home/${username}"; in { @@ -31,7 +32,7 @@ in # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - stateVersion = "24.11"; + stateVersion = common.system.version; }; programs = { diff --git a/home-manager/hyprland/binds.nix b/home-manager/hyprland/binds.nix index dd57448..dcdabb9 100644 --- a/home-manager/hyprland/binds.nix +++ b/home-manager/hyprland/binds.nix @@ -16,11 +16,6 @@ "$mainMod, L, exec, hyprlock" "$mainMod, K, exec, [float] gnome-calculator" - # Screenshots - "$mainMod, PRINT, exec, hyprshot -m window" # Window - ", PRINT, exec, hyprshot -m output" # Monitor - "$shiftMod, PRINT, exec, hyprshot -m region" # Region - # Move focus with mainMod + arrow keys "$mainMod, left, movefocus, l" "$mainMod, right, movefocus, r" diff --git a/home-manager/hyprland/default.nix b/home-manager/hyprland/default.nix index 4dd1277..a0a1369 100644 --- a/home-manager/hyprland/default.nix +++ b/home-manager/hyprland/default.nix @@ -6,6 +6,7 @@ ./waybar ./hypridle ./hyprlock + ./hyprshot.nix ./settings.nix ./swaync ]; diff --git a/home-manager/hyprland/hyprcursor/default.nix b/home-manager/hyprland/hyprcursor/default.nix index c316031..c560b03 100644 --- a/home-manager/hyprland/hyprcursor/default.nix +++ b/home-manager/hyprland/hyprcursor/default.nix @@ -1,5 +1,9 @@ { pkgs, ... }: - +let + cursorSize = 24; + cursorTheme = "rose-pine-hyprcursor"; + cursorDir = "hyprcursors"; +in { home = { packages = with pkgs; [ @@ -7,12 +11,23 @@ ]; file = { - ".local/share/icons/rose-pine-hyprcursor/manifest.hl".source = ./manifest.hl; - ".local/share/icons/rose-pine-hyprcursor/hyprcursors" = { - source = ./hyprcursors; + ".local/share/icons/${cursorTheme}/manifest.hl".text = '' + name = ${cursorTheme} + description = BreezeX remixed with Rose Pine remixed to Hyprcursor format + version = 0.3.2 + cursors_directory = ${cursorDir} + ''; + ".local/share/icons/${cursorTheme}/${cursorDir}" = { + source = ./${cursorDir}; recursive = true; }; }; + + sessionVariables = { + XCURSOR_SIZE = cursorSize; + HYPRCURSOR_SIZE = cursorSize; + HYPRCURSOR_THEME = cursorSize; + }; }; wayland.windowManager.hyprland.settings.exec-once = [ diff --git a/home-manager/hyprland/hyprcursor/manifest.hl b/home-manager/hyprland/hyprcursor/manifest.hl deleted file mode 100644 index 99cc530..0000000 --- a/home-manager/hyprland/hyprcursor/manifest.hl +++ /dev/null @@ -1,4 +0,0 @@ -name = rose-pine-hyprcursor -description = BreezeX remixed with Rose Pine remixed to Hyprcursor format -version = 0.3.2 -cursors_directory = hyprcursors diff --git a/home-manager/hyprland/hypridle/default.nix b/home-manager/hyprland/hypridle/default.nix index 6f71dfa..aa9b4fe 100644 --- a/home-manager/hyprland/hypridle/default.nix +++ b/home-manager/hyprland/hypridle/default.nix @@ -1,4 +1,3 @@ -{ ... }: let # Time in seconds lockAfter = 1200; diff --git a/home-manager/hyprland/hyprlock/default.nix b/home-manager/hyprland/hyprlock/default.nix index 061e0aa..4fc85b1 100644 --- a/home-manager/hyprland/hyprlock/default.nix +++ b/home-manager/hyprland/hyprlock/default.nix @@ -1,20 +1,12 @@ { lib, ... }: - +let + theme = import ../../../theme.nix; +in { programs.hyprlock = { enable = true; settings = { - "$base" = "rgb(1e1e2e)"; - "$text" = "rgb(cdd6f4)"; - "$textAlpha" = "cdd6f4"; - "$mauve" = "rgb(cba6f7)"; - "$mauveAlpha" = "cba6f7"; - "$red" = "rgb(f38ba8)"; - "$yellow" = "rgb(f9e2af)"; - "$accent" = "$mauve"; - "$accentAlpha" = "$mauveAlpha"; - "$surface0" = "rgb(313244)"; - "$font" = "JetBrainsMono Nerd Font"; + "$font" = "${theme.nerdFont} Nerd Font"; # GENERAL general = { @@ -26,29 +18,27 @@ label = [ { text = "$LAYOUT"; - color = "$text"; + color = "${theme.textRgb}"; font_size = 25; font_family = "$font"; position = "30, -30"; halign = "left"; valign = "top"; } - # TIME { text = "$TIME"; - color = "$text"; + color = "${theme.textRgb}"; font_size = 90; font_family = "$font"; position = "-30, 0"; halign = "right"; valign = "top"; } - # DATE { text = "cmd[update:43200000] date +\"%A, %d %B %Y\""; - color = "$text"; + color = "${theme.textRgb}"; font_size = 25; font_family = "$font"; position = "-30, -150"; @@ -56,7 +46,6 @@ valign = "top"; } ]; - # INPUT FIELD input-field = { size = "300, 60"; @@ -64,17 +53,17 @@ dots_size = 0.2; dots_spacing = 0.2; dots_center = true; - outer_color = lib.mkDefault "$accent"; - inner_color = lib.mkDefault "$surface0"; - font_color = lib.mkDefault "$text"; + outer_color = lib.mkDefault "${theme.mauve}"; + inner_color = lib.mkDefault "${theme.surface0Rgb}"; + font_color = lib.mkDefault "${theme.textRgb}"; fade_on_empty = false; - placeholder_text = "󰌾 Logged in as $USER"; + placeholder_text = "󰌾 Logged in as $USER"; hide_input = false; - check_color = lib.mkDefault "$accent"; - fail_color = lib.mkDefault "$red"; + check_color = lib.mkDefault "${theme.mauve}"; + fail_color = lib.mkDefault "${theme.redRgb}"; fail_text = "$FAIL ($ATTEMPTS)"; - capslock_color = lib.mkDefault "$yellow"; - position = "0, -20%"; + capslock_color = lib.mkDefault "${theme.yellowRgb}"; + position = "0, -200"; # TODO change -200 to -20% at 25.05 halign = "center"; valign = "center"; }; diff --git a/home-manager/hyprland/hyprshot.nix b/home-manager/hyprland/hyprshot.nix new file mode 100644 index 0000000..5074cd2 --- /dev/null +++ b/home-manager/hyprland/hyprshot.nix @@ -0,0 +1,19 @@ +let + common = import ../../common.nix; +in +{ + home.sessionVariables = { + HYPRSHOT_DIR = "${common.dir.pictures}/screenshots"; # Store screenshots here + }; + + wayland.windowManager.hyprland.settings = { + "$mainMod" = "SUPER"; + "$shiftMod" = "$mainMod SHIFT"; + + bind = [ + "$mainMod, PRINT, exec, hyprshot -m window" # Window + ", PRINT, exec, hyprshot -m output" # Monitor + "$shiftMod, PRINT, exec, hyprshot -m region" # Region + ]; + }; +} diff --git a/home-manager/hyprland/settings.nix b/home-manager/hyprland/settings.nix index 1143f6e..4cf1998 100644 --- a/home-manager/hyprland/settings.nix +++ b/home-manager/hyprland/settings.nix @@ -1,5 +1,8 @@ { lib, ... }: - +let + common = import ../../common.nix; + theme = import ../../theme.nix; +in { wayland.windowManager.hyprland.settings = { monitor = [ @@ -25,98 +28,15 @@ ]; env = [ - "XCURSOR_SIZE,24" - "HYPRCURSOR_SIZE,24" - "HYPRCURSOR_THEME,rose-pine-hyprcursor" "ELECTRON_OZONE_PLATFORM_HINT,auto" - "HYPRSHOT_DIR,$HOME/Pictures/screenshots" # Store screenshots here ]; - # TODO move to common file - "$rosewater" = "rgb(f5e0dc)"; - "$rosewaterAlpha" = "f5e0dc"; - - "$flamingo" = "rgb(f2cdcd)"; - "$flamingoAlpha" = "f2cdcd"; - - "$pink" = "rgb(f5c2e7)"; - "$pinkAlpha" = "f5c2e7"; - - "$mauve" = "rgb(cba6f7)"; - "$mauveAlpha" = "cba6f7"; - - "$red" = "rgb(f38ba8)"; - "$redAlpha" = "f38ba8"; - - "$maroon" = "rgb(eba0ac)"; - "$maroonAlpha" = "eba0ac"; - - "$peach" = "rgb(fab387)"; - "$peachAlpha" = "fab387"; - - "$yellow" = "rgb(f9e2af)"; - "$yellowAlpha" = "f9e2af"; - - "$green" = "rgb(a6e3a1)"; - "$greenAlpha" = "a6e3a1"; - - "$teal" = "rgb(94e2d5)"; - "$tealAlpha" = "94e2d5"; - - "$sky" = "rgb(89dceb)"; - "$skyAlpha" = "89dceb"; - - "$sapphire" = "rgb(74c7ec)"; - "$sapphireAlpha" = "74c7ec"; - - "$blue" = "rgb(89b4fa)"; - "$blueAlpha" = "89b4fa"; - - "$lavender" = "rgb(b4befe)"; - "$lavenderAlpha" = "b4befe"; - - "$text" = "rgb(cdd6f4)"; - "$textAlpha" = "cdd6f4"; - - "$subtext1" = "rgb(bac2de)"; - "$subtext1Alpha" = "bac2de"; - - "$subtext0" = "rgb(a6adc8)"; - "$subtext0Alpha" = "a6adc8"; - - "$overlay2" = "rgb(9399b2)"; - "$overlay2Alpha" = "9399b2"; - - "$overlay1" = "rgb(7f849c)"; - "$overlay1Alpha" = "7f849c"; - - "$overlay0" = "rgb(6c7086)"; - "$overlay0Alpha" = "6c7086"; - - "$surface2" = "rgb(585b70)"; - "$surface2Alpha" = "585b70"; - - "$surface1" = "rgb(45475a)"; - "$surface1Alpha" = "45475a"; - - "$surface0" = "rgb(313244)"; - "$surface0Alpha" = "313244"; - - "$base" = "rgb(1e1e2e)"; - "$baseAlpha" = "1e1e2e"; - - "$mantle" = "rgb(181825)"; - "$mantleAlpha" = "181825"; - - "$crust" = "rgb(11111b)"; - "$crustAlpha" = "11111b"; - general = { gaps_in = 5; gaps_out = 20; border_size = 2; - "col.active_border" = lib.mkDefault "$mauve $teal 45deg"; - "col.inactive_border" = lib.mkDefault "rgba(595959aa)"; + "col.active_border" = lib.mkDefault "${theme.mauveRgb} ${theme.tealRgb} 45deg"; + "col.inactive_border" = lib.mkDefault "rgba(${theme.surface2Alpha}aa)"; resize_on_border = true; allow_tearing = false; layout = "dwindle"; @@ -133,7 +53,7 @@ enabled = true; range = 4; render_power = 3; - color = lib.mkDefault "$base"; + color = lib.mkDefault theme.baseRgb; }; blur = { @@ -192,10 +112,9 @@ debug.disable_logs = false; - # TODO fetch values from common file. Must match configs in nixos! input = { - kb_layout = "gb,no"; - kb_options = "grp:alt_shift_toggle"; + kb_layout = common.keymaps.layout; + kb_options = common.keymaps.options; follow_mouse = 1; sensitivity = 0; # -1.0 - 1.0, 0 means no modification. touchpad.natural_scroll = false; diff --git a/home-manager/hyprland/swaync/default.nix b/home-manager/hyprland/swaync/default.nix index e168de7..140703a 100644 --- a/home-manager/hyprland/swaync/default.nix +++ b/home-manager/hyprland/swaync/default.nix @@ -1,8 +1,464 @@ -{ pkgs, lib, ... }: - +{ lib, ... }: +let + theme = import ../../../theme.nix; +in { + # TODO inject font services.swaync = { enable = true; - style = lib.mkDefault ./mocha.css; + style = lib.mkDefault '' + * { + all: unset; + font-size: 14px; + font-family: "JetBrains Mono", monospace; + transition: 200ms; + } + + trough highlight { + background: #${theme.textAlpha}; + } + + scale trough { + margin: 0 1rem; + background-color: #${theme.surface0Alpha}; + min-height: 8px; + min-width: 70px; + } + + slider { + background-color: #${theme.blueAlpha}; + } + + .floating-notifications.background .notification-row .notification-background { + box-shadow: + 0 0 8px 0 rgba(0, 0, 0, 0.8), + inset 0 0 0 1px #${theme.surface0Alpha}; + border-radius: 12.6px; + margin: 18px; + background-color: #${theme.baseAlpha}; + color: #${theme.textAlpha}; + padding: 0; + } + + .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 #${theme.redAlpha}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content { + margin: 7px; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .summary { + color: #${theme.textAlpha}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .time { + color: #${theme.subtext0Alpha}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .body { + color: #${theme.textAlpha}; + } + + .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: #${theme.textAlpha}; + background-color: #${theme.surface0Alpha}; + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + margin: 7px; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:hover { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.surface0Alpha}; + color: #${theme.textAlpha}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:active { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.sapphireAlpha}; + color: #${theme.textAlpha}; + } + + /* Close Button */ + .floating-notifications.background + .notification-row + .notification-background + .close-button { + margin: 7px; + padding: 2px; + border-radius: 6.3px; + color: #${theme.baseAlpha}; + background-color: #${theme.redAlpha}; + } + + .floating-notifications.background + .notification-row + .notification-background + .close-button:hover { + background-color: #${theme.maroonAlpha}; + color: #${theme.baseAlpha}; + } + + .floating-notifications.background + .notification-row + .notification-background + .close-button:active { + background-color: #${theme.redAlpha}; + color: #${theme.baseAlpha}; + } + + .control-center { + box-shadow: + 0 0 8px 0 rgba(0, 0, 0, 0.8), + inset 0 0 0 1px #${theme.surface0Alpha}; + border-radius: 12.6px; + margin: 18px; + background-color: #${theme.baseAlpha}; + color: #${theme.textAlpha}; + padding: 14px; + } + + .control-center .widget-title > label { + color: #${theme.textAlpha}; + font-size: 1.3em; + } + + .control-center .widget-title button { + border-radius: 7px; + color: #${theme.textAlpha}; + background-color: #${theme.surface0Alpha}; + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + padding: 8px; + } + + .control-center .widget-title button:hover { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #585b70; + color: #${theme.textAlpha}; + } + + .control-center .widget-title button:active { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.sapphireAlpha}; + color: #${theme.baseAlpha}; + } + + .control-center .notification-row .notification-background { + border-radius: 7px; + color: #${theme.textAlpha}; + background-color: #${theme.surface0Alpha}; + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + margin-top: 14px; + } + + .control-center .notification-row .notification-background .notification { + padding: 7px; + border-radius: 7px; + } + + .control-center + .notification-row + .notification-background + .notification.critical { + box-shadow: inset 0 0 7px 0 #${theme.redAlpha}; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content { + margin: 7px; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content + .summary { + color: #${theme.textAlpha}; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content + .time { + color: #a6adc8; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content + .body { + color: #${theme.textAlpha}; + } + + .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: #${theme.textAlpha}; + background-color: #${theme.crustAlpha}; + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + margin: 7px; + } + + .control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:hover { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.surface0Alpha}; + color: #${theme.textAlpha}; + } + + .control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:active { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.sapphireAlpha}; + color: #${theme.textAlpha}; + } + + .control-center .notification-row .notification-background .close-button { + margin: 7px; + padding: 2px; + border-radius: 6.3px; + color: #${theme.baseAlpha}; + background-color: #${theme.maroonAlpha}; + } + + .close-button { + border-radius: 6.3px; + } + + .control-center .notification-row .notification-background .close-button:hover { + background-color: #${theme.redAlpha}; + color: #${theme.baseAlpha}; + } + + .control-center + .notification-row + .notification-background + .close-button:active { + background-color: #${theme.redAlpha}; + color: #${theme.baseAlpha}; + } + + .control-center .notification-row .notification-background:hover { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.overlay1Alpha}; + color: #${theme.textAlpha}; + } + + .control-center .notification-row .notification-background:active { + box-shadow: inset 0 0 0 1px #${theme.surface1Alpha}; + background-color: #${theme.sapphireAlpha}; + color: #${theme.textAlpha}; + } + + .notification.critical progress { + background-color: #${theme.redAlpha}; + } + + .notification.low progress, + .notification.normal progress { + background-color: #${theme.blueAlpha}; + } + + .control-center-dnd { + margin-top: 5px; + border-radius: 8px; + background: #${theme.surface0Alpha}; + border: 1px solid #${theme.surface1Alpha}; + box-shadow: none; + } + + .control-center-dnd:checked { + background: #${theme.surface0Alpha}; + } + + .control-center-dnd slider { + background: #${theme.surface1Alpha}; + border-radius: 8px; + } + + .widget-dnd { + margin: 0px; + font-size: 1.1rem; + } + + .widget-dnd > switch { + font-size: initial; + border-radius: 8px; + background: #${theme.surface0Alpha}; + border: 1px solid #${theme.surface1Alpha}; + box-shadow: none; + } + + .widget-dnd > switch:checked { + background: #${theme.surface0Alpha}; + } + + .widget-dnd > switch slider { + background: #${theme.surface1Alpha}; + border-radius: 8px; + border: 1px solid #${theme.overlay0Alpha}; + } + + .widget-mpris .widget-mpris-player { + background: #${theme.surface0Alpha}; + padding: 7px; + } + + .widget-mpris .widget-mpris-title { + font-size: 1.2rem; + } + + .widget-mpris .widget-mpris-subtitle { + font-size: 0.8rem; + } + + .widget-menubar > box > .menu-button-bar > button > label { + font-size: 3rem; + padding: 0.5rem 2rem; + } + + .widget-menubar > box > .menu-button-bar > :last-child { + color: #${theme.redAlpha}; + } + + .power-buttons button:hover, + .powermode-buttons button:hover, + .screenshot-buttons button:hover { + background: #${theme.surface0Alpha}; + } + + .control-center .widget-label > label { + color: #${theme.textAlpha}; + font-size: 2rem; + } + + .widget-buttons-grid { + padding-top: 1rem; + } + + .widget-buttons-grid > flowbox > flowboxchild > button label { + font-size: 2.5rem; + } + + .widget-volume { + padding-top: 1rem; + } + + .widget-volume label { + font-size: 1.5rem; + color: #${theme.sapphireAlpha}; + } + + .widget-volume trough highlight { + background: #${theme.sapphireAlpha}; + } + + .widget-backlight trough highlight { + background: #${theme.yellowAlpha}; + } + + .widget-backlight label { + font-size: 1.5rem; + color: #${theme.yellowAlpha}; + } + + .widget-backlight .KB { + padding-bottom: 1rem; + } + + .image { + padding-right: 0.5rem; + } + ''; }; } diff --git a/home-manager/hyprland/swaync/mocha.css b/home-manager/hyprland/swaync/mocha.css deleted file mode 100644 index 1a5acea..0000000 --- a/home-manager/hyprland/swaync/mocha.css +++ /dev/null @@ -1,453 +0,0 @@ -/* TODO Variables */ -* { - all: unset; - font-size: 14px; - font-family: "JetBrains Mono", monospace; - transition: 200ms; -} - -trough highlight { - background: #cdd6f4; -} - -scale trough { - margin: 0 1rem; - background-color: #313244; - min-height: 8px; - min-width: 70px; -} - -slider { - 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; -} - -.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 - .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 - .time { - color: #a6adc8; -} - -.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 - > * - .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: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:hover { - background-color: #eba0ac; - 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; -} - -.control-center .widget-title > label { - 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; -} - -.control-center .widget-title button:hover { - 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; -} - -.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; -} - -.control-center .notification-row .notification-background .notification { - 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 - .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 - .time { - color: #a6adc8; -} - -.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 - > * - .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: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; -} - -.close-button { - border-radius: 6.3px; -} - -.control-center .notification-row .notification-background .close-button:hover { - 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; -} - -.control-center .notification-row .notification-background:active { - box-shadow: inset 0 0 0 1px #45475a; - background-color: #74c7ec; - color: #cdd6f4; -} - -.notification.critical progress { - background-color: #f38ba8; -} - -.notification.low progress, -.notification.normal progress { - background-color: #89b4fa; -} - -.control-center-dnd { - margin-top: 5px; - border-radius: 8px; - background: #313244; - border: 1px solid #45475a; - box-shadow: none; -} - -.control-center-dnd:checked { - background: #313244; -} - -.control-center-dnd slider { - background: #45475a; - border-radius: 8px; -} - -.widget-dnd { - margin: 0px; - font-size: 1.1rem; -} - -.widget-dnd > switch { - font-size: initial; - border-radius: 8px; - background: #313244; - border: 1px solid #45475a; - box-shadow: none; -} - -.widget-dnd > switch:checked { - background: #313244; -} - -.widget-dnd > switch slider { - background: #45475a; - border-radius: 8px; - border: 1px solid #6c7086; -} - -.widget-mpris .widget-mpris-player { - background: #313244; - padding: 7px; -} - -.widget-mpris .widget-mpris-title { - font-size: 1.2rem; -} - -.widget-mpris .widget-mpris-subtitle { - font-size: 0.8rem; -} - -.widget-menubar > box > .menu-button-bar > button > label { - font-size: 3rem; - padding: 0.5rem 2rem; -} - -.widget-menubar > box > .menu-button-bar > :last-child { - color: #f38ba8; -} - -.power-buttons button:hover, -.powermode-buttons button:hover, -.screenshot-buttons button:hover { - background: #313244; -} - -.control-center .widget-label > label { - color: #cdd6f4; - font-size: 2rem; -} - -.widget-buttons-grid { - padding-top: 1rem; -} - -.widget-buttons-grid > flowbox > flowboxchild > button label { - font-size: 2.5rem; -} - -.widget-volume { - padding-top: 1rem; -} - -.widget-volume label { - font-size: 1.5rem; - color: #74c7ec; -} - -.widget-volume trough highlight { - background: #74c7ec; -} - -.widget-backlight trough highlight { - background: #f9e2af; -} - -.widget-backlight label { - font-size: 1.5rem; - color: #f9e2af; -} - -.widget-backlight .KB { - padding-bottom: 1rem; -} - -.image { - padding-right: 0.5rem; -} diff --git a/modules/default.nix b/modules/default.nix index e3ee12f..d21e699 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,5 +1,3 @@ -{ ... }: - { imports = [ ./development.nix @@ -15,5 +13,6 @@ ./steam.nix ./stylix.nix ./terminal + ./qt.nix ]; } diff --git a/modules/fonts.nix b/modules/fonts.nix index 8203855..f475597 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -1,5 +1,9 @@ { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ + font-awesome # Icons + ]; fonts = { fontconfig.enable = true; @@ -8,6 +12,7 @@ jetbrains-mono # The line below will replace the lines above in 25.05 # nerd-fonts.jetbrains-mono + font-awesome ]; }; diff --git a/modules/gnome/default.nix b/modules/gnome/default.nix index 84488ab..3413ae1 100644 --- a/modules/gnome/default.nix +++ b/modules/gnome/default.nix @@ -10,15 +10,13 @@ glib adwaita-icon-theme gnomeExtensions.appindicator - # gnome-extension-manager + # gnome-extension-manager loupe gnome-calculator gnome-disk-utility ]; - programs = { - dconf.enable = true; # Required for some gnome applications - }; + programs.dconf.enable = true; # Required for some gnome applications services = { gnome.gnome-keyring.enable = true; diff --git a/modules/gnome/nautilus.nix b/modules/gnome/nautilus.nix index bc4ee54..f17ad21 100644 --- a/modules/gnome/nautilus.nix +++ b/modules/gnome/nautilus.nix @@ -1,13 +1,15 @@ { pkgs, ... }: - +let + common = import ../../common.nix; +in { environment.systemPackages = with pkgs; [ nautilus - ffmpegthumbnailer + ffmpegthumbnailer # Thumbnails ]; programs.nautilus-open-any-terminal = { enable = true; - terminal = "kitty"; + terminal = common.terminal; }; } diff --git a/modules/hardware/audio.nix b/modules/hardware/audio.nix index a798bf3..2b3429e 100644 --- a/modules/hardware/audio.nix +++ b/modules/hardware/audio.nix @@ -1,10 +1,6 @@ -{ - pkgs, - ... -}: +{ pkgs, ... }: { - environment.systemPackages = with pkgs; [ gst_all_1.gstreamer gst_all_1.gst-plugins-base @@ -17,7 +13,7 @@ spotify ]; - hardware.pulseaudio.enable = false; # Will be moved to services + hardware.pulseaudio.enable = false; # Will be moved to services in 25.05 security.rtkit.enable = true; # Enable RealtimeKit for audio purposes @@ -32,6 +28,6 @@ # Uncomment the following line if you want to use JACK applications # jack.enable = true; }; - # pulseaudio.enable = false; + # pulseaudio.enable = false; # TODO uncommenct at 25.05 }; } diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix index 8bbda62..ffd2b30 100644 --- a/modules/hardware/default.nix +++ b/modules/hardware/default.nix @@ -1,5 +1,3 @@ -{ ... }: - { imports = [ ./audio.nix diff --git a/modules/hardware/graphics/nvidia.nix b/modules/hardware/graphics/nvidia.nix index fc07b8b..bb5c7e9 100644 --- a/modules/hardware/graphics/nvidia.nix +++ b/modules/hardware/graphics/nvidia.nix @@ -1,5 +1,3 @@ -{ ... }: - { hardware.nvidia = { # Required diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index fca9e09..aa07aff 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -1,9 +1,8 @@ -# System configurations for Hyprland. For home configs, see ./home/hyprland +# System configurations for Hyprland. For home configs, see ./home-manager/hyprland { pkgs, ... }: { imports = [ - ./waybar.nix ./wallpaper.nix ]; @@ -11,6 +10,7 @@ xdg-desktop-portal-hyprland hyprpolkitagent # Auth deamon providing modals for password auth hyprshot # Screenshots + waybar ]; programs = { diff --git a/modules/hyprland/waybar.nix b/modules/hyprland/waybar.nix deleted file mode 100644 index 9032ada..0000000 --- a/modules/hyprland/waybar.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - waybar - font-awesome # Icons - ]; - - fonts.packages = with pkgs; [ - font-awesome - ]; -} diff --git a/modules/locale.nix b/modules/locale.nix index a050f09..9f7a9ed 100644 --- a/modules/locale.nix +++ b/modules/locale.nix @@ -5,6 +5,7 @@ let utf-8 = "UTF-8"; en = "en_GB.${utf-8}"; nb = "nb_NO.${utf-8}"; + common = import ../common.nix; in { # Configure console keymap @@ -31,10 +32,7 @@ in }; # Configure keymaps - services.xserver.xkb = { - layout = "gb,no"; - options = "grp:alt_shift_toggle"; # Toggle using ALT + SHIFT - }; + services.xserver.xkb = common.keymaps; # Set your time zone. time.timeZone = "Europe/Oslo"; diff --git a/modules/networking.nix b/modules/networking.nix index 86889eb..6d7eb0d 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -1,9 +1,10 @@ -{ ... }: - +let + common = import ../common.nix; +in { networking = { networkmanager.enable = true; - hostName = "nixos"; + hostName = common.hostname; # wireless.enable = true; # Enables wireless support via wpa_supplicant. }; diff --git a/modules/nix-helper.nix b/modules/nix-helper.nix index dca5fca..d1233e4 100644 --- a/modules/nix-helper.nix +++ b/modules/nix-helper.nix @@ -1,9 +1,7 @@ -# Nix-Helper: swgithub.com/viperML/nh -{ ... }: - +# Nix-Helper: github.com/viperML/nh { programs.nh = { enable = true; - flake = ./.; + flake = ../.; }; } diff --git a/modules/qt.nix b/modules/qt.nix new file mode 100644 index 0000000..c32c98f --- /dev/null +++ b/modules/qt.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs.kdePackages; [ + qtwayland + qtsvg + qt6ct + ]; + + qt.enable = true; +} diff --git a/modules/sddm.nix b/modules/sddm.nix index f40af06..5c4c032 100644 --- a/modules/sddm.nix +++ b/modules/sddm.nix @@ -1,10 +1,13 @@ { pkgs, ... }: - +let + theme = import ../theme.nix; + flavor = theme.flavor; +in { environment.systemPackages = with pkgs; [ (catppuccin-sddm.override { - flavor = "mocha"; - font = "Noto Sans"; + flavor = flavor; + font = "JetBrainsMono"; fontSize = "9"; background = "${../catppuccin_high.png}"; loginBackground = true; @@ -13,7 +16,7 @@ services.displayManager.sddm = { enable = true; - theme = "catppuccin-mocha"; + theme = "catppuccin-${flavor}"; autoNumlock = true; # Enable numlock at login # TODO doesn't work wayland.enable = true; package = pkgs.kdePackages.sddm; diff --git a/modules/security.nix b/modules/security.nix index 5bc45cb..897fc8d 100644 --- a/modules/security.nix +++ b/modules/security.nix @@ -23,7 +23,7 @@ }; services = { - pcscd.enable = true; + pcscd.enable = true; # Required for Yubikey udev.packages = with pkgs; [ yubikey-personalization ]; }; } diff --git a/modules/steam.nix b/modules/steam.nix index 6a9bb65..65035f8 100644 --- a/modules/steam.nix +++ b/modules/steam.nix @@ -1,5 +1,3 @@ -{ ... }: - { programs.steam = { enable = true; diff --git a/modules/stylix.nix b/modules/stylix.nix index 7ec6622..cb5ba22 100644 --- a/modules/stylix.nix +++ b/modules/stylix.nix @@ -1,12 +1,15 @@ { pkgs, ... }: - +let + theme = import ../theme.nix; +in { stylix = { enable = true; image = ../catppuccin.png; - base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-${theme.flavor}.yaml"; polarity = "dark"; opacity.terminal = 0.8; + # Override some colours because of bad contrast override = { base02 = "b0b0b0"; # Comments in shell base03 = "b0b0b0"; # Comments in nvim diff --git a/theme.nix b/theme.nix new file mode 100644 index 0000000..f133427 --- /dev/null +++ b/theme.nix @@ -0,0 +1,41 @@ +rec { + theme = "catppuccin"; + flavor = "mocha"; + + # TODO how to define font? JetBrainsMono | JetBrains Mono | JetBrainsMono Nerd Font | JetBrains Mono Nerd Font + nerdFont = "JetBrainsMono"; + + rosewaterAlpha = "f5e0dc"; + flamingoAlpha = "f2cdcd"; + pinkAlpha = "f5c2e7"; + mauveAlpha = "cba6f7"; + mauveRgb = "rgb(${mauveAlpha})"; + redAlpha = "f38ba8"; + redRgb = "rgb(${redAlpha})"; + maroonAlpha = "eba0ac"; + peachAlpha = "fab387"; + yellowAlpha = "f9e2af"; + yellowRgb = "rgb(${yellowAlpha})"; + greenAlpha = "a6e3a1"; + tealAlpha = "94e2d5"; + tealRgb = "rgb(${tealAlpha})"; + skyAlpha = "89dceb"; + sapphireAlpha = "74c7ec"; + blueAlpha = "89b4fa"; + lavenderAlpha = "b4befe"; + textAlpha = "cdd6f4"; + textRgb = "rgb(${textAlpha})"; + subtext1Alpha = "bac2de"; + subtext0Alpha = "a6adc8"; + overlay2Alpha = "9399b2"; + overlay1Alpha = "7f849c"; + overlay0Alpha = "6c7086"; + surface2Alpha = "585b70"; + surface1Alpha = "45475a"; + surface0Alpha = "313244"; + surface0Rgb = "rgb(${surface0Alpha})"; + baseAlpha = "1e1e2e"; + baseRgb = "rgb(${baseAlpha})"; + mantleAlpha = "181825"; + crustAlpha = "11111b"; +} From 89acd3e5cb08587d908d8e2a3b5f8099c351da86 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Wed, 8 Jan 2025 19:47:02 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=A6=20Moved=20more=20configs=20to?= =?UTF-8?q?=20common=20files,=20and=20refactored=20code=20with=20common?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.nix | 24 ++- flake.nix | 22 +-- home-manager/default-applications.nix | 3 +- home-manager/default.nix | 13 +- home-manager/fish.nix | 178 ++++++++++++++++++++++- home-manager/hyprland/binds.nix | 17 ++- home-manager/hyprland/default.nix | 5 - home-manager/hyprland/settings.nix | 10 +- home-manager/hyprland/swaync/default.nix | 2 +- home-manager/nixvim/default.nix | 2 - home-manager/starship.toml | 174 ---------------------- home-manager/wlogout/default.nix | 82 +++++++++-- modules/fonts.nix | 24 +-- modules/locale.nix | 2 - modules/sddm.nix | 2 +- 15 files changed, 317 insertions(+), 243 deletions(-) delete mode 100644 home-manager/starship.toml diff --git a/common.nix b/common.nix index 203de02..a922195 100644 --- a/common.nix +++ b/common.nix @@ -1,16 +1,26 @@ rec { + default = { + browser = "io.github.zen_browser.zen.desktop"; + calculator = "gnome-calculator"; + fileManager = "nautilus"; + imageViewer = "org.gnome.Loupe.desktop"; + lockScreen = "hyprlock"; + terminal = "kitty"; + }; + + dir = { + home = "/home/${username}"; + pictures = "${dir.home}/Pictures"; + }; + + hostname = "nixos"; + keymaps = { layout = "gb,no"; options = "grp:alt_shift_toggle"; # Toggle using ALT + SHIFT }; username = "martin"; - hostname = "nixos"; - - dir = { - home = "/home/${username}"; - pictures = "${dir.home}/Pictures"; - }; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions @@ -19,5 +29,5 @@ rec { # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.version = "24.11"; - terminal = "kitty"; + terminal = default.terminal; # TODO remove } diff --git a/flake.nix b/flake.nix index 344440c..923c69b 100644 --- a/flake.nix +++ b/flake.nix @@ -43,15 +43,19 @@ ./configuration.nix home-manager.nixosModules.home-manager { - home-manager = { - # Backups conflicting files in case of error - backupFileExtension = "bkp"; - useGlobalPkgs = true; - useUserPackages = true; - # Passes inputs as an argument to home-manager - extraSpecialArgs = { inherit inputs; }; - users.martin = import ./home-manager; - }; + home-manager = + let + common = import ./common.nix; + in + { + # Backups conflicting files in case of error + backupFileExtension = "bkp"; + useGlobalPkgs = true; + useUserPackages = true; + # Passes inputs as an argument to home-manager + extraSpecialArgs = { inherit inputs; }; + users.${common.username} = import ./home-manager; + }; } stylix.nixosModules.stylix ]; diff --git a/home-manager/default-applications.nix b/home-manager/default-applications.nix index a27eed4..0f51ecd 100644 --- a/home-manager/default-applications.nix +++ b/home-manager/default-applications.nix @@ -1,5 +1,4 @@ -{ ... }: - +# TODO more defaults { xdg.mimeApps = { enable = true; diff --git a/home-manager/default.nix b/home-manager/default.nix index feb976b..a40ff73 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -6,7 +6,7 @@ let common = import ../common.nix; username = common.username; - homeDir = "/home/${username}"; + dir = common.dir; in { imports = [ @@ -23,10 +23,10 @@ in # paths it should manage. home = { username = username; - homeDirectory = homeDir; + homeDirectory = dir.home; sessionVariables = { - XDG_PICTURES_DIR = "${homeDir}/Pictures"; + XDG_PICTURES_DIR = dir.pictures; # Define the default dir for pictures }; # You can update Home Manager without changing this value. See @@ -36,6 +36,8 @@ in }; programs = { + btop.enable = true; + git = { enable = true; userName = "Martin Berg Alstad"; @@ -48,7 +50,10 @@ in # Let Home Manager install and manage itself. home-manager.enable = true; - kitty.enable = true; + kitty = { + enable = common.terminal == "kitty"; + settings.window_padding_width = 10; + }; }; services = { diff --git a/home-manager/fish.nix b/home-manager/fish.nix index c82cd98..9b2bc1c 100644 --- a/home-manager/fish.nix +++ b/home-manager/fish.nix @@ -1,5 +1,13 @@ -{ pkgs, ... }: - +{ pkgs, lib, ... }: +let + replace = + from: to: current: + if current == from then to else current; + toSingleLine = + with lib.strings; + s: concatMapStrings (stringAsChars (replace "\n" "")) (splitString "n" s); + theme = import ../theme.nix; +in { programs = { fish = { @@ -18,9 +26,173 @@ ]; }; + # TODO catppuccin colours on all parts starship = { enable = true; - settings = (with builtins; fromTOML (readFile ./starship.toml)) // { }; + settings = { + format = toSingleLine '' + [](#${theme.mantleAlpha}) + $os + $username + [](bg:#${theme.lavenderAlpha} fg:#${theme.mantleAlpha}) + $directory + [](fg:#${theme.lavenderAlpha} bg:#${theme.blueAlpha}) + $git_branch + $git_status + [](fg:#${theme.blueAlpha} bg:#86BBD8) + $c + $elixir + $elm + $golang + $gradle + $haskell + $java + $julia + $nodejs + $nim + $rust + $scala + [](fg:#86BBD8 bg:#06969A) + $docker_context + [](fg:#06969A bg:#33658A) + $time + [ ](fg:#33658A) + ''; + + # Disable the blank line at the start of the prompt + # add_newline = false + + # You can also replace your username with a neat symbol like  or disable this + # and use the os module below + username = { + show_always = false; + style_user = "bg:#${theme.crustAlpha}"; + style_root = "bg:#${theme.mantleAlpha}"; + format = "[$user]($style) in "; + disabled = false; + }; + + os = { + style = "bg:#${theme.mantleAlpha}"; + disabled = false; + }; + + directory = { + style = "bg:#${theme.lavenderAlpha} fg:#${theme.baseAlpha}"; + format = "[ $path ]($style)"; + truncation_length = 3; + truncation_symbol = "…/"; + }; + + # Here is how you can shorten some long paths by text replacement + # similar to mapped_locations in Oh My Posh: + directory.substitutions = { + "Documents" = "󰈙 "; + "Downloads" = " "; + "Music" = "󰓃 "; + "Pictures" = " "; + }; + # Keep in mind that the order matters. For example: + # "Important Documents" = " 󰈙 " + # will not be replaced, because "Documents" was already substituted before. + # So either put "Important Documents" before "Documents" or use the substituted version: + # "Important 󰈙 " = " 󰈙 " + + c = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + docker_context = { + symbol = " "; + style = "bg:#06969A"; + format = "[ $symbol $context ]($style)"; + }; + + elixir = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + elm = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + git_branch = { + symbol = " "; + style = "bg:#${theme.blueAlpha} fg:#${theme.baseAlpha}"; + format = "[ $symbol $branch ]($style)"; + }; + + git_status = { + style = "bg:#${theme.blueAlpha} fg:#${theme.baseAlpha}"; + format = "[$all_status$ahead_behind ]($style)"; + }; + + golang = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + gradle = { + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + haskell = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + java = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + julia = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + nodejs = { + symbol = ""; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + nim = { + symbol = "󰆥 "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + rust = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + scala = { + symbol = " "; + style = "bg:#86BBD8"; + format = "[ $symbol ($version) ]($style)"; + }; + + time = { + disabled = false; + time_format = "%R"; # Hour:Minute Format + style = "bg:#33658A"; + format = "[ $time ]($style)"; + }; + }; }; }; } diff --git a/home-manager/hyprland/binds.nix b/home-manager/hyprland/binds.nix index dcdabb9..47565a2 100644 --- a/home-manager/hyprland/binds.nix +++ b/home-manager/hyprland/binds.nix @@ -1,20 +1,27 @@ +let + common = import ../../common.nix; + app = common.default; +in { + # TODO binds to move focused window wayland.windowManager.hyprland.settings = { "$mainMod" = "SUPER"; "$shiftMod" = "$mainMod SHIFT"; + "$menu" = "rofi -show drun"; bind = [ - "$mainMod, Q, exec, $terminal" + "$mainMod, Q, exec, ${app.terminal}" "$mainMod, C, killactive," "$shiftMod, M, exit," - "$mainMod, E, exec, $fileManager" + "$mainMod, E, exec, ${app.fileManager}" "$mainMod, V, togglefloating," "$mainMod, R, exec, $menu" "$mainMod, P, pseudo," # dwindle "$mainMod, J, togglesplit," # dwindle - "$mainMod, B, exec, $browser" - "$mainMod, L, exec, hyprlock" - "$mainMod, K, exec, [float] gnome-calculator" + "$mainMod, B, exec, ${app.browser}" + "$mainMod, L, exec, ${app.lockScreen}" + "$mainMod, K, exec, [float] ${app.calculator}" + "$mainMod, ESC, exec, wlogout" # Move focus with mainMod + arrow keys "$mainMod, left, movefocus, l" diff --git a/home-manager/hyprland/default.nix b/home-manager/hyprland/default.nix index a0a1369..7c3223f 100644 --- a/home-manager/hyprland/default.nix +++ b/home-manager/hyprland/default.nix @@ -11,10 +11,5 @@ ./swaync ]; - programs = { - btop.enable = true; - kitty.settings.window_padding_width = 10; - }; - wayland.windowManager.hyprland.enable = true; } diff --git a/home-manager/hyprland/settings.nix b/home-manager/hyprland/settings.nix index 4cf1998..7b50a0e 100644 --- a/home-manager/hyprland/settings.nix +++ b/home-manager/hyprland/settings.nix @@ -1,6 +1,7 @@ { lib, ... }: let common = import ../../common.nix; + app = common.default; theme = import ../../theme.nix; in { @@ -10,16 +11,11 @@ in "DP-3, 2560x1440@59.95, 1920x0, 1" ]; - "$browser" = "io.github.zen_browser.zen"; - "$terminal" = "kitty"; - "$fileManager" = "nautilus"; - "$menu" = "rofi -show drun"; - # Autostart exec-once = [ - "$browser" + "${app.browser}" "nextcloud" - "$terminal" + "${app.terminal}" "hypridle" "systemctl --user start hyprpolkitagent" "swaync" diff --git a/home-manager/hyprland/swaync/default.nix b/home-manager/hyprland/swaync/default.nix index 140703a..c676ec2 100644 --- a/home-manager/hyprland/swaync/default.nix +++ b/home-manager/hyprland/swaync/default.nix @@ -10,7 +10,7 @@ in * { all: unset; font-size: 14px; - font-family: "JetBrains Mono", monospace; + font-family: "${theme.nerdFont} Nerd Font", monospace; transition: 200ms; } diff --git a/home-manager/nixvim/default.nix b/home-manager/nixvim/default.nix index bbfe2b9..fbc91c7 100644 --- a/home-manager/nixvim/default.nix +++ b/home-manager/nixvim/default.nix @@ -1,6 +1,4 @@ # Neovim configuration for Nix -{ ... }: - { home.sessionVariables = { EDITOR = "nvim"; diff --git a/home-manager/starship.toml b/home-manager/starship.toml deleted file mode 100644 index 6b31c4c..0000000 --- a/home-manager/starship.toml +++ /dev/null @@ -1,174 +0,0 @@ -"$schema" = 'https://starship.rs/config-schema.json' - -palette = "catppuccin_mocha" - -format = """ -[](mantle)\ -$os\ -$username\ -[](bg:lavender fg:mantle)\ -$directory\ -[](fg:lavender bg:blue)\ -$git_branch\ -$git_status\ -[](fg:blue bg:#86BBD8)\ -$c\ -$elixir\ -$elm\ -$golang\ -$gradle\ -$haskell\ -$java\ -$julia\ -$nodejs\ -$nim\ -$rust\ -$scala\ -[](fg:#86BBD8 bg:#06969A)\ -$docker_context\ -[](fg:#06969A bg:#33658A)\ -$time\ -[ ](fg:#33658A)\ -""" - -# Disable the blank line at the start of the prompt -# add_newline = false - -[palettes.catppuccin_mocha] -rosewater = "#f5e0dc" -flamingo = "#f2cdcd" -pink = "#f5c2e7" -mauve = "#cba6f7" -red = "#f38ba8" -maroon = "#eba0ac" -peach = "#fab387" -yellow = "#f9e2af" -green = "#a6e3a1" -teal = "#94e2d5" -sky = "#89dceb" -sapphire = "#74c7ec" -blue = "#89b4fa" -lavender = "#b4befe" -text = "#cdd6f4" -subtext1 = "#bac2de" -subtext0 = "#a6adc8" -overlay2 = "#9399b2" -overlay1 = "#7f849c" -overlay0 = "#6c7086" -surface2 = "#585b70" -surface1 = "#45475a" -surface0 = "#313244" -base = "#1e1e2e" -mantle = "#181825" -crust = "#11111b" - -# You can also replace your username with a neat symbol like  or disable this -# and use the os module below -[username] -show_always = false -style_user = "bg:crust" -style_root = "bg:mantle" -format = "[$user]($style) in " -disabled = false - -[os] -style = "bg:mantle" -disabled = false - -[directory] -style = "bg:lavender fg:base" -format = "[ $path ]($style)" -truncation_length = 3 -truncation_symbol = "…/" - -# Here is how you can shorten some long paths by text replacement -# similar to mapped_locations in Oh My Posh: -[directory.substitutions] -"Documents" = "󰈙 " -"Downloads" = " " -"Music" = " " -"Pictures" = " " -# Keep in mind that the order matters. For example: -# "Important Documents" = " 󰈙 " -# will not be replaced, because "Documents" was already substituted before. -# So either put "Important Documents" before "Documents" or use the substituted version: -# "Important 󰈙 " = " 󰈙 " - -[c] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[docker_context] -symbol = " " -style = "bg:#06969A" -format = '[ $symbol $context ]($style)' - -[elixir] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[elm] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[git_branch] -symbol = " " -style = "bg:blue fg:base" -format = '[ $symbol $branch ]($style)' - -[git_status] -style = "bg:blue fg:base" -format = '[$all_status$ahead_behind ]($style)' - -[golang] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[gradle] -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[haskell] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[java] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[julia] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[nodejs] -symbol = "" -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[nim] -symbol = "󰆥 " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[rust] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[scala] -symbol = " " -style = "bg:#86BBD8" -format = '[ $symbol ($version) ]($style)' - -[time] -disabled = false -time_format = "%R" # Hour:Minute Format -style = "bg:#33658A" -format = '[ $time ]($style)' diff --git a/home-manager/wlogout/default.nix b/home-manager/wlogout/default.nix index 3a799e6..08474d0 100644 --- a/home-manager/wlogout/default.nix +++ b/home-manager/wlogout/default.nix @@ -1,15 +1,17 @@ # Log out and shutdown menu -{ ... }: - { - home.file = { - ".config/wlogout/hibernate.svg".source = ./hibernate.svg; - ".config/wlogout/lock.svg".source = ./lock.svg; - ".config/wlogout/logout.svg".source = ./logout.svg; - ".config/wlogout/reboot.svg".source = ./reboot.svg; - ".config/wlogout/shutdown.svg".source = ./shutdown.svg; - ".config/wlogout/suspend.svg".source = ./suspend.svg; - }; + home.file = + let + dir = ".config/wlogout"; + in + { + "${dir}/hibernate.svg".source = ./hibernate.svg; + "${dir}/lock.svg".source = ./lock.svg; + "${dir}/logout.svg".source = ./logout.svg; + "${dir}/reboot.svg".source = ./reboot.svg; + "${dir}/shutdown.svg".source = ./shutdown.svg; + "${dir}/suspend.svg".source = ./suspend.svg; + }; programs.wlogout = { enable = true; @@ -51,6 +53,64 @@ keybind = "r"; } ]; - style = ./style.css; + style = + let + theme = import ../../theme.nix; + in + '' + * { + background-image: none; + box-shadow: none; + } + + window { + background-color: rgba(30, 30, 46, 0.9); + } + + button { + border-radius: 0; + border-color: #${theme.pinkAlpha}; + text-decoration-color: #${theme.textAlpha}; + color: #${theme.textAlpha}; + background-color: #${theme.mantleAlpha}; + 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; + } + + #lock { + background-image: url("./lock.svg"); + } + + #logout { + background-image: url("./logout.svg"); + } + + #suspend { + background-image: url("./suspend.svg"); + } + + #hibernate { + background-image: url("./hibernate.svg"); + } + + #shutdown { + background-image: url("./shutdown.svg"); + } + + #reboot { + background-image: url("./reboot.svg"); + } + ''; }; } diff --git a/modules/fonts.nix b/modules/fonts.nix index f475597..c201c85 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -5,15 +5,19 @@ font-awesome # Icons ]; - fonts = { - fontconfig.enable = true; - packages = with pkgs; [ - (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) - jetbrains-mono - # The line below will replace the lines above in 25.05 - # nerd-fonts.jetbrains-mono - font-awesome - ]; - }; + fonts = + let + theme = import ../theme.nix; + in + { + fontconfig.enable = true; + packages = with pkgs; [ + (nerdfonts.override { fonts = [ theme.nerdFont ]; }) + jetbrains-mono + # The line below will replace the lines above in 25.05 + # nerd-fonts.jetbrains-mono + font-awesome + ]; + }; } diff --git a/modules/locale.nix b/modules/locale.nix index 9f7a9ed..08677ca 100644 --- a/modules/locale.nix +++ b/modules/locale.nix @@ -1,5 +1,3 @@ -{ ... }: - # TODO move locale config for hyprland here let utf-8 = "UTF-8"; diff --git a/modules/sddm.nix b/modules/sddm.nix index 5c4c032..e271bcb 100644 --- a/modules/sddm.nix +++ b/modules/sddm.nix @@ -7,7 +7,7 @@ in environment.systemPackages = with pkgs; [ (catppuccin-sddm.override { flavor = flavor; - font = "JetBrainsMono"; + font = theme.nerdFont; fontSize = "9"; background = "${../catppuccin_high.png}"; loginBackground = true; From a60debe4219be60c23a2cf6206ff81895fca4ffd Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Wed, 8 Jan 2025 19:49:57 +0100 Subject: [PATCH 3/3] Replaced ambigious characters --- common.nix | 2 +- configuration.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common.nix b/common.nix index a922195..c5e7092 100644 --- a/common.nix +++ b/common.nix @@ -24,7 +24,7 @@ rec { # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave + # on your system were taken. It's perfectly fine and recommended to leave # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). diff --git a/configuration.nix b/configuration.nix index 6cb70bb..23c6891 100644 --- a/configuration.nix +++ b/configuration.nix @@ -17,7 +17,7 @@ in efi.canTouchEfiVariables = true; }; - # Define a user account. Don't forget to set a password with ‘passwd’. + # Define a user account. Don't forget to set a password with 'passwd'. users.users.${common.username} = { isNormalUser = true; description = common.username;