diff options
author | Freya Murphy <freya@freyacat.org> | 2025-06-17 21:57:53 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-06-17 21:57:53 -0400 |
commit | e0f2eb724245e02cb247b644f0947261d8665318 (patch) | |
tree | 13f929df40059d37165cbe46be95a6404a1bbecb /programs | |
parent | refactor styles to new color scheme basis (diff) | |
download | dotfiles-nix-e0f2eb724245e02cb247b644f0947261d8665318.tar.gz dotfiles-nix-e0f2eb724245e02cb247b644f0947261d8665318.tar.bz2 dotfiles-nix-e0f2eb724245e02cb247b644f0947261d8665318.zip |
remove nix dir and move out all sub modules
Diffstat (limited to 'programs')
32 files changed, 2218 insertions, 0 deletions
diff --git a/programs/default.nix b/programs/default.nix new file mode 100644 index 0000000..022705b --- /dev/null +++ b/programs/default.nix @@ -0,0 +1,23 @@ +{ ... }: + +{ + imports = [ + ./firefox + ./git + ./gpg + ./hypr + ./kitty + ./mako + ./neovim + ./sops + ./ssh + ./starship + ./steam + ./talc + ./unofficial-homestuck-collection + ./waybar + ./wireguard + ./wofi + ./zsh + ]; +} diff --git a/programs/firefox/default.nix b/programs/firefox/default.nix new file mode 100644 index 0000000..662f42a --- /dev/null +++ b/programs/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; + }); + +in + +{ + 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/programs/firefox/extraPrefs.nix b/programs/firefox/extraPrefs.nix new file mode 100644 index 0000000..b9e9ed2 --- /dev/null +++ b/programs/firefox/extraPrefs.nix @@ -0,0 +1,22 @@ +# 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/programs/firefox/policy.nix b/programs/firefox/policy.nix new file mode 100644 index 0000000..e0a2caa --- /dev/null +++ b/programs/firefox/policy.nix @@ -0,0 +1,129 @@ +{ + + # 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/programs/firefox/policyExtensions.nix b/programs/firefox/policyExtensions.nix new file mode 100644 index 0000000..b2e5043 --- /dev/null +++ b/programs/firefox/policyExtensions.nix @@ -0,0 +1,64 @@ +{ + + # 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/programs/firefox/policyPrefs.nix b/programs/firefox/policyPrefs.nix new file mode 100644 index 0000000..a8ac797 --- /dev/null +++ b/programs/firefox/policyPrefs.nix @@ -0,0 +1,131 @@ +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/programs/firefox/userChrome.nix b/programs/firefox/userChrome.nix new file mode 100644 index 0000000..2deefb5 --- /dev/null +++ b/programs/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/programs/git/default.nix b/programs/git/default.nix new file mode 100644 index 0000000..d919b90 --- /dev/null +++ b/programs/git/default.nix @@ -0,0 +1,21 @@ +{ config, ... }: + +{ + home-manager.users.${config.user} = { + programs.git = { + enable = true; + userName = config.fullName; + userEmail = config.email; + + signing = { + format = "openpgp"; + key = "D9AF0A4209B7C2DE11A884BFACBC553660D9993D"; + signByDefault = true; + }; + + extraConfig = { + init.defaultBranch = "main"; + }; + }; + }; +} diff --git a/programs/gpg/default.nix b/programs/gpg/default.nix new file mode 100644 index 0000000..e45617d --- /dev/null +++ b/programs/gpg/default.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +let + + keysDir = ../../files/keys; + keys = lib.attrsets.mapAttrsToList (name: type: "${keysDir}/${name}") (builtins.readDir keysDir); + gpgKeys = builtins.filter (path: lib.strings.hasSuffix "asc" path) keys; + +in +{ + home-manager.users.${config.user} = { + + # install keys into gpg keyring + programs.gpg = { + enable = true; + publicKeys = map (path: { source = path; trust = 5; }) gpgKeys; + }; + + # global gpg agent + services.gpg-agent = { + enable = true; + enableExtraSocket = true; + enableSshSupport = true; + pinentry.package = pkgs.pinentry-curses; + }; + + }; + + # yubikey support + services = { + pcscd.enable = true; + udev.packages = with pkgs; [ + yubikey-personalization + ]; + }; +} diff --git a/programs/hypr/default.nix b/programs/hypr/default.nix new file mode 100644 index 0000000..08b2d93 --- /dev/null +++ b/programs/hypr/default.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + ./hypridle.nix + ./hyprland.nix + ./hyprlock.nix + ./hyprpaper.nix + ]; +} diff --git a/programs/hypr/hypridle.nix b/programs/hypr/hypridle.nix new file mode 100644 index 0000000..d100291 --- /dev/null +++ b/programs/hypr/hypridle.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: + +{ + 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/programs/hypr/hyprland.nix b/programs/hypr/hyprland.nix new file mode 100644 index 0000000..9631674 --- /dev/null +++ b/programs/hypr/hyprland.nix @@ -0,0 +1,332 @@ +{ 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; + +in + +{ + 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}" + ) 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 = true; + 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_shit_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; + vrr = 1; + }; + }; # end settings + + }; # end hyprland + }; # end home-manager + +} diff --git a/programs/hypr/hyprlock.nix b/programs/hypr/hyprlock.nix new file mode 100644 index 0000000..8c8f63d --- /dev/null +++ b/programs/hypr/hyprlock.nix @@ -0,0 +1,89 @@ +{ config, lib, ... }: + +{ + default.lockScreen = lib.mkDefault "hyprlock"; + + home-manager.users.${config.user} = { + programs.hyprlock = { + + enable = true; + + settings = { + + background = { + monitor = ""; + path = config.theme.wallpaper; + blur_passes = 3; + contrast = 0.8916; + brightness = 0.8172; + vibrancy = 0.1696; + vibrancy_darkness = 0.0; + }; + + general = { + no_fade_in = false; + grace = 0; + disable_loading_bar = true; + }; + + input-field = { + monitor = ""; + size = "250, 60"; + outline_thickness = 2; + dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true; + outer_color = "rgba(0, 0, 0, 0)"; + inner_color = "rgba(0, 0, 0, 0.5)"; + font_color = "rgb(${config.theme.colors.fg})"; + font_family = config.theme.font.regular; + fade_on_empty = false; + placeholder_text = "<i><span foreground=\"##${config.theme.colors.fg}\">Input Password...</span></i>"; + hide_input = false; + position = "0, -120"; + halign = "center"; + valign = "center"; + }; + + label = [ + # Clock + { + monitor = ""; + text = "cmd[update:1000] echo \"$(date +\"%-H:%M:%S\")\""; + font_size = 80; + font_color = "rgb(${config.theme.colors.fg})"; + font_family = config.theme.font.header; + position = "0, 500"; + halign = "center"; + valign = "center"; + } + + # Name + { + monitor = ""; + text = config.fullName; + font_color = "rgb(${config.theme.colors.fg})"; + font_family = config.theme.font.header; + font_size = 25; + position = "0, 50"; + halign = "center"; + valign = "center"; + } + ]; + + # Profile image + image = { + monitor = ""; + path = config.theme.avatar; + size = 300; + rounding = -1; + border_size = 0; + position = "0, 250"; + halign = "center"; + valign = "center"; + }; + }; + + }; + }; +} diff --git a/programs/hypr/hyprpaper.nix b/programs/hypr/hyprpaper.nix new file mode 100644 index 0000000..ddcb6cd --- /dev/null +++ b/programs/hypr/hyprpaper.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + services.hyprpaper = { + + enable = true; + + settings = { + preload = config.theme.wallpaper; + wallpaper = ",${config.theme.wallpaper}"; + splash = false; + }; + + }; + }; +} + diff --git a/programs/kitty/default.nix b/programs/kitty/default.nix new file mode 100644 index 0000000..994da43 --- /dev/null +++ b/programs/kitty/default.nix @@ -0,0 +1,78 @@ +{ config, lib, ... }: + +{ + 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/programs/mako/default.nix b/programs/mako/default.nix new file mode 100644 index 0000000..2bd2a56 --- /dev/null +++ b/programs/mako/default.nix @@ -0,0 +1,32 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + services.mako = { + + enable = true; + + 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/programs/neovim/default.nix b/programs/neovim/default.nix new file mode 100644 index 0000000..a88b9d7 --- /dev/null +++ b/programs/neovim/default.nix @@ -0,0 +1,541 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + options = { + neovim = { + + tabWidth = mkOption { + type = types.int; + description = "Width of tabes in the editor."; + default = 4; + }; + expandTab = mkOption { + type = types.bool; + description = "If tabs should be expanded to spaces."; + default = false; + }; + + keys = { + leader = mkOption { + type = types.str; + description = "NeoVIM leader key"; + default = " "; + }; + noh = mkOption { + type = types.str; + description = "Keybind to remove active hilighted content."; + default = "<leader>h"; + }; + + menus = { + # file browser + browser = mkOption { + type = types.str; + description = "Keybind to open file browser."; + default = "<leader>e"; + }; + # active buffers + buffers = mkOption { + type = types.str; + description = "Keybind to show active buffers."; + default = "<leader>fb"; + }; + # error list + error = mkOption { + type = types.str; + description = "Keybind to show LSP errors."; + default = "<leader>t"; + }; + # find files + find = mkOption { + type = types.str; + description = "Keybind to search files in working directory."; + default = "<leader>ff"; + }; + # grep files + grep = mkOption { + type = types.str; + description = "Keybind to grep files in working directory."; + default = "<leader>fg"; + }; + # help menu + help = mkOption { + type = types.str; + description = "Keybind to search help menus."; + default = "<leader>fh"; + }; + # undo tree + undo = mkOption { + type = types.str; + description = "Keybind to view undo tree."; + default = "<leader>u"; + }; + }; + + # lsp actions + lsp = { + hover = mkOption { + type = types.str; + description = "Keybind to open LSP hover menu on a value."; + default = "K"; + }; + action = mkOption { + type = types.str; + description = "Keybind to perform an LSP action on a value."; + default = "<leader>la"; + }; + references = mkOption { + type = types.str; + description = "Keybind to view all references of a value."; + default = "<leader>lr"; + }; + rename = mkOption { + type = types.str; + description = "Keybind to rename currrent and all references of a value."; + default = "<leader>ln"; + }; + }; + + # completion + cmp = { + prev = mkOption { + type = types.str; + description = "Keybind to select previous value in completion engine."; + default = "<C-p>"; + }; + next = mkOption { + type = types.str; + description = "Keybind to select next value in completion engine."; + default = "<C-n>"; + }; + confirm = mkOption { + type = types.str; + description = "Keybind to confirm current value in completion engine."; + default = "<CR>"; + }; + complete = mkOption { + type = types.str; + description = "Keybind to auto complete using completion engine."; + default = "<C-space>"; + }; + }; + }; + + # active lsp servers + lsps = mkOption { + type = with types; listOf str; + description = "List of lsp servers to load"; + default = ["clangd" "zls" "rust_analyzer" "jdtls" "kotlin_language_server"]; + }; + + }; + }; + + config = { + environment.variables.EDITOR = "nvim"; + + home-manager.users.${config.user} = { + programs.neovim = { + + enable = true; + viAlias = true; + vimAlias = true; + extraLuaConfig = '' + + --[[ VIM ]]-- + + vim.opt.tabstop = ${toString config.neovim.tabWidth} + vim.opt.softtabstop = ${toString config.neovim.tabWidth} + vim.opt.shiftwidth = ${toString config.neovim.tabWidth} + vim.opt.expandtab = ${boolToString config.neovim.expandTab} + vim.opt.mouse = "a" + vim.opt.clipboard = "unnamedplus" + vim.opt.hlsearch = true + vim.opt.autoindent = true + vim.opt.ttyfast = true + vim.opt.number = true + vim.opt.relativenumber = true + vim.opt.rnu = true + vim.opt.swapfile = false + vim.opt.fillchars = { eob = " "} + + + --[[ BUF ]]-- + + -- remove trailing whitespace on save + vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[%s/\s\+$//e]], + }) + + --[[ KEYBINDS ]]-- + + -- leader + + vim.g.mapleader = "${config.neovim.keys.leader}" + vim.g.maplocalleader = "${config.neovim.keys.leader}" + vim.keymap.set("", '<leader>', '<Nop>', { noremap = true, silent = true }) + + -- bind helper function + + local function bind(key, action, opts) + opts = opts or {} + vim.keymap.set('n', key, action, opts) + end + + -- lsp + + bind("${config.neovim.keys.noh}", vim.cmd.noh) + + vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = {buffer = event.buf} + bind("${config.neovim.keys.lsp.hover}", function() vim.lsp.buf.hover() end, opts) + bind("${config.neovim.keys.lsp.action}", function() vim.lsp.buf.code_action() end, opts) + bind("${config.neovim.keys.lsp.references}", function() vim.lsp.buf.references() end, opts) + bind("${config.neovim.keys.lsp.rename}", function() vim.lsp.buf.rename() end, opts) + end + }) + + ''; + + plugins = with pkgs.vimPlugins; [ + # Dependencies + vim-devicons + nvim-web-devicons + plenary-nvim + # Colorscheme + { + plugin = base16-nvim; + type = "lua"; + config = '' + vim.opt.termguicolors = true + vim.g.base16_transparent_background = 1 + + local colorscheme = require('base16-colorscheme') + colorscheme.setup({ + base00 = '#${config.theme.colors.bg}', + base01 = '#${config.theme.colors.surface.bg}', + base02 = '#${config.theme.colors.surface.bg}', + base03 = '#${config.theme.colors.bright.white}', + base04 = '#${config.theme.colors.bright.black}', + base05 = '#${config.theme.colors.fg}', + base06 = '#${config.theme.colors.bright.white}', + base07 = '#${config.theme.colors.hover.bg}', + base08 = '#${config.theme.colors.bright.red}', + base09 = '#${config.theme.colors.bright.yellow}', + base0A = '#${config.theme.colors.bright.yellow}', + base0B = '#${config.theme.colors.bright.green}', + base0C = '#${config.theme.colors.bright.cyan}', + base0D = '#${config.theme.colors.bright.blue}', + base0E = '#${config.theme.colors.bright.magenta}', + base0F = '#${config.theme.colors.normal.yellow}', + }) + + -- make transparent background + local colors = { + -- Text + "Normal", "NormalNC", "NormalFloat", + -- Line Numbers + "LineNr", "EndOfBuffer", "SignColumn", + -- Floating + "FloatBorder", + -- Mode/Buffer Lines + "TabLine", "TabLineFill", "StatusLine", + }; + for _,color in pairs(colors) do + vim.api.nvim_set_hl(0, color, { bg = "none" }); + end + -- identifiers should not be colored + vim.api.nvim_set_hl(0, "Identifier", { fg = "#${config.theme.colors.fg}" }) + vim.api.nvim_set_hl(0, "TSVariable", { fg = "#${config.theme.colors.fg}" }) + -- macro should be colored as a keyword + vim.api.nvim_set_hl(0, "TSFuncMacro", { fg = "#${config.theme.colors.bright.magenta}" }) + ''; + } + # Mode line + { + plugin = lualine-nvim; + type = "lua"; + config = '' + local lualine_theme = require('lualine.themes.base16') + lualine_theme.normal.c = { fg = "#${config.theme.colors.fg}" } + + require('lualine').setup { + options = { + theme = lualine_theme, + icons_enabled = true, + globalstatus = true, + }, + }; + ''; + } + # Buffer line + { + plugin = bufferline-nvim; + type = "lua"; + config = '' + require('bufferline').setup {} + ''; + } + # File browser + { + plugin = nvim-tree-lua; + type = "lua"; + config = '' + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + require('nvim-tree').setup { + sort = { + sorter = "case_sensitive", + }, + view = { + centralize_selection = true, + signcolumn = "yes", + float = { + enable = true, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 80, + height = 30, + row = 1, + col = 1, + }, + }; + }, + renderer = { + group_empty = true, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + expand_all = { + max_folder_discovery = 300, + exclude = {}, + }, + file_popup = { + open_win_config = { + col = 1, + row = 1, + relative = "cursor", + border = "shadow", + style = "minimal", + }, + }, + open_file = { + quit_on_open = true, + window_picker = { + enable = false, + picker = "default", + chars = "abcdefghijklmnopqrstuvwxyz1234567890", + exclude = { + filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + } + }, + remove_file = { + close_window = true, + }, + }, + filters = { + dotfiles = false, + }, + tab = { + sync = { + open = false, + close = false, + ignore = {}, + }, + }, + git = { + enable = false, + }, + update_cwd = true, + respect_buf_cwd = true, + update_focused_file = { + enable = true, + update_cwd = true + }, + }; + + bind("${config.neovim.keys.menus.browser}", vim.cmd.NvimTreeToggle) + ''; + } + # Undo tree + { + plugin = undotree; + type = "lua"; + config = '' + bind("${config.neovim.keys.menus.undo}", vim.cmd.UndotreeToggle) + ''; + } + # Trouble (error menu) + { + plugin = trouble-nvim; + type = "lua"; + config = '' + bind("${config.neovim.keys.menus.error}", function() require('trouble').toggle() end) + ''; + } + # Telescope (buffers/find/grep/help) + { + plugin = telescope-nvim; + type = "lua"; + config = '' + local telescope = require('telescope.builtin') + bind("${config.neovim.keys.menus.buffers}", telescope.buffers) + bind("${config.neovim.keys.menus.find}", telescope.find_files) + bind("${config.neovim.keys.menus.grep}", telescope.live_grep) + bind("${config.neovim.keys.menus.help}", telescope.help_tags) + vim.api.nvim_set_hl(0, 'TelescopeNormal', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopeBorder', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopeResultsTitle', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePromptTitle', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePreviewTitle', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePromptNormal', { bg = "none" }) + vim.api.nvim_set_hl(0, 'TelescopePromptBorder', { bg = "none" }) + ''; + } + # Snippets + vim-vsnip + vim-vsnip-integ + friendly-snippets + # Completion + cmp-buffer + cmp-nvim-lsp + cmp-vsnip + { + plugin = nvim-cmp; + type = "lua"; + config = '' + local cmp = require('cmp'); + local cmp_select = {behavior = cmp.SelectBehavior.select} + local cmp_mappings = cmp.mapping.preset.insert({ + ["${config.neovim.keys.cmp.prev}"] = cmp.mapping.select_prev_item(cmp_select), + ["${config.neovim.keys.cmp.next}"] = cmp.mapping.select_next_item(cmp_select), + ["${config.neovim.keys.cmp.confirm}"] = cmp.mapping.confirm({ select = true }), + ["${config.neovim.keys.cmp.complete}"] = cmp.mapping.complete(), + }) + + cmp_mappings['<Tab>'] = nil + cmp_mappings['<S-Tab>'] = nil + + cmp.setup { + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + sources = cmp.config.sources { + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'buffer' }, + }, + mapping = cmp_mappings, + } + ''; + } + # Sourround delimiters + { + plugin = nvim-surround; + type = "lua"; + config = '' + require('nvim-surround').setup {} + ''; + } + # Comment functions + nerdcommenter + # Treesitter + nvim-treesitter.withAllGrammars + # Syntax hilighting + { + plugin = vim-illuminate; + type = "lua"; + config = '' + require('illuminate').configure { + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + } + ''; + } + # Todo comments + { + plugin = todo-comments-nvim; + type = "lua"; + config = '' + require('todo-comments').setup() + ''; + } + # Lsp server + { + plugin = nvim-lspconfig; + type = "lua"; + config = let + lspConfigs = map (server: '' + lspconfig["${server}"].setup({ + capabilities = capabilities + }) + '') config.neovim.lsps; + in '' + local lspconfig = require('lspconfig') + local capabilities = require'cmp_nvim_lsp'.default_capabilities() + ${lib.concatStrings lspConfigs} + ''; + } + # Notifications + { + plugin = fidget-nvim; + type = "lua"; + config = '' + require("fidget").setup { + notification = { + window = { + winblend = 0, + }, + }, + } + ''; + } + # Auto indentation + { + plugin = indent-o-matic; + type = "lua"; + config = '' + require('indent-o-matic').setup { + max_lines = 2048, + standard_widths = { 2, 4, 8 }, + skip_multiline = true, + }; + ''; + } + # 80 column width + { + plugin = virt-column-nvim; + type = "lua"; + config = '' + require('virt-column').setup { + enabled = true, + virtcolumn = "80" + } + ''; + } + ]; + + }; + }; + }; +} diff --git a/programs/sops/default.nix b/programs/sops/default.nix new file mode 100644 index 0000000..5df5f22 --- /dev/null +++ b/programs/sops/default.nix @@ -0,0 +1,30 @@ +{ config, pkgs, inputs, ... }: + +let + + isEd25519 = k: k.type == "ed25519"; + getKeyPath = k: k.path; + keys = builtins.filter isEd25519 config.services.openssh.hostKeys; + +in +{ + imports = [ + inputs.sops-nix.nixosModules.sops + ]; + + environment.systemPackages = with pkgs; [ + sops + ]; + + sops = { + defaultSopsFile = ../../secrets.yaml; + + gnupg.home = config.homePath + "/.gnupg"; + gnupg.sshKeyPaths = []; + + secrets = { + freyanetWg = {}; + tinternetWg = {}; + }; + }; +} diff --git a/programs/ssh/config b/programs/ssh/config new file mode 100644 index 0000000..5ae97b6 --- /dev/null +++ b/programs/ssh/config @@ -0,0 +1,12 @@ +Match Host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye" + +Host *.in.freya.cat cid.freya.cat alivemc.net + User root + +Host *.cs.rit.edu + User tam2214 + +Host * + HostkeyAlgorithms +ssh-rsa + PubkeyAcceptedKeyTypes +ssh-rsa + KexAlgorithms -sntrup761x25519-sha512@openssh.com diff --git a/programs/ssh/default.nix b/programs/ssh/default.nix new file mode 100644 index 0000000..e1691b3 --- /dev/null +++ b/programs/ssh/default.nix @@ -0,0 +1,10 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + programs.ssh = { + enable = true; + extraConfig = lib.fileContents ./config; + }; + }; +} diff --git a/programs/starship/default.nix b/programs/starship/default.nix new file mode 100644 index 0000000..99858d4 --- /dev/null +++ b/programs/starship/default.nix @@ -0,0 +1,49 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + programs.starship = { + + enable = true; + + settings = { + format = lib.concatStrings [ + "╭─ " + "$username" + "$hostname" + "$git_branch" + "$directory" + "$line_break" + "╰─ " + ]; + + username = { + style_user = "bold cyan"; + style_root = "bold red"; + format = "[$user]($style) "; + disabled = false; + show_always = true; + }; + + hostname = { + ssh_only = false; + format = "on [$hostname](bold blue) "; + disabled = false; + }; + + directory = { + format = "[$path]($style)[$read_only]($read_only_style) "; + truncation_length = -1; + truncate_to_repo = false; + truncation_symbol = "…/"; + }; + + git_branch = { + style = "bold purple"; + format = "at [$symbol$branch(:$remote_branch)]($style) "; + }; + }; + + }; + }; +} diff --git a/programs/steam/default.nix b/programs/steam/default.nix new file mode 100644 index 0000000..35610ae --- /dev/null +++ b/programs/steam/default.nix @@ -0,0 +1,26 @@ +{ lib, ... }: + +{ + 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/programs/talc/default.nix b/programs/talc/default.nix new file mode 100644 index 0000000..9c59d3f --- /dev/null +++ b/programs/talc/default.nix @@ -0,0 +1,12 @@ +{ config, pkgs, inputs, ... }: + +let + system = pkgs.stdenv.hostPlatform.system; + talc = inputs.talc.packages.${system}; +in { + home-manager.users.${config.user} = { + home.packages = [ + talc.talc + ]; + }; +} diff --git a/programs/unofficial-homestuck-collection/default.nix b/programs/unofficial-homestuck-collection/default.nix new file mode 100644 index 0000000..19b792b --- /dev/null +++ b/programs/unofficial-homestuck-collection/default.nix @@ -0,0 +1,12 @@ +{ config, pkgs, inputs, ... }: + +let + system = pkgs.stdenv.hostPlatform.system; + unofficial-homestuck-collection = inputs.unofficial-homestuck-collection.packages.${system}; +in { + home-manager.users.${config.user} = { + home.packages = [ + unofficial-homestuck-collection.unofficial-homestuck-collection + ]; + }; +} diff --git a/programs/waybar/default.nix b/programs/waybar/default.nix new file mode 100644 index 0000000..6e835fb --- /dev/null +++ b/programs/waybar/default.nix @@ -0,0 +1,80 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + programs.waybar = { + + enable = true; + + 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/programs/waybar/style.nix b/programs/waybar/style.nix new file mode 100644 index 0000000..0b84514 --- /dev/null +++ b/programs/waybar/style.nix @@ -0,0 +1,115 @@ +{ 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/programs/wireguard/default.nix b/programs/wireguard/default.nix new file mode 100644 index 0000000..ff9c954 --- /dev/null +++ b/programs/wireguard/default.nix @@ -0,0 +1,35 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + wireguard-tools + ]; + + networking.wg-quick.interfaces = { + freyanet = { + address = [ "10.2.0.2/32" "fd:cafe:dead:bee::2/128" "fe80::2/128" ]; + dns = [ "10.3.0.138" ]; + privateKeyFile = config.sops.secrets.freyanetWg.path; + + peers = [{ + publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk="; + allowedIPs = [ "10.0.0.0/14" "fd:cafe::/32" ]; + endpoint = "cid.freya.cat:3000"; + persistentKeepalive = 25; + }]; + }; + + #tinternet = { + # address = [ "69.0.0.2/32" "cafe::2/128" "fe80::2/128" ]; + # dns = [ "1.1.1.1" ]; + # privateKeyFile = config.sops.secrets.tinternetWg.path; + + # peers = [{ + # publicKey = "8Ice49Yc7N75OYJW59ohDbfUjgrkwIuGWKWocJQGgzI="; + # allowedIPs = [ "0.0.0.0/0" "::/0" ]; + # endpoint = "freya.cat:51282"; + # persistentKeepalive = 25; + # }]; + #}; + }; +} diff --git a/programs/wofi/default.nix b/programs/wofi/default.nix new file mode 100644 index 0000000..cb08b43 --- /dev/null +++ b/programs/wofi/default.nix @@ -0,0 +1,24 @@ +{ config, lib, ... }: + +{ + 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/programs/wofi/style.nix b/programs/wofi/style.nix new file mode 100644 index 0000000..40fb861 --- /dev/null +++ b/programs/wofi/style.nix @@ -0,0 +1,81 @@ +{ 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/programs/zsh/default.nix b/programs/zsh/default.nix new file mode 100644 index 0000000..e0dce57 --- /dev/null +++ b/programs/zsh/default.nix @@ -0,0 +1,19 @@ +{ config, ... }: + +{ + programs.zsh = { + enable = true; + enableCompletion = true; + enableGlobalCompInit = false; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + histSize = 10000; + }; + + home-manager.users.${config.user} = { + home.file = { + ".zshrc".source = ./zshrc; + ".zprofile".source = ./zprofile; + }; + }; +} diff --git a/programs/zsh/zprofile b/programs/zsh/zprofile new file mode 100644 index 0000000..4815b36 --- /dev/null +++ b/programs/zsh/zprofile @@ -0,0 +1,11 @@ +# dont attempt to launch a graphical +# env in tmux +if [ -n "$TMUX" ]; then + return +fi + +# only launch hyprland on tty 1 +if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then + export XDG_CURRENT_DESKTOP=Hyprland + exec dbus-run-session Hyprland +fi diff --git a/programs/zsh/zshrc b/programs/zsh/zshrc new file mode 100644 index 0000000..b1c61a2 --- /dev/null +++ b/programs/zsh/zshrc @@ -0,0 +1,73 @@ +# zsh initalization file + +# export 'SHELL' to child processes +export SHELL + +if [[ $- != *i* ]] +then + # We are being invoked from a non-interactive shell. If this + # is an SSH session (as in "ssh host command"), source + # /etc/profile so we get PATH and other essential variables. + [[ -n "$SSH_CLIENT" ]] && source /etc/profile + + # Don't do anything else. + return +fi + +# update PATH +PATH=$PATH:$HOME/.local/bin +PATH=$PATH:$HOME/.cargo/bin + +# vim mode >:) +# no ryan i am not copying you +set -o vi +set show-mode-in-prompt on + +# Set shell prompt using starship +if command -v "starship" > /dev/null; then + eval "$(starship init zsh)" +else + export PS1="$$USER: " +fi + +# aliases +alias rf="rm -fr" # remove le french hon hon hon +alias ls="ls --color=auto" +alias ip="ip --color=auto" +alias grep="grep --color=auto" +alias diff="diff --color=auto" +alias vim="nvim" +alias ssh='TERM=xterm-256color ssh' # xterm-kitty bad + +# nix rebuild +alias rs="sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)" +alias rh="home-manager switch --flake ~/.config/nix#$(hostname)" + +# manpages +export LESS_TERMCAP_md=$'\e[1;36m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[1;92m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[1;35m' +export GROFF_NO_SGR=1 + +# compinit +autoload compinit && compinit + +# keybinds +bindkey "\e[1;5D" backward-word +bindkey "\e[1;5C" forward-word +bindkey "\e[3;5~" kill-word +bindkey "\C-_" backward-kill-word +bindkey "\e[3~" delete-char +bindkey "\e[H" beginning-of-line +bindkey "\e[F" end-of-line +bindkey "\e\d" undo + +# gpg +export GPG_TTY=$(tty) +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + +# ricing +pfetch |