diff options
author | Freya Murphy <freya@freyacat.org> | 2025-06-23 22:33:44 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-06-23 22:33:44 -0400 |
commit | 328c741b1aac74020412e99e0dca7c728dbc92fa (patch) | |
tree | 461f4ebcd3252d542749a34668defd62de356c73 /modules | |
parent | removed unused packages (diff) | |
download | dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.tar.gz dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.tar.bz2 dotfiles-nix-328c741b1aac74020412e99e0dca7c728dbc92fa.zip |
refactor
Diffstat (limited to 'modules')
28 files changed, 1670 insertions, 0 deletions
diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..f478f50 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,9 @@ +{...}: { + imports = [ + ./desktop + ./development + ./gaming + ./terminal + ./virt + ]; +} diff --git a/modules/desktop/astal.nix b/modules/desktop/astal.nix new file mode 100644 index 0000000..2f7f0f3 --- /dev/null +++ b/modules/desktop/astal.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + pkgs, + inputs, + ... +}: let + system = pkgs.stdenv.hostPlatform.system; + astal = inputs.self.packages.${system}; + + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.astal { + default.appLauncher = lib.mkDefault "astal-launcher"; + + home-manager.users.${config.user} = { + home.packages = [ + astal.astal.shell + astal.astal.launcher + ]; + }; + }; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..a11842c --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,106 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkEnableOption mkIf optionals; + cfg = config.desktop; +in { + imports = [ + ./firefox + ./waybar + ./wofi + ./astal.nix + ./hypridle.nix + ./hyprland.nix + ./hyprlock.nix + ./hyprpaper.nix + ./mako.nix + ]; + + options.desktop = { + enable = mkEnableOption "Enable baseline desktop utils and programs."; + astal = mkEnableOption "Enable the astal gtk shell."; + firefox = mkEnableOption "Enable the firefox browser."; + hypridle = mkEnableOption "Enable the hypridle daemon."; + hyprland = mkEnableOption "Install the Hyprland desktop."; + hyprlock = mkEnableOption "Enable the hyprlock lockscreen."; + hyprpaper = mkEnableOption "Enable the hyprpaper wallpaper daemon."; + mako = mkEnableOption "Enable the mako notification daemon."; + waybar = mkEnableOption "Enable the waybar bar."; + wofi = mkEnableOption "Enable the wofi launcher."; + }; + + config = mkIf cfg.enable { + home-manager.users.${config.user} = { + # desktop specific programs + home.packages = with pkgs; [ + # gtk + adwaita-icon-theme + orchis-theme + # media + ffmpeg + libaacs + libavif + libbluray + libjxl + # wayland + cage + grimblast + wl-clipboard + wl-clip-persist + wl-mirror + # xdg + libnotify + ]; + + # desktop only fonts + fonts.packages = + (with pkgs; [ + corefonts + dejavu_fonts + fira-code + fira-code-symbols + jetbrains-mono + material-icons + nerd-fonts.fira-code + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + twemoji-color-font + vistafonts + ]) + ++ (with inputs.apple-fonts.packages.${pkgs.system}; [ + sf-pro + sf-mono + sf-compact + ]); + + fonts.fontconfig = { + enable = true; + defaultFonts = { + serif = [ + "Twemoji" + "DejaVu Serif" + ]; + sansSerif = [ + "Twemoji" + "DejaVu Sans" + ]; + monospace = [ + "Fira Code" + "FiraCode Nerd Font Mono" + "Font Awesome 6 Pro Regular" + "Twemoji" + "DejaVu Sans Mono" + ]; + emoji = [ + "Twemoji" + "Noto Color Emoji" + ]; + }; + }; + }; + }; +} diff --git a/modules/desktop/firefox/default.nix b/modules/desktop/firefox/default.nix new file mode 100644 index 0000000..e7720b2 --- /dev/null +++ b/modules/desktop/firefox/default.nix @@ -0,0 +1,39 @@ +{ + config, + lib, + pkgs, + ... +}: let + extraPrefs = import ./extraPrefs.nix; + userChrome = import ./userChrome.nix; + my-firefox = pkgs.firefox.override { + extraPrefs = extraPrefs; + }; + + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.firefox { + default.browser = lib.mkDefault "firefox"; + + home-manager.users.${config.user} = { + programs.firefox = { + enable = true; + package = my-firefox; + + # import configuration + policies = import ./policy.nix; + + # create profile for me :3 + profiles.${config.user} = { + search = { + force = true; + default = "ddg"; + }; + + userChrome = userChrome; + }; + }; + }; + }; +} diff --git a/modules/desktop/firefox/extraPrefs.nix b/modules/desktop/firefox/extraPrefs.nix new file mode 100644 index 0000000..74db984 --- /dev/null +++ b/modules/desktop/firefox/extraPrefs.nix @@ -0,0 +1,21 @@ +# extra preferences that cannot be +# set normally but have to instead +# set in mosilla.cfg +'' // + + // Automatically click cookiebanners although uBlock Origin might block them + lockPref("cookiebanners.bannerClicking.enabled", true); + lockPref("cookiebanners.service.mode", 2); + lockPref("cookiebanners.service.mode.privateBrowsing", 2); + + // DNT although PrivacyBadger from policy handles this + lockPref("privacy.donottrackheader.enabled", true); + lockPref("privacy.donottrackheader.value", 1); + + // New sidebar + lockPref("sidebar.revamp", true); + lockPref("sidebar.verticalTabs", true); + lockPref("sidebar.visibility", "always-show"); + lockPref("sidebar.main.tools", "history,bookmarks"); + + //'' diff --git a/modules/desktop/firefox/policy.nix b/modules/desktop/firefox/policy.nix new file mode 100644 index 0000000..e222553 --- /dev/null +++ b/modules/desktop/firefox/policy.nix @@ -0,0 +1,127 @@ +{ + # policies to be set in firefox + # see: https://mozilla.github.io/policy-templates/ + + ExtensionSettings = import ./policyExtensions.nix; + Preferences = import ./policyPrefs.nix; + + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + EmailTracking = true; + }; + + # Certificates + Certificates = { + ImportEnterpriseRoots = true; + }; + + # Cookies + Cookies = { + Behavior = "reject-foreign"; + BehaviorPrivateBrowsing = "reject-foreign"; + Locked = true; + }; + + # DNS + DNSOverHTTPS = { + Enabled = false; + Locked = true; + }; + + # Disable Bad + DisableAppUpdate = true; + DisableAccounts = true; + DisableFirefoxAccounts = true; + DisableFirefoxScreenshots = true; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + AutofillAddressEnabled = false; + AutofillCreditCardEnabled = false; + + # Disable Certain Messages + UserMessaging = { + WhatsNew = false; + ExtensionRecommendations = false; + FeatureRecommendations = false; + UrlbarInterventions = false; + SkipOnboarding = true; + MoreFromMozilla = false; + Labs = false; + Locked = true; + }; + + # Disable Password Manager + DisableMasterPasswordCreation = true; + PasswordManagerEnabled = false; + PrimaryPassword = false; + OfferToSaveLogins = false; + + # Remove Special Pages + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + + # Start Page + Homepage = { + StartPage = "previous-session"; + Locked = true; + }; + + # Home Page + FirefoxHome = { + Search = true; + TopSites = false; + SponsoredTopSites = false; + Highlights = false; + Pocket = false; + SponsoredPocket = false; + Snippets = false; + Locked = true; + }; + + # Search Suggestions + SearchSuggestEnabled = true; + FirefoxSuggest = { + WebSuggestions = false; + SponsoredSuggestions = false; + ImproveSuggest = false; + Locked = true; + }; + + # Save All on Shutdown + SanitizeOnShutdown = false; + + # Popups + PopupBlocking = { + Default = true; + Locked = true; + }; + + # Allow Bypasses + DisableSecurityBypass = { + InvalidCertificate = false; + SafeBrowsing = false; + }; + + # PictureInPicure + PictureInPicture = { + Enabled = true; + Locked = true; + }; + + # Topbar + SearchBar = "unified"; + DisplayMenuBar = "default-off"; + DisplayBookmarksToolbar = "newtab"; + NoDefaultBookmarks = true; + + # Miscellaneous + HttpsOnlyMode = "force_enabled"; + HardwareAcceleration = true; + DontCheckDefaultBrowser = true; + PromptForDownloadLocation = false; + PrivateBrowsingModeAvailability = 0; +} diff --git a/modules/desktop/firefox/policyExtensions.nix b/modules/desktop/firefox/policyExtensions.nix new file mode 100644 index 0000000..51d7e9d --- /dev/null +++ b/modules/desktop/firefox/policyExtensions.nix @@ -0,0 +1,62 @@ +{ + # extensions to be auto downloaded into + # firefox + + # dont allow extensions to be installed though + # firefox, they must be described here! + "*".installation_mode = "blocked"; + + # uBlock Origin + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + + # Bitwarden + "{446900e4-71c2-419f-a6a7-df9c091e268b}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; + installation_mode = "force_installed"; + }; + + # User Agent Switcher + "user-agent-switcher@ninetailed.ninja" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/uaswitcher/latest.xpi"; + installation_mode = "force_installed"; + }; + + # SponsorBlock + "sponsorBlocker@ajay.app" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; + installation_mode = "force_installed"; + }; + + # Privacy Badger + "jid1-MnnxcxisBPnSXQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; + installation_mode = "force_installed"; + }; + + # FoxyProxy + "foxyproxy@eric.h.jung" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi"; + installation_mode = "force_installed"; + }; + + # Redirector + "redirector@einaregilsson.com" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/redirector/latest.xpi"; + installation_mode = "force_installed"; + }; + + # linkding + "{61a05c39-ad45-4086-946f-32adb0a40a9d}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/linkding-extension/latest.xpi"; + installation_mode = "force_installed"; + }; + + # Bypass Paywalls Clean + "magnolia@12.34" = { + install_url = "https://f.freya.cat/xpi/bypass_paywalls_clean-4.1.4.0.xpi"; + installation_mode = "force_installed"; + }; +} diff --git a/modules/desktop/firefox/policyPrefs.nix b/modules/desktop/firefox/policyPrefs.nix new file mode 100644 index 0000000..73d2781 --- /dev/null +++ b/modules/desktop/firefox/policyPrefs.nix @@ -0,0 +1,128 @@ +let + # quick variables to specify + # locked true/false + lock-false = { + Value = false; + Status = "locked"; + }; + lock-true = { + Value = true; + Status = "locked"; + }; +in { + # about:config Preferences + # ... set policies that cannot be set using policies.json directly + + # allow userChrom.css + "toolkit.legacyUserProfileCustomizations.stylesheets" = lock-true; + + # dark theme + "extensions.activeThemeID" = { + Value = "firefox-compact-dark@mozilla.org"; + Status = "locked"; + }; + "layout.css.prefers-color-scheme.content-override" = { + Value = 0; + Status = "locked"; + }; + + # homepage + "browser.startup.homepage" = { + Value = "about:home"; + Status = "locked"; + }; + "browser.newtabpage.enabed" = lock-true; + "browser.newtabpage.url" = { + Value = "about:home"; + Status = "locked"; + }; + + # autofill + "browser.autofill.enabled" = lock-false; + "browser.formfill.enable" = lock-false; + + # search enable + "browser.urlbar.suggest.recentsearches" = lock-true; + "browser.urlbar.suggest.bookmark" = lock-true; + "browser.urlbar.suggest.clipboard" = lock-true; + "browser.urlbar.suggest.history" = lock-true; + + # search disable + "browser.urlbar.suggest.addons" = lock-false; + "browser.urlbar.suggest.calculator" = lock-false; + "browser.urlbar.suggest.engines" = lock-false; + "browser.urlbar.suggest.fakespot" = lock-false; + "browser.urlbar.suggest.mdn" = lock-false; + "browser.urlbar.suggest.openpage" = lock-false; + "browser.urlbar.suggest.pocket" = lock-false; + "browser.urlbar.suggest.remotetab" = lock-false; + "browser.urlbar.suggest.topsites" = lock-false; + "browser.urlbar.suggest.trending" = lock-false; + "browser.urlbar.suggest.weather" = lock-false; + "browser.urlbar.suggest.yelp" = lock-false; + + # privacy + "privacy.globalprivacycontrol.enabled" = lock-true; + + # security + "security.OCSP.enabled" = { + Value = 0; + Status = "locked"; + }; + "browser.contentblocking.category" = { + Value = "strict"; + Status = "locked"; + }; + "xpinstall.whitelist.required" = lock-true; + "signon.management.page.breach-alerts.enabled" = lock-false; + + # graphics + "dom.webgpu.enabled" = lock-true; + "media.eme.enabled" = lock-true; + + # user messaging + # ... disable shit that is annoying + "browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false; + "browser.newtabpage.activity-stream.feeds.snippets" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false; + "browser.newtabpage.activity-stream.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; + "browser.newtabpage.activity-stream.showWeather" = lock-false; + "browser.newtabpage.activity-stream.newtabWallpapers.enabled" = lock-false; + "browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled" = lock-false; + "browser.newtabpage.activity-stream.default.sites" = { + Value = ""; + Status = "locked"; + }; + + # safebrowsing + "browser.safebrowsing.malware.enabled" = lock-true; + "browser.safebrowsing.phishing.enabled" = lock-true; + "browser.safebrowsing.downloads.enabled" = lock-true; + "browser.safebrowsing.downloads.remote.block_uncommon" = lock-false; + "browser.safebrowsing.downloads.remote.block_potentially_unwanted" = lock-false; + + # sidebar + "browser.tabs.inTitlebar" = { + Value = 0; + Status = "locked"; + }; + "browser.tabs.warnOnClose" = lock-true; + "browser.tabs.firefox-view" = lock-false; + "browser.tabs.closeTabByDblclick" = lock-true; + "ui.key.menuAccessKeyFocuses" = lock-false; + + # general settings + "general.autoScroll" = lock-false; + "general.smoothScroll" = lock-true; + "widget.gtk.overlay-scrollbars.enabled" = lock-false; + "accessibility.browsewithcaret" = lock-false; + "accessibility.typeaheadfind" = lock-false; + "media.hardwaremediakeys.enabled" = lock-true; + "browser.crashReports.unsubmittedCheck.autoSubmit2" = lock-false; + "browser.aboutConfig.showWarning" = lock-false; +} diff --git a/modules/desktop/firefox/userChrome.nix b/modules/desktop/firefox/userChrome.nix new file mode 100644 index 0000000..ab93747 --- /dev/null +++ b/modules/desktop/firefox/userChrome.nix @@ -0,0 +1,23 @@ +'' + /* sidebar hack to flip contents the way i want them (arrows on the left) */ + #nav-bar-customization-target { + flex-direction: row-reverse; + } + + /* remove broken padding from sidebar hack */ + #unified-extensions-button { + padding-left: 0 !important; + } + + /* remove padding beside search bar */ + toolbarspring { + display: none !important; + } + + /* remove overflow menu and everything in it */ + #nav-bar-overflow-button, + #firefox-view-button, + #alltabs-button { + visibility: collapse; + } +'' diff --git a/modules/desktop/hypridle.nix b/modules/desktop/hypridle.nix new file mode 100644 index 0000000..01d4996 --- /dev/null +++ b/modules/desktop/hypridle.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.hypridle { + home-manager.users.${config.user} = { + services.hypridle = { + enable = true; + + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + }; + + listener = [ + # dim screen + { + timeout = 150; + on-timeout = "brightnessctl -s set 10"; + on-resume = "brightnessctl -r"; + } + # lock + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + # turn off screen + { + timeout = 350; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; + }; + }; + }; +} diff --git a/modules/desktop/hyprland.nix b/modules/desktop/hyprland.nix new file mode 100644 index 0000000..10b058d --- /dev/null +++ b/modules/desktop/hyprland.nix @@ -0,0 +1,353 @@ +{ + config, + pkgs, + lib, + inputs, + ... +}: let + system = pkgs.stdenv.hostPlatform.system; + hyprland = inputs.hyprland.packages.${system}; + hyprland-plugins = inputs.hyprland-plugins.packages.${system}; + hy3 = inputs.hy3.packages.${system}; + + fg = "rgb(${config.theme.colors.fg})"; + bg = "rgb(${config.theme.colors.bg})"; + primary = "rgb(${config.theme.colors.primary})"; + inactive = "rgb(${config.theme.colors.surface.bg})"; + + debug = false; + + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.hyprland { + environment = { + variables = { + HYPRLAND_TRACE = + if debug + then "1" + else "0"; + AQ_TRACE = + if debug + then "1" + else "0"; + + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + XDG_SESSION_DESKTOP = "Hyprland"; + LIBSEAT_BACKEND = "logind"; + }; + sessionVariables = { + XCURSOR_THEME = "Adwaita"; + XCURSOR_SIZE = "24"; + + GTK_THEME = "Orchis-Teal-Dark"; + + MOZ_ENABLE_WAYLAND = "1"; + MOZ_USE_XINPUT = "1"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + }; + }; + + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + config = { + common.default = ["gtk"]; + hyprland.default = ["gtk" "hyprland"]; + }; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-wlr + hyprland.xdg-desktop-portal-hyprland + ]; + }; + + programs.xwayland.enable = true; + + home-manager.users.${config.user} = { + wayland.windowManager.hyprland = { + enable = true; + package = hyprland.hyprland; + + xwayland.enable = true; + systemd.enable = true; + + # Plugins + plugins = [ + hyprland-plugins.hyprexpo + hy3.hy3 + ]; + + # Config + settings = { + # Debug + debug.disable_logs = ! debug; + debug.disable_time = ! debug; + debug.enable_stdout_logs = debug; + + # Monitors + monitor = + map ( + monitor: "${monitor.name}, highres, auto, ${toString monitor.scale}, bitdepth, ${toString monitor.bitdepth}" + ) + config.monitors; + + # Autostart + exec-once = config.autoRun; + + # General + general = { + gaps_in = config.theme.innerGap; + gaps_out = config.theme.outerGap; + layout = "hy3"; + resize_on_border = "yes"; + extend_border_grab_area = 20; + border_size = config.theme.borderWidth; + "col.active_border" = "${primary}"; + "col.inactive_border" = "${inactive}"; + }; + + # Gestures + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 3; + workspace_swipe_forever = true; + workspace_swipe_cancel_ratio = 0.15; + }; + + # Decoration + decoration = { + rounding = config.theme.outerRadius; + shadow.enabled = false; + blur = { + enabled = config.theme.blur; + size = 4; + passes = 2; + noise = 0.008; + contrast = 0.8916; + brightness = 0.8; + }; + }; + + # Animations + animations = { + enabled = true; + + bezier = [ + "windowIn, 0.06, 0.71, 0.25, 1" + "windowResize, 0.04, 0.67, 0.38, 1" + ]; + + animation = [ + "windowsIn, 1, 3, windowIn, slide #popin 20%" + "windowsOut, 1, 3, windowIn, slide #popin 70%" + "windowsMove, 1, 2.5, windowResize" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 3, default" + "workspaces, 1, 6, default" + "layers, 1, 5, windowIn, slide" + ]; + }; + + # Input + input = { + kb_layout = "us"; + kb_variant = ""; + kb_model = ""; + kb_options = "gtp:alt_shift_toggle, compose:ralt"; + kb_rules = ""; + follow_mouse = 1; + touchpad = { + natural_scroll = "yes"; + }; + sensitivity = 0; + }; + + # Keybinds + "$mod" = "SUPER"; + bind = [ + # Launch programs + + "$mod, W, exec, ${config.default.browser}" + "$mod, D, exec, ${config.default.appLauncher}" + "$mod, L, exec, ${config.default.lockScreen}" + "$mod, Return, exec, ${config.default.terminal}" + ", Print, exec, grimblast copy area" + + # Misc + + "$mod SHIFT, L, exit" + "$mod, tab, hyprexpo:expo, toggle" + + # Window operations + + "$mod SHIFT, Q, killactive" + "$mod SHIFT, SPACE, togglefloating" + "$mod, F, fullscreen" + "$mod, J, togglesplit" + + # Move focus with mod + arrow keys + + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + + # Move window across workspace with mod + arrow keys + + "$mod SHIFT, left, hy3:movewindow, l" + "$mod SHIFT, right, hy3:movewindow, r" + "$mod SHIFT, up, hy3:movewindow, u" + "$mod SHIFT, down, hy3:movewindow, d" + + # Switch workspaces with mod + [0-9] + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + + # Move active window to a workspace with mod + SHIFT + [0-9] + + "$mod SHIFT, 1, movetoworkspacesilent, 1" + "$mod SHIFT, 2, movetoworkspacesilent, 2" + "$mod SHIFT, 3, movetoworkspacesilent, 3" + "$mod SHIFT, 4, movetoworkspacesilent, 4" + "$mod SHIFT, 5, movetoworkspacesilent, 5" + "$mod SHIFT, 6, movetoworkspacesilent, 6" + "$mod SHIFT, 7, movetoworkspacesilent, 7" + "$mod SHIFT, 8, movetoworkspacesilent, 8" + "$mod SHIFT, 9, movetoworkspacesilent, 9" + "$mod SHIFT, 0, movetoworkspacesilent, 10" + + # Move to tab + + "LALT, 1, hy3:focustab, index, 01" + "LALT, 2, hy3:focustab, index, 02" + "LALT, 3, hy3:focustab, index, 03" + "LALT, 4, hy3:focustab, index, 04" + "LALT, 5, hy3:focustab, index, 05" + "LALT, 6, hy3:focustab, index, 06" + "LALT, 7, hy3:focustab, index, 07" + "LALT, 8, hy3:focustab, index, 08" + "LALT, 9, hy3:focustab, index, 09" + "LALT, 0, hy3:focustab, index, 10" + + "$mod SHIFT, B, hy3:makegroup, h" + "$mod SHIFT, V, hy3:makegroup, v" + "$mod SHIFT, C, hy3:changegroup, toggletab" + + # Scroll through existing workspaces with mod + scroll + + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + ]; + + bindn = [ + # Focus windows with scroll wheel or middle click + + ", mouse:272, hy3:focustab, mouse" + ", mouse_down, hy3:focustab, l, require_hovered" + ", mouse_up, hy3:focustab, r, require_hovered" + ]; + + bindm = [ + # Move/resize windows with mod + LMB/RMB and dragging + + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + binde = [ + # Audio + + # raise volume + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" + # lower volume + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + # mute speaker + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + # mute mic + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + + # Media + + # play + ", XF86AudioPlay, exec, playerctl play-pause" + # next + ", XF86AudioNext, exec, playerctl next" + # prev + ", XF86AudioPrev, exec, playerctl previous" + + # Backlight + + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ", XF86MonBrightnessUp, exec, brightnessctl set 5%+" + ]; + + # Plugin configuration + plugin = { + # hy3 + hy3 = { + tabs = { + height = 24; + text_height = 9; + text_padding = 10; + padding = 2; + render_text = true; + text_font = "monospace"; + radius = config.theme.outerRadius; + border_width = config.theme.borderWidth; + + "col.active" = "${bg}"; + "col.active.border" = "${inactive}"; + "col.active.text" = "${fg}"; + "col.inactive" = "${bg}"; + "col.inactive.border" = "${inactive}"; + "col.inactive.text" = "${fg}"; + }; + + autotile = { + enable = true; + }; + }; + }; + + # XWayland + xwayland = { + force_zero_scaling = "true"; + use_nearest_neighbor = "false"; + }; + + # Misc + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + key_press_enables_dpms = true; + mouse_move_enables_dpms = true; + enable_anr_dialog = false; + vrr = 1; + }; + + # Ecosystem + ecosystem = { + no_update_news = true; + no_donation_nag = true; + }; + + # Experimental + experimental = { + xx_color_management_v4 = true; + }; + }; # end settings + }; # end hyprland + }; # end home-manager + }; +} diff --git a/modules/desktop/hyprlock.nix b/modules/desktop/hyprlock.nix new file mode 100644 index 0000000..9237be5 --- /dev/null +++ b/modules/desktop/hyprlock.nix @@ -0,0 +1,87 @@ +{ + config, + lib, + ... +}: let + fg = "rgb(${config.theme.colors.fg})"; + bg = "rgb(${config.theme.colors.bg})"; + error = "rgb(${config.theme.colors.error})"; + trans = "rgba(0,0,0,0)"; + + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.hyprlock { + default.lockScreen = lib.mkDefault "hyprlock"; + + home-manager.users.${config.user} = { + programs.hyprlock = { + enable = true; + + settings = { + background = { + path = config.theme.lockscreen; + color = bg; + blur_passes = 0; + blur_size = 2; + noise = 0; + contrast = 0; + brightness = 0; + vibrancy = 0; + vibrancy_darkness = 0.0; + }; + + # Password Input + input-field = { + size = "300, 30"; + outline_thickness = 0; + dots_size = 0.25; + dots_spacing = 0.55; + dots_center = true; + dots_rounding = -1; + outer_color = trans; + inner_color = trans; + font_color = fg; + fade_on_empty = false; + placeholder_text = "Enter Password"; + hide_input = false; + check_color = error; + fail_color = error; + capslock_color = -1; + numlock_color = -1; + bothlock_color = -1; + invert_numlock = false; + swap_font_color = false; + font_family = config.theme.font.regular; + position = "0, 50"; + halign = "center"; + valign = "bottom"; + }; + + label = [ + # Date + { + text = "cmd[update:1000] echo \"$(date +\"%A, %B %d\")\""; + color = fg; + font_size = 20; + font_family = config.theme.font.header; + position = "0, -100"; + halign = "center"; + valign = "top"; + } + # Clock + { + text = "cmd[update:1000] echo \"$(date +\"%k:%M:%S\")\""; + color = fg; + font_size = 90; + font_family = config.theme.font.header; + position = "0, -130"; + halign = "center"; + valign = "top"; + } + ]; + }; + }; + }; + }; +} diff --git a/modules/desktop/hyprpaper.nix b/modules/desktop/hyprpaper.nix new file mode 100644 index 0000000..045ae62 --- /dev/null +++ b/modules/desktop/hyprpaper.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.hyprpaper { + home-manager.users.${config.user} = { + services.hyprpaper = { + enable = true; + + settings = { + preload = config.theme.wallpaper; + wallpaper = ",${config.theme.wallpaper}"; + splash = false; + }; + }; + }; + }; +} diff --git a/modules/desktop/mako.nix b/modules/desktop/mako.nix new file mode 100644 index 0000000..17ed94f --- /dev/null +++ b/modules/desktop/mako.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.mako { + home-manager.users.${config.user} = { + services.mako = { + enable = false; # now using astal + + settings = { + font = "${config.theme.font.monospace} 11"; + + margin = toString config.theme.outerGap; + padding = toString config.theme.innerGap; + + background-color = "#${config.theme.colors.bg}"; + progress-color = "#${config.theme.colors.primary}"; + text-color = "#${config.theme.colors.fg}"; + + border-color = "#${config.theme.colors.fg}"; + border-size = config.theme.borderWidth; + border-radius = config.theme.outerRadius; + + default-timeout = 5000; + layer = "overlay"; + icons = true; + }; + }; + }; + }; +} diff --git a/modules/desktop/waybar/default.nix b/modules/desktop/waybar/default.nix new file mode 100644 index 0000000..c2d6927 --- /dev/null +++ b/modules/desktop/waybar/default.nix @@ -0,0 +1,87 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.waybar { + home-manager.users.${config.user} = { + programs.waybar = { + enable = false; # using astal now + + settings = [ + { + height = 24; + layer = "top"; + position = "top"; + spacing = 4; + + modules-left = [ + "hyprland/workspaces" + ]; + modules-center = [ + "clock" + ]; + modules-right = [ + "battery" + "wireplumber" + "network" + "tray" + ]; + + "hyprland/workspaces" = { + disable-scroll = true; + all-outputs = true; + format = "{name}"; + }; + + battery = { + interval = 1; + states = { + warning = 30; + critical = 15; + }; + format = " {capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-full = " {capacity}%"; + format-warning = " {capacity}%"; + format-critical = " {capacity}%"; + }; + + wireplumber = { + format = " {volume}%"; + format-bluetooth = " {volume}%"; + format-muted = " muted"; + scroll-step = 1; + on-click = "pavucontrol"; + ignored-sinks = ["Easy Effects Sink"]; + }; + + network = { + format = " disconnected"; + format-wifi = " {essid}"; + format-ethernet = " {ipaddr}/{cidr}"; + format-disconnected = " disconnected"; + max-length = 50; + on-click = "nm-connection-editor"; + }; + + clock = { + interval = 1; + format = "{:%Y-%m-%d %a %H:%M:%S}"; + }; + + tray = { + spacing = config.theme.outerGap; + }; + } + ]; + + style = import ./style.nix {theme = config.theme;}; + }; + }; + }; +} diff --git a/modules/desktop/waybar/style.nix b/modules/desktop/waybar/style.nix new file mode 100644 index 0000000..33db673 --- /dev/null +++ b/modules/desktop/waybar/style.nix @@ -0,0 +1,108 @@ +{theme}: let + fg = "#${theme.colors.fg}"; + bg = "#${theme.colors.bg}"; + surface-fg = "#${theme.colors.surface.fg}"; + surface-bg = "#${theme.colors.surface.bg}"; + primary = "#${theme.colors.primary}"; + success = "#${theme.colors.success}"; + warning = "#${theme.colors.warning}"; + error = "#${theme.colors.error}"; + fontSize = "${toString theme.font.size}px"; + outerGap = "${toString theme.outerGap}px"; + innerGap = "${toString theme.innerGap}px"; + outerRadius = "${toString theme.outerRadius}px"; + innerRadius = "${toString theme.innerRadius}px"; + borderWidth = "${toString theme.borderWidth}px"; +in '' + /** Base */ + + * { + all: unset; + } + + window#waybar { + font-family: "${theme.font.regular}", "${theme.font.icon}", "${theme.font.monospace}"; + font-size: ${fontSize}; + color: ${fg}; + background-color: ${bg}; + } + + /** Workspaces */ + + #workspaces { + margin-left: ${outerGap}; + } + + #workspaces button { + border-radius: ${innerRadius}; + margin: 4px 2px; + padding: 0px 7px; + background: ${surface-bg}; + color: ${surface-fg}; + } + + #workspaces button.focused, + #workspaces button.active { + background: ${primary}; + color: ${bg}; + } + + #workspaces button.urgent { + background: ${error}; + } + + /** Tray */ + + #tray { + border: none; + margin-right: ${outerGap}; + } + + #tray > .passive { + -gtk-icon-effect: dim; + } + + #tray > .needs-attention { + -gtk-icon-effect: highlight; + } + + /** Right modules */ + + #battery, + #wireplumber, + #network { + padding: 0 ${outerGap}; + } + + /** Battery */ + + #battery.charging { + color: ${success}; + } + + #battery.warning:not(.charging) { + color: ${warning}; + } + + #battery.critical:not(.charging) { + color: ${error}; + } + + /** Wireplumber */ + + #wireplumber.muted { + color: ${error}; + } + + /** Network */ + + #network.wifi, + #network.ethernet { + color: ${success}; + } + + #network.disconnected { + color: ${error}; + } + +'' diff --git a/modules/desktop/wofi/default.nix b/modules/desktop/wofi/default.nix new file mode 100644 index 0000000..aa04495 --- /dev/null +++ b/modules/desktop/wofi/default.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.desktop; +in { + config = mkIf cfg.wofi { + default.appLauncher = lib.mkDefault "wofi --show drun --prompt 'Seach Programs'"; + + home-manager.users.${config.user} = { + programs.wofi = { + enable = true; + + settings = { + key_expand = "Tab"; + term = "kitty"; + matching = "multi-contains"; + insensitive = true; + gtk_dark = true; + hide_scroll = true; + }; + + style = import ./style.nix {theme = config.theme;}; + }; + }; + }; +} diff --git a/modules/desktop/wofi/style.nix b/modules/desktop/wofi/style.nix new file mode 100644 index 0000000..27b7205 --- /dev/null +++ b/modules/desktop/wofi/style.nix @@ -0,0 +1,74 @@ +{theme}: let + fg = "#${theme.colors.fg}"; + bg = "#${theme.colors.bg}"; + surface-fg = "#${theme.colors.surface.fg}"; + surface-bg = "#${theme.colors.surface.bg}"; + primary = "#${theme.colors.primary}"; + fontSize = "${toString theme.font.size}px"; + outerGap = "${toString theme.outerGap}px"; + innerGap = "${toString theme.innerGap}px"; + outerRadius = "${toString theme.outerRadius}px"; + innerRadius = "${toString theme.innerRadius}px"; + borderWidth = "${toString theme.borderWidth}px"; +in '' + * { + font-family: ${theme.font.monospace}; + font-size: ${fontSize}; + } + + /* Window */ + window { + margin: 0px; + border: ${borderWidth} solid ${primary}; + border-radius: ${outerRadius}; + background-color: ${bg}; + } + + /* Outer Box */ + #outer-box { + padding: ${outerGap}; + } + + /* Scroll */ + #scroll { + margin: 0px; + padding: ${innerGap}; + border: none; + } + + /* Input */ + #input { + margin: ${innerGap}; + padding: ${innerGap}; + border: none; + color: ${surface-fg}; + background-color: ${surface-bg}; + border-radius: ${outerRadius}; + } + + #input:focus, + #input:active { + border: ${borderWidth} solid ${primary}; + box-shadow: none; + outline: none; + } + + /* Text */ + #text { + margin: ${innerGap}; + padding: ${innerGap}; + border: none; + color: ${fg}; + } + + /* Selected Entry */ + #entry:selected { + background-color: ${primary}; + border-radius: ${outerRadius}; + } + + #entry:selected #text { + color: ${bg}; + } + +'' diff --git a/modules/development/default.nix b/modules/development/default.nix new file mode 100644 index 0000000..486a220 --- /dev/null +++ b/modules/development/default.nix @@ -0,0 +1,49 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkEnableOption optionals; + cfg = config.development; +in { + options.development = { + c = mkEnableOption "Enable c/c++ development tools."; + java = mkEnableOption "Enable java/kotlin development tools."; + rust = mkEnableOption "Enable rust development tools."; + zig = mkEnableOption "Enable zig development tools."; + }; + + config = { + home-manager.users.${config.user} = { + home.packages = with pkgs; + (optionals cfg.c [ + clang-tools + gcc + gdb + gnumake + nasm + pkg-config + ]) + ++ (optionals cfg.rust [ + rustc + rustfmt + rust-analyzer + cargo + clippy + ]) + ++ (optionals cfg.java [ + gradle + jdk + jdt-language-server + kotlin + kotlin-language-server + maven + ]) + ++ (optionals cfg.zig [ + zig + zls + ]); + }; + }; +} diff --git a/modules/gaming/default.nix b/modules/gaming/default.nix new file mode 100644 index 0000000..a0c826c --- /dev/null +++ b/modules/gaming/default.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkEnableOption; +in { + imports = [ + ./homestuck.nix + ./minecraft.nix + ./steam.nix + ]; + + options.gaming = { + homestuck = mkEnableOption "Install the unofficial homestuck collection."; + minecraft = mkEnableOption "Install the minecraft block game."; + steam = mkEnableOption "Install the steam game launcher."; + }; +} diff --git a/modules/gaming/homestuck.nix b/modules/gaming/homestuck.nix new file mode 100644 index 0000000..12641a4 --- /dev/null +++ b/modules/gaming/homestuck.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + pkgs, + inputs, + ... +}: let + inherit (lib) mkIf; + cfg = config.gaming; + system = pkgs.stdenv.hostPlatform.system; +in { + config = mkIf cfg.homestuck { + home-manager.users.${config.user} = { + home.packages = [ + inputs.self.packages.${system}.unofficial-homestuck-collection + ]; + }; + }; +} diff --git a/modules/gaming/minecraft.nix b/modules/gaming/minecraft.nix new file mode 100644 index 0000000..5de20e6 --- /dev/null +++ b/modules/gaming/minecraft.nix @@ -0,0 +1,17 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.gaming; +in { + config = mkIf cfg.minecraft { + home-manager.users.${config.user} = { + home.packages = with pkgs; [ + prismlauncher + ]; + }; + }; +} diff --git a/modules/gaming/steam.nix b/modules/gaming/steam.nix new file mode 100644 index 0000000..53ab252 --- /dev/null +++ b/modules/gaming/steam.nix @@ -0,0 +1,34 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkIf; + cfg = config.gaming; +in { + config = mkIf cfg.steam { + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-runtime" + ]; + + programs.gamescope = { + enable = true; + capSysNice = true; + }; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + gamescopeSession.enable = true; + }; + + # controllers + hardware.xone.enable = true; + hardware.steam-hardware.enable = true; + }; +} diff --git a/modules/terminal/default.nix b/modules/terminal/default.nix new file mode 100644 index 0000000..8e9d5f8 --- /dev/null +++ b/modules/terminal/default.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkEnableOption; +in { + imports = [ + ./kitty.nix + ]; + + options.terminal = { + kitty = mkEnableOption "Enable the kitty terminal."; + }; +} diff --git a/modules/terminal/kitty.nix b/modules/terminal/kitty.nix new file mode 100644 index 0000000..88aa151 --- /dev/null +++ b/modules/terminal/kitty.nix @@ -0,0 +1,84 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf; + cfg = config.terminal; +in { + config = mkIf cfg.kitty { + default.terminal = lib.mkDefault "kitty"; + + home-manager.users.${config.user} = { + programs.kitty = { + enable = true; + environment = {}; + extraConfig = ""; + + settings = { + # Font + font_family = config.theme.font.monospace; + font_size = 11; + bold_font = "auto"; + italic_font = "auto"; + bold_italic_font = "auto"; + + # Scrollback + scrollback_lines = 10000; + scrollback_pager_history_size = 300; # MB + + # Urls + detect_urls = true; + show_hyperlink_targets = false; + + # Window + window_padding_width = config.theme.outerGap; + window_border_width = 0; + draw_minimal_borders = true; + background_opacity = config.theme.opacity; + + # Disable audio + enable_audio_bell = false; + + # Disable close prompt + confirm_os_window_close = 0; + + # colors + background = "#${config.theme.colors.bg}"; + foreground = "#${config.theme.colors.fg}"; + selection_background = "#${config.theme.colors.surface.bg}"; + selection_foreground = "#${config.theme.colors.surface.fg}"; + url_color = "#${config.theme.colors.bright.yellow}"; + cursor = "#${config.theme.colors.fg}"; + active_border_color = "#${config.theme.colors.primary}"; + inactive_border_color = "#${config.theme.colors.bg}"; + active_tab_background = "#${config.theme.colors.bg}"; + active_tab_foreground = "#${config.theme.colors.fg}"; + inactive_tab_background = "#${config.theme.colors.bg}"; + inactive_tab_foreground = "#${config.theme.colors.fg}"; + tab_bar_background = "#${config.theme.colors.bg}"; + + # normal + color0 = "#${config.theme.colors.normal.black}"; + color1 = "#${config.theme.colors.normal.red}"; + color2 = "#${config.theme.colors.normal.green}"; + color3 = "#${config.theme.colors.normal.yellow}"; + color4 = "#${config.theme.colors.normal.blue}"; + color5 = "#${config.theme.colors.normal.magenta}"; + color6 = "#${config.theme.colors.normal.cyan}"; + color7 = "#${config.theme.colors.normal.white}"; + + # bright + color8 = "#${config.theme.colors.bright.black}"; + color9 = "#${config.theme.colors.bright.red}"; + color10 = "#${config.theme.colors.bright.green}"; + color11 = "#${config.theme.colors.bright.yellow}"; + color12 = "#${config.theme.colors.bright.blue}"; + color13 = "#${config.theme.colors.bright.magenta}"; + color14 = "#${config.theme.colors.bright.cyan}"; + color15 = "#${config.theme.colors.bright.white}"; + }; + }; + }; + }; +} diff --git a/modules/virt/default.nix b/modules/virt/default.nix new file mode 100644 index 0000000..c5d3960 --- /dev/null +++ b/modules/virt/default.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkEnableOption; + cfg = config.virt; +in { + imports = [ + ./docker.nix + ./qemu.nix + ]; + + options.virt = { + docker = mkEnableOption "Install docker and its components."; + qemu = mkEnableOption "Install qemu and its components."; + }; +} diff --git a/modules/virt/docker.nix b/modules/virt/docker.nix new file mode 100644 index 0000000..5930858 --- /dev/null +++ b/modules/virt/docker.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.virt; +in { + config = mkIf cfg.docker { + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; + users.groups.docker.members = [config.user]; + }; +} diff --git a/modules/virt/qemu.nix b/modules/virt/qemu.nix new file mode 100644 index 0000000..f5d9d24 --- /dev/null +++ b/modules/virt/qemu.nix @@ -0,0 +1,20 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.virt; +in { + config = mkIf cfg.qemu { + programs.virt-manager.enable = true; + users.groups.libvirtd.members = [config.user]; + virtualisation.libvirtd.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + + environment.systemPackages = with pkgs; [ + qemu + ]; + }; +} |