diff options
Diffstat (limited to 'nix')
39 files changed, 2515 insertions, 0 deletions
diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..d9c06e0 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,320 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + # monitor options + + monitorOpts = self: { + options = { + + name = mkOption { + type = types.str; + description = "Name of the monitor."; + }; + + scale = mkOption { + type = types.float; + description = "Scaling factor of the monitor."; + default = 1.0; + }; + + }; + }; + + # base16 theme color options + # https://github.com/chriskempson/base16/blob/main/styling.md + + base16Opts = self: { + options = { + + name = mkOption { + type = types.str; + description = "Name of the theme"; + }; + + author = mkOption { + type = types.str; + description = "Author of the theme"; + }; + + base00 = mkOption { + type = types.str; + description = "Default Background."; + }; + + base01 = mkOption { + type = types.str; + description = "Lighter Background (Used for status bars, line number and folding marks)."; + }; + + base02 = mkOption { + type = types.str; + description = "Selection Background."; + }; + + base03 = mkOption { + type = types.str; + description = "Comments, Invisibles, Line Highlighting."; + }; + + base04 = mkOption { + type = types.str; + description = "Dark Foreground (Used for status bars)."; + }; + + base05 = mkOption { + type = types.str; + description = "Default Foreground, Caret, Delimiters, Operators."; + }; + + base06 = mkOption { + type = types.str; + description = "Light Foreground (Not often used)."; + }; + + base07 = mkOption { + type = types.str; + description = "Light Background (Not often used)."; + }; + + base08 = mkOption { + type = types.str; + description = "Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted."; + }; + + base09 = mkOption { + type = types.str; + description = "Integers, Boolean, Constants, XML Attributes, Markup Link Url."; + }; + + base0A = mkOption { + type = types.str; + description = "Classes, Markup Bold, Search Text Background."; + }; + + base0B = mkOption { + type = types.str; + description = "Strings, Inherited Class, Markup Code, Diff Inserted."; + }; + + base0C = mkOption { + type = types.str; + description = "Support, Regular Expressions, Escape Characters, Markup Quotes."; + }; + + base0D = mkOption { + type = types.str; + description = "Functions, Methods, Attribute IDs, Headings."; + }; + + base0E = mkOption { + type = types.str; + description = "Keywords, Storage, Selector, Markup Italic, Diff Changed."; + }; + + base0F = mkOption { + type = types.str; + description = "Deprecated, Opening/Closing Embedded Language Tags."; + }; + + accent = mkOption { + type = types.str; + description = "Accent color."; + default = config.theme.colors.base0D; + }; + + }; + }; + +in + +{ + + imports = [ + ./programs + ./home + ./system + ]; + + options = { + + # + # Primary user of the system + # + user = mkOption { + type = types.str; + description = "Primary user of the system"; + }; + fullName = mkOption { + type = types.str; + description = "Human readable name of the user"; + }; + email = mkOption { + type = types.str; + description = "Primary email of the user"; + }; + homePath = mkOption { + type = types.str; + description = "Home directory path of the user"; + default = "/home/${config.user}"; + }; + dotfilesPath = mkOption { + type = types.str; + description = "Dotfiles path inside the users home dir"; + default = "${config.homePath}/.config/nix"; + }; + + # + # Monitors of the system + # + monitors = mkOption { + default = []; + description = "Monitors of the system."; + type = with types; listOf (submodule monitorOpts); + }; + + # + # Theme of the system + # + theme = { + colors = mkOption { + type = with types; (submodule base16Opts); + description = "Base16 color scheme"; + default = (import ./themes).catppuccin.mocha; + }; + + opacity = mkOption { + type = types.float; + description = "Window opacity."; + default = 1.0; + }; + + # theme fonts + font = { + size = mkOption { + type = types.int; + description = "Theme primary font size."; + default = 14; + }; + + regular = mkOption { + type = types.str; + description = "Regular system font."; + default = "JetBrains Mono"; + }; + + monospace = mkOption { + type = types.str; + description = "Monospace system font."; + default = "monospace"; + }; + + header = mkOption { + type = types.str; + description = "Header system font."; + default = "JetBrains Mono ExtraBold"; + }; + + icon = mkOption { + type = types.str; + description = "Icon system font."; + default = "Font Awesome 6 Pro"; + }; + + }; + + borderWidth = mkOption { + type = types.int; + description = "Theme border width"; + default = 3; + }; + + outerRadius = mkOption { + type = types.int; + description = "Theme outer border radius."; + default = 5; + }; + + innerRadius = mkOption { + type = types.int; + description = "Theme inner border radius."; + default = 2; + }; + + outerGap = mkOption { + type = types.int; + description = "Theme outer gap/spacing."; + default = 10; + }; + + innerGap = mkOption { + type = types.int; + description = "Theme inner gap/spacing."; + default = 3; + }; + + wallpaper = mkOption { + type = types.str; + description = "Path to wallpaper image"; + default = ""; + }; + + avatar = mkOption { + type = types.str; + description = "Path to avatar image"; + default = ""; + }; + }; + + # + # Default programs + # + default = { + browser = mkOption { + type = types.str; + description = "Default browser launch command."; + }; + appLauncher = mkOption { + type = types.str; + description = "Default application launcher launch command."; + }; + lockScreen = mkOption { + type = types.str; + description = "Default lock screen launch command."; + }; + terminal = mkOption { + type = types.str; + description = "Default terminal launch command."; + }; + }; + + # + # Programs to auto start on launch + # + autoRun = mkOption { + type = with types; listOf str; + description = "List of programs to auto run in a graphical environment."; + default = []; + }; + + }; + + config = { + # use system packages in home manager + home-manager.useGlobalPkgs = true; + + # install user packages to /etc/profiles and not home directory + home-manager.useUserPackages = true; + + # allow unfree packages + nixpkgs.config.allowUnfree = true; + + # set state version + home-manager.users.${config.user}.home.stateVersion = "25.05"; + home-manager.users.root.home.stateVersion = "25.05"; + system.stateVersion = "25.05"; + }; + +} diff --git a/nix/home/default.nix b/nix/home/default.nix new file mode 100644 index 0000000..fd7d25a --- /dev/null +++ b/nix/home/default.nix @@ -0,0 +1,73 @@ +{ config, pkgs, ... }: + +{ + home-manager.users.${config.user} = { + + home.username = config.user; + home.homeDirectory = config.homePath; + + news.display = "silent"; + fonts.fontconfig.enable = true; + nixpkgs.config.allowUnfree = true; + + home.packages = with pkgs; [ + # c / c++ + gcc + nasm + pkg-config + # rust + rustc + rustfmt + rust-analyzer + cargo + clippy + # programs + adwaita-icon-theme + blueman + cage + easyeffects + discord + element-desktop + fd + gamescope + gajim + gimp + home-manager + imagemagick + libnotify + mpv + pavucontrol + pfetch-rs + rsync + starship + steam + thunderbird + unityhub + vrc-get + wine + wl-clipboard + wl-clip-persist + wl-mirror + yt-dlp + zathura + # gtk + orchis-theme + ]; + + xdg.dataFile = { + fonts = { + source = ../../files/fonts; + recursive = true; + }; + }; + + gtk = { + enable = true; + gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; + }; + + programs.home-manager.enable = true; + + }; +} + diff --git a/nix/programs/default.nix b/nix/programs/default.nix new file mode 100644 index 0000000..c4a6f61 --- /dev/null +++ b/nix/programs/default.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + imports = [ + ./firefox + ./git + ./gpg + ./hypr + ./kitty + ./mako + ./neovim + ./ssh + ./starship + ./waybar + ./wireguard + ./wofi + ./zsh + ]; +} diff --git a/nix/programs/firefox/default.nix b/nix/programs/firefox/default.nix new file mode 100644 index 0000000..7442b1a --- /dev/null +++ b/nix/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 = "DuckDuckGo"; + }; + + userChrome = userChrome; + }; + + }; + }; +} diff --git a/nix/programs/firefox/extraPrefs.nix b/nix/programs/firefox/extraPrefs.nix new file mode 100644 index 0000000..b9e9ed2 --- /dev/null +++ b/nix/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/nix/programs/firefox/policy.nix b/nix/programs/firefox/policy.nix new file mode 100644 index 0000000..0d090cc --- /dev/null +++ b/nix/programs/firefox/policy.nix @@ -0,0 +1,142 @@ +{ + + # 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; + Install = [ + "freya_ca.crt" + "tinternet.crt" + ]; + }; + + # 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 = { + Cache = false; + Cookies = false; + Downloads = false; + Histroy = false; + Sessions = false; + SiteSettings = false; + OfflineApps = false; + Locked = true; + }; + + # 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/nix/programs/firefox/policyExtensions.nix b/nix/programs/firefox/policyExtensions.nix new file mode 100644 index 0000000..ebc3003 --- /dev/null +++ b/nix/programs/firefox/policyExtensions.nix @@ -0,0 +1,58 @@ +{ + + # 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"; + }; + +} diff --git a/nix/programs/firefox/policyPrefs.nix b/nix/programs/firefox/policyPrefs.nix new file mode 100644 index 0000000..a8ac797 --- /dev/null +++ b/nix/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/nix/programs/firefox/userChrome.nix b/nix/programs/firefox/userChrome.nix new file mode 100644 index 0000000..2deefb5 --- /dev/null +++ b/nix/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/nix/programs/git/default.nix b/nix/programs/git/default.nix new file mode 100644 index 0000000..30d140b --- /dev/null +++ b/nix/programs/git/default.nix @@ -0,0 +1,20 @@ +{ config, ... }: + +{ + home-manager.users.${config.user} = { + programs.git = { + enable = true; + userName = config.fullName; + userEmail = config.email; + + signing = { + key = "D9AF0A4209B7C2DE11A884BFACBC553660D9993D"; + signByDefault = true; + }; + + extraConfig = { + init.defaultBranch = "main"; + }; + }; + }; +} diff --git a/nix/programs/gpg/default.nix b/nix/programs/gpg/default.nix new file mode 100644 index 0000000..9a6e24d --- /dev/null +++ b/nix/programs/gpg/default.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +{ + home-manager.users.${config.user} = { + programs.gpg = { + enable = true; + publicKeys = [ + { + source = ../../../files/keys/freya-gpg.pub; + trust = 5; + } + ]; + }; + + services.gpg-agent = { + enable = true; + enableExtraSocket = true; + enableSshSupport = true; + #updateStartupTty = true; + + pinentryPackage = pkgs.pinentry-gtk2; + }; + }; +} diff --git a/nix/programs/hypr/default.nix b/nix/programs/hypr/default.nix new file mode 100644 index 0000000..08b2d93 --- /dev/null +++ b/nix/programs/hypr/default.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + ./hypridle.nix + ./hyprland.nix + ./hyprlock.nix + ./hyprpaper.nix + ]; +} diff --git a/nix/programs/hypr/hypridle.nix b/nix/programs/hypr/hypridle.nix new file mode 100644 index 0000000..85718e2 --- /dev/null +++ b/nix/programs/hypr/hypridle.nix @@ -0,0 +1,47 @@ +{ 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"; + } + # dim keyboard backlight + { + timeout = 150; + on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0"; + on-resume = "brightnessctl -rd rgb:kbd_backlight"; + } + # 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/nix/programs/hypr/hyprland.nix b/nix/programs/hypr/hyprland.nix new file mode 100644 index 0000000..948b880 --- /dev/null +++ b/nix/programs/hypr/hyprland.nix @@ -0,0 +1,301 @@ +{ 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}; + +in + +{ + #xdg.portal = { + # enable = true; + # extraPortals = [ hyprland.xdg-desktop-portal-hyprland ]; + #}; + + nix.settings = { + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + }; + + home-manager.users.${config.user} = { + wayland.windowManager.hyprland = { + + enable = true; + package = hyprland.hyprland; + + # Plugins + plugins = [ + hyprland-plugins.hyprexpo + hy3.hy3 + ]; + + # Config + settings = { + # 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" = "rgb(${config.theme.colors.accent})"; + "col.inactive_border" = "rgb(${config.theme.colors.base04})"; + }; + + # 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" + ]; + }; + + # Environment + env = [ + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_DESKTOP,Hyprland" + + "XCURSOR_THEME,Adwaita" + "XCURSOR_SIZE,24" + + "GTK_THEME,Orchis-Teal-Dark" + + "MOZ_ENABLE_WAYLAND,1" + "MOZ_USE_XINPUT,1" + "_JAVA_AWT_WM_NONREPARENTING,1" + ]; + + # 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}" + + # 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; + + "col.active" = "rgb(${config.theme.colors.base00})"; + "col.inactive" = "rgb(${config.theme.colors.base00})"; + "col.text.active" = "rgb(${config.theme.colors.base05})"; + "col.text.inactive" = "rgb(${config.theme.colors.base05})"; + "col.border.active" = "rgb(${config.theme.colors.accent})"; + "col.border.inactive" = "rgb(${config.theme.colors.base04})"; + }; + + 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/nix/programs/hypr/hyprlock.nix b/nix/programs/hypr/hyprlock.nix new file mode 100644 index 0000000..9324f57 --- /dev/null +++ b/nix/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.base05})"; + font_family = config.theme.font.regular; + fade_on_empty = false; + placeholder_text = "<i><span foreground=\"##${config.theme.colors.base05}\">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.base05})"; + font_family = config.theme.font.header; + position = "0, 500"; + halign = "center"; + valign = "center"; + } + + # Name + { + monitor = ""; + text = config.fullName; + font_color = "rgb(${config.theme.colors.base05})"; + 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/nix/programs/hypr/hyprpaper.nix b/nix/programs/hypr/hyprpaper.nix new file mode 100644 index 0000000..ddcb6cd --- /dev/null +++ b/nix/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/nix/programs/kitty/default.nix b/nix/programs/kitty/default.nix new file mode 100644 index 0000000..34534fb --- /dev/null +++ b/nix/programs/kitty/default.nix @@ -0,0 +1,86 @@ +{ 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.base00}"; + foreground = "#${config.theme.colors.base05}"; + selection_background = "#${config.theme.colors.base05}"; + selection_foreground = "#${config.theme.colors.base00}"; + url_color = "#${config.theme.colors.base04}"; + cursor = "#${config.theme.colors.base05}"; + active_border_color = "#${config.theme.colors.base03}"; + inactive_border_color = "#${config.theme.colors.base01}"; + active_tab_background = "#${config.theme.colors.base00}"; + active_tab_foreground = "#${config.theme.colors.base05}"; + inactive_tab_background = "#${config.theme.colors.base01}"; + inactive_tab_foreground = "#${config.theme.colors.base04}"; + tab_bar_background = "#${config.theme.colors.base01}"; + + # normal + color0 = "#${config.theme.colors.base00}"; + color1 = "#${config.theme.colors.base08}"; + color2 = "#${config.theme.colors.base0B}"; + color3 = "#${config.theme.colors.base0A}"; + color4 = "#${config.theme.colors.base0D}"; + color5 = "#${config.theme.colors.base0E}"; + color6 = "#${config.theme.colors.base0C}"; + color7 = "#${config.theme.colors.base05}"; + + # bright + color8 = "#${config.theme.colors.base03}"; + color9 = "#${config.theme.colors.base08}"; + color10 = "#${config.theme.colors.base0B}"; + color11 = "#${config.theme.colors.base0A}"; + color12 = "#${config.theme.colors.base0D}"; + color13 = "#${config.theme.colors.base0E}"; + color14 = "#${config.theme.colors.base0C}"; + color15 = "#${config.theme.colors.base07}"; + + # extended base16 colors + color16 = "#${config.theme.colors.base09}"; + color17 = "#${config.theme.colors.base0F}"; + color18 = "#${config.theme.colors.base01}"; + color19 = "#${config.theme.colors.base02}"; + color20 = "#${config.theme.colors.base04}"; + color21 = "#${config.theme.colors.base06}"; + }; + }; + }; +} diff --git a/nix/programs/mako/default.nix b/nix/programs/mako/default.nix new file mode 100644 index 0000000..2c88bfc --- /dev/null +++ b/nix/programs/mako/default.nix @@ -0,0 +1,28 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + services.mako = { + + enable = true; + + font = "${config.theme.font.monospace} 11"; + + margin = toString config.theme.outerGap; + padding = toString config.theme.innerGap; + + backgroundColor = "#${config.theme.colors.base00}"; + progressColor = "#${config.theme.colors.base00}"; + textColor = "#${config.theme.colors.base05}"; + + borderColor = "#${config.theme.colors.base05}"; + borderSize = config.theme.borderWidth; + borderRadius = config.theme.outerRadius; + + defaultTimeout = 5000; + layer = "overlay"; + icons = true; + + }; + }; +} diff --git a/nix/programs/neovim/default.nix b/nix/programs/neovim/default.nix new file mode 100644 index 0000000..ffb4388 --- /dev/null +++ b/nix/programs/neovim/default.nix @@ -0,0 +1,84 @@ +{ config, lib, pkgs, ... }: + +let + + colorschemeLua = '' + -- [[ COLORSCHEME ]] -- + + local colorscheme = require('base16-colorscheme') + colorscheme.setup({ + base00 = '#${config.theme.colors.base00}', + base01 = '#${config.theme.colors.base01}', + base02 = '#${config.theme.colors.base02}', + base03 = '#${config.theme.colors.base03}', + base04 = '#${config.theme.colors.base04}', + base05 = '#${config.theme.colors.base05}', + base06 = '#${config.theme.colors.base06}', + base07 = '#${config.theme.colors.base07}', + base08 = '#${config.theme.colors.base08}', + base09 = '#${config.theme.colors.base09}', + base0A = '#${config.theme.colors.base0A}', + base0B = '#${config.theme.colors.base0B}', + base0C = '#${config.theme.colors.base0C}', + base0D = '#${config.theme.colors.base0D}', + base0E = '#${config.theme.colors.base0E}', + base0F = '#${config.theme.colors.base0F}', + }) + +''; + + initLua = lib.fileContents ./init.lua; + luaConfig = colorschemeLua + initLua; + +in +{ + environment.variables.EDITOR = "nvim"; + + home-manager.users.${config.user} = { + programs.neovim = { + + enable = true; + viAlias = true; + vimAlias = true; + extraLuaConfig = luaConfig; + + plugins = with pkgs.vimPlugins; [ + # Deoendencies + vim-devicons + nvim-web-devicons + # Lua functions + plenary-nvim + # Lines + lualine-nvim # mode line + bufferline-nvim # buffer line + # Menus + nvim-tree-lua # file browser + undotree # undo menu + trouble-nvim # error menu + telescope-nvim # grep/find menus + # Snippets + vim-vsnip + vim-vsnip-integ + friendly-snippets + # Completion + nvim-cmp + cmp-buffer + cmp-nvim-lsp + cmp-vsnip + nvim-surround # delimiter + # Lsp + base16-nvim # colorscheme + nerdcommenter # comment functions + nvim-treesitter.withAllGrammars # hilighting + vim-illuminate # hilighting + todo-comments-nvim # todo comments + nvim-lspconfig # lsp server + fidget-nvim # notifications + indent-o-matic # auto indentation + hologram-nvim # images + virt-column-nvim # 80 col line + ]; + + }; + }; +} diff --git a/nix/programs/neovim/init.lua b/nix/programs/neovim/init.lua new file mode 100644 index 0000000..50d50c8 --- /dev/null +++ b/nix/programs/neovim/init.lua @@ -0,0 +1,246 @@ +--[[ CONFIG ]]-- + +-- global config for iris configuration +config = { + -- colorscheme for nvim + flavour = "mocha", + -- indentation + tab_width = 4, + expand_tab = false, + -- keybinds to be set to actions + keybinds = { + -- leader key + leader = ' ', + -- toggle menus + menus = { + -- file browser + browser = '<leader>e', + -- active buffers + buffers = '<leader>fb', + -- error list + error = '<leader>t', + -- find files + find = '<leader>ff', + -- grep files + grep = '<leader>fg', + -- help browser + help = '<leader>fh', + -- undo tree + undo = '<leader>u', + }, + -- lsp actions + lsp = { + hover = 'K', + action = '<leader>la', + references = '<leader>lr', + rename = '<leader>ln', + }, + -- completion + cmp = { + -- prev item + prev = '<C-p>', + -- next item + next = '<C-n>', + -- confirm + confirm = '<CR>', + -- complete + complete = '<C-Space>', + }, + -- disable active selection + noh = '<leader>h', + }, + -- lsp servers + lsps = { + -- rust + rust_analyzer = {}, + -- c / c++ + clangd = {}, + -- java + jdtls = {}, + }, +}; + +--[[ VIM ]]-- + +vim.opt.tabstop = config.tab_width +vim.opt.softtabstop = config.tab_width +vim.opt.shiftwidth = config.tab_width +vim.opt.expandtab = config.expand_tab +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.termguicolors = true + +-- remove trailing whitespace on save +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[%s/\s\+$//e]], +}) + +--[[ THEME ]]-- + +vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) +vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +vim.api.nvim_set_hl(0, "NvimTreeNormal", { bg = "none" }) +vim.api.nvim_set_hl(0, "Comment", { fg = colorscheme.colors.base04 }) +vim.api.nvim_set_hl(0, "@comment", { link = "Comment" }) + +--[[ LINES ]]-- + +-- mode line +require('lualine').setup { + options = { + theme = config.colorscheme, + icons_enabled = true, + globalstatus = true, + }, +} + +-- buffer line +require("bufferline").setup {} + +--[[ MENUS ]]-- + +-- file browser +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.opt.termguicolors = true + +require("nvim-tree").setup { + sort = { + sorter = "case_sensitive", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + actions = { + open_file = { + quit_on_open = true, + }, + }, + filters = { + dotfiles = false, + }, +} + +--[[ COMPLETION ]]-- + +-- completion engine +--local cmp = require('cmp') +-- +--local cmp_select = {behavior = cmp.SelectBehavior.Select} +--local cmp_mappings = cmp.mapping.preset.insert({ +-- [config.keybinds.cmp.prev] = cmp.mapping.select_prev_item(cmp_select), +-- [config.keybinds.cmp.next] = cmp.mapping.select_next_item(cmp_select), +-- [config.keybinds.cmp.confirm] = cmp.mapping.confirm({ select = true }), +-- [config.keybinds.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, +--} +-- +-- delimiter completion +require'nvim-surround'.setup {} + +--[[ LSP ]]-- + +local capabilities = require'cmp_nvim_lsp'.default_capabilities() +for lsp,config in pairs(config.lsps) do + config.capabilities = capabilities + require'lspconfig'[lsp].setup(config) +end + +-- illuminate +require'illuminate'.configure { + providers = { + 'lsp', + 'treesitter', + 'regex', + }, +} + +-- todo comments +require('todo-comments').setup() + +-- auto indentation +require('indent-o-matic').setup { + max_lines = 2048, + standard_widths = { 2, 4, 8 }, + skip_multiline = true, +} + +-- image viewer +--require'hologram'.setup { +-- auto_display = true +--} + +-- 80 col bar +require'virt-column'.setup { + enabled = true, + virtcolumn = "80" +} + +-- notifications +require("fidget").setup { + notification = { + window = { + winblend = 0, + }, + }, +} + +--[[ KEYBINDS ]]-- + +vim.g.mapleader = config.keybinds.leader +vim.g.maplocalleader = config.keybinds.leader +vim.keymap.set('', '<leader>', '<Nop>', { noremap = true, silent = true }) + +local function bind(key, action, opts) + opts = opts or {} + vim.keymap.set('n', key, action, opts) +end + +bind(config.keybinds.noh, vim.cmd.noh) +bind(config.keybinds.menus.browser, vim.cmd.NvimTreeToggle) +bind(config.keybinds.menus.undo, vim.cmd.UndotreeToggle) +bind(config.keybinds.menus.error, function() require'trouble'.toggle() end) + +local telescope = require'telescope.builtin' +bind(config.keybinds.menus.buffers, telescope.buffers) +bind(config.keybinds.menus.find, telescope.find_files) +bind(config.keybinds.menus.grep, telescope.live_grep) +bind(config.keybinds.menus.help, telescope.help_tags) + +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = {buffer = event.buf} + bind(config.keybinds.lsp.hover, function() vim.lsp.buf.hover() end, opts) + bind(config.keybinds.lsp.action, function() vim.lsp.buf.code_action() end, opts) + bind(config.keybinds.lsp.references, function() vim.lsp.buf.references() end, opts) + bind(config.keybinds.lsp.rename, function() vim.lsp.buf.rename() end, opts) + end +}) diff --git a/nix/programs/ssh/config b/nix/programs/ssh/config new file mode 100644 index 0000000..4953469 --- /dev/null +++ b/nix/programs/ssh/config @@ -0,0 +1,12 @@ +Match Host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye" + +Host *.in.freya.cat + User root + +Host *.cs.rit.edu + User tam2214 + +Host * + HostkeyAlgorithms +ssh-rsa + PubkeyAcceptedKeyTypes +ssh-rsa + KexAlgorithms -sntrup761x25519-sha512@openssh.com diff --git a/nix/programs/ssh/default.nix b/nix/programs/ssh/default.nix new file mode 100644 index 0000000..e1691b3 --- /dev/null +++ b/nix/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/nix/programs/starship/default.nix b/nix/programs/starship/default.nix new file mode 100644 index 0000000..99858d4 --- /dev/null +++ b/nix/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/nix/programs/waybar/default.nix b/nix/programs/waybar/default.nix new file mode 100644 index 0000000..fa78920 --- /dev/null +++ b/nix/programs/waybar/default.nix @@ -0,0 +1,81 @@ +{ config, lib, ... }: + +{ + home-manager.users.${config.user} = { + programs.waybar = { + + enable = true; + + settings = [{ + height = 24; + layer = "top"; + position = "top"; + spacing = 4; + + modules-left = [ + "hyprland/workspaces" + "hyprland/window" + ]; + modules-center = [ + ]; + modules-right = [ + "battery" + "wireplumber" + "network" + "clock" + "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/nix/programs/waybar/style.nix b/nix/programs/waybar/style.nix new file mode 100644 index 0000000..919ce1c --- /dev/null +++ b/nix/programs/waybar/style.nix @@ -0,0 +1,134 @@ +{ theme }: + +let + + accentColor = "#${theme.colors.accent}"; + textColor = "#${theme.colors.base05}"; + baseColor = "#${theme.colors.base00}"; + surfaceColor = "#${theme.colors.base02}"; + greenColor = "#${theme.colors.base0B}"; + yellowColor = "#${theme.colors.base0A}"; + redColor = "#${theme.colors.base08}"; + 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 */ + +window#waybar { + font-family: "${theme.font.regular}", "${theme.font.regular}", "${theme.font.monospace}"; + font-size: ${fontSize}; + color: ${textColor}; + background-color: transparent; +} + +window#waybar > box { + margin: ${outerGap}; + margin-bottom: 0px; +} + +.modules-left, +.modules-right { + padding: ${innerGap} 0px; + border-radius: ${outerRadius}; + background-color: ${baseColor}; + border: ${borderWidth} solid ${accentColor}; +} + +/** Workspaces */ + +#workspaces { + margin-left: ${innerGap}; +} + +#workspaces button { + all: initial; + color: ${textColor}; + background-color: transparent; + border-radius: ${innerRadius}; + padding: ${innerGap} ${outerGap}; +} + +#workspaces button.focused, +#workspaces button.active { + background-color: ${accentColor}; + color: ${baseColor}; +} + +#workspaces button.urgent { + background-color: ${redColor}; +} + +/** Window */ + +window#waybar:not(.empty) #window { + padding: 0 ${outerGap}; + border-left: ${borderWidth} solid ${surfaceColor}; + margin: 0 ${innerGap}; +} + +/** 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, +#clock { + padding: 0 ${outerGap}; + border-right: ${borderWidth} solid ${surfaceColor}; + color: ${textColor}; +} + +/** Battery */ + +#battery.charging { + color: ${greenColor}; +} + +#battery.warning:not(.charging) { + color: ${yellowColor}; +} + +#battery.critical:not(.charging) { + color: ${redColor}; +} + +/** Wireplumber */ + +#wireplumber.muted { + color: ${redColor}; +} + +/** Network */ + +#network.wifi, +#network.ethernet { + color: ${greenColor}; +} + +#network.disconnected { + color: ${redColor}; +} + +'' + diff --git a/nix/programs/wireguard/default.nix b/nix/programs/wireguard/default.nix new file mode 100644 index 0000000..18c77e9 --- /dev/null +++ b/nix/programs/wireguard/default.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + wireguard-tools + ]; + + networking.wireguard.enable = true; + networking.wireguard.interfaces = { + freyanet = { + ips = [ "10.2.0.2/32" "fd:cafe:dead:bee::2/128" "fe80::2/128" ]; + privateKeyFile = "${config.dotfilesPath}/secrets/freyanet.key"; + + peers = [{ + publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk="; + allowedIPs = [ "10.0.0.0/12" "fd:cafe::/32" "fe80::/64" ]; + endpoint = "freya.cat:41111"; + persistentKeepalive = 25; + }]; + }; + }; +} diff --git a/nix/programs/wofi/default.nix b/nix/programs/wofi/default.nix new file mode 100644 index 0000000..cb08b43 --- /dev/null +++ b/nix/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/nix/programs/wofi/style.nix b/nix/programs/wofi/style.nix new file mode 100644 index 0000000..b73ae28 --- /dev/null +++ b/nix/programs/wofi/style.nix @@ -0,0 +1,80 @@ +{ theme }: + +let + + accentColor = "#${theme.colors.accent}"; + textColor = "#${theme.colors.base05}"; + baseColor = "#${theme.colors.base00}"; + surfaceColor = "#${theme.colors.base02}"; + 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 ${accentColor}; + border-radius: ${outerRadius}; + background-color: ${baseColor}; +} + +/* Outer Box */ +#outer-box { + padding: ${outerGap}; +} + +/* Scroll */ +#scroll { + margin: 0px; + padding: ${innerGap}; + border: none; +} + +/* Input */ +#input { + margin: ${innerGap}; + padding: ${innerGap}; + border: none; + color: ${textColor}; + background-color: ${surfaceColor}; + border-radius: ${outerRadius}; +} + +#input:focus, +#input:active { + border: ${borderWidth} solid ${accentColor}; + box-shadow: none; + outline: none; +} + +/* Text */ +#text { + margin: ${innerGap}; + padding: ${innerGap}; + border: none; + color: ${textColor}; +} + +/* Selected Entry */ +#entry:selected { + background-color: ${accentColor}; + border-radius: ${outerRadius}; +} + +#entry:selected #text { + color: ${baseColor}; +} + +'' + diff --git a/nix/programs/zsh/default.nix b/nix/programs/zsh/default.nix new file mode 100644 index 0000000..e0dce57 --- /dev/null +++ b/nix/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/nix/programs/zsh/zprofile b/nix/programs/zsh/zprofile new file mode 100644 index 0000000..4815b36 --- /dev/null +++ b/nix/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/nix/programs/zsh/zshrc b/nix/programs/zsh/zshrc new file mode 100644 index 0000000..eedac23 --- /dev/null +++ b/nix/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="sudo 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 diff --git a/nix/system/default.nix b/nix/system/default.nix new file mode 100644 index 0000000..26a8494 --- /dev/null +++ b/nix/system/default.nix @@ -0,0 +1,104 @@ +{ config, pkgs, ... }: + +{ + # allow flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # common system packages + environment.systemPackages = with pkgs; [ + # editor + vim + # lib + libz + openssl + # shell + bash + zsh + # utility + acpi + curl + htop + openssh + p7zip + ripgrep + sbctl + tree + unzip + wget + ]; + + # use the latest kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + + # timezone + time.timeZone = "America/New_York"; + + # locale + i18n.defaultLocale = "en_US.UTF-8"; + + # services + networking.networkmanager.enable = true; + services.fwupd.enable = true; + services.libinput.enable = true; + services.pcscd.enable = true; + services.printing.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + jack.enable = true; + }; + + # create user account + users.users.${config.user} = { + isNormalUser = true; + description = config.fullName; + extraGroups = [ "networkmanager" "wheel" "sys" "video" "audio" ]; + home = config.homePath; + shell = pkgs.zsh; + }; + + # certs + security.pki.certificateFiles = [ + ../../files/certs/freyanet.crt + ]; + + # fonts + fonts.packages = with pkgs; [ + 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 + ]; + + 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/nix/themes/catppuccin/default.nix b/nix/themes/catppuccin/default.nix new file mode 100644 index 0000000..5d587ef --- /dev/null +++ b/nix/themes/catppuccin/default.nix @@ -0,0 +1,6 @@ +{ + frappe = import ./frappe.nix; + latte = import ./latte.nix; + macchiato = import ./macchiato.nix; + mocha = import ./mocha.nix; +} diff --git a/nix/themes/catppuccin/frappe.nix b/nix/themes/catppuccin/frappe.nix new file mode 100644 index 0000000..77bae89 --- /dev/null +++ b/nix/themes/catppuccin/frappe.nix @@ -0,0 +1,21 @@ +{ + name = "Catppuccin Frappe"; + author = "https://github.com/catppuccin/catppuccin"; + + base00 = "303446"; # base + base01 = "292c3c"; # mantle + base02 = "414559"; # surface0 + base03 = "51576d"; # surface1 + base04 = "626880"; # surface2 + base05 = "c6d0f5"; # text + base06 = "f2d5cf"; # rosewater + base07 = "babbf1"; # lavender + base08 = "e78284"; # red + base09 = "ef9f76"; # peach + base0A = "e5c890"; # yellow + base0B = "a6d189"; # green + base0C = "81c8be"; # teal + base0D = "8caaee"; # blue + base0E = "ca9ee6"; # mauve + base0F = "eebebe"; # flamingo +} diff --git a/nix/themes/catppuccin/latte.nix b/nix/themes/catppuccin/latte.nix new file mode 100644 index 0000000..476e123 --- /dev/null +++ b/nix/themes/catppuccin/latte.nix @@ -0,0 +1,21 @@ +{ + name = "Catppuccin Latte"; + author = "https://github.com/catppuccin/catppuccin"; + + base00 = "eff1f5"; # base + base01 = "e6e9ef"; # mantle + base02 = "ccd0da"; # surface0 + base03 = "bcc0cc"; # surface1 + base04 = "acb0be"; # surface2 + base05 = "4c4f69"; # text + base06 = "dc8a78"; # rosewater + base07 = "7287fd"; # lavender + base08 = "d20f39"; # red + base09 = "fe640b"; # peach + base0A = "df8e1d"; # yellow + base0B = "40a02b"; # green + base0C = "179299"; # teal + base0D = "1e66f5"; # blue + base0E = "8839ef"; # mauve + base0F = "dd7878"; # flamingo +} diff --git a/nix/themes/catppuccin/macchiato.nix b/nix/themes/catppuccin/macchiato.nix new file mode 100644 index 0000000..1f401be --- /dev/null +++ b/nix/themes/catppuccin/macchiato.nix @@ -0,0 +1,21 @@ +{ + name = "Catppuccin Macchiato"; + author = "https://github.com/catppuccin/catppuccin"; + + base00 = "24273a"; # base + base01 = "1e2030"; # mantle + base02 = "363a4f"; # surface0 + base03 = "494d64"; # surface1 + base04 = "5b6078"; # surface2 + base05 = "cad3f5"; # text + base06 = "f4dbd6"; # rosewater + base07 = "b7bdf8"; # lavender + base08 = "ed8796"; # red + base09 = "f5a97f"; # peach + base0A = "eed49f"; # yellow + base0B = "a6da95"; # green + base0C = "8bd5ca"; # teal + base0D = "8aadf4"; # blue + base0E = "c6a0f6"; # mauve + base0F = "f0c6c6"; # flamingo +} diff --git a/nix/themes/catppuccin/mocha.nix b/nix/themes/catppuccin/mocha.nix new file mode 100644 index 0000000..aee42b6 --- /dev/null +++ b/nix/themes/catppuccin/mocha.nix @@ -0,0 +1,21 @@ +{ + name = "Catppuccin Mocha"; + author = "https://github.com/catppuccin/catppuccin"; + + base00 = "1e1e2e"; # base + base01 = "181825"; # mantle + base02 = "313244"; # surface0 + base03 = "45475a"; # surface1 + base04 = "585b70"; # surface2 + base05 = "cdd6f4"; # text + base06 = "f5e0dc"; # rosewater + base07 = "b4befe"; # lavender + base08 = "f38ba8"; # red + base09 = "fab387"; # peach + base0A = "f9e2af"; # yellow + base0B = "a6e3a1"; # green + base0C = "94e2d5"; # teal + base0D = "89b4fa"; # blue + base0E = "cba6f7"; # mauve + base0F = "f2cdcd"; # flamingo +} diff --git a/nix/themes/default.nix b/nix/themes/default.nix new file mode 100644 index 0000000..b4e191b --- /dev/null +++ b/nix/themes/default.nix @@ -0,0 +1,4 @@ +{ + catppuccin = import ./catppuccin; + tricolor = import ./tricolor.nix; +} diff --git a/nix/themes/tricolor.nix b/nix/themes/tricolor.nix new file mode 100644 index 0000000..f1d74b8 --- /dev/null +++ b/nix/themes/tricolor.nix @@ -0,0 +1,22 @@ +{ + name = "Tricolor"; + author = "https://trimill.xyz"; + + base00 = "14171d"; + base01 = "1f242d"; + base02 = "343c4b"; + base03 = "4d4754"; + base04 = "4d4754"; + base05 = "c7c6c3"; + base06 = "ada0a8"; + base07 = "ada0a8"; + base08 = "a63a3a"; + base09 = "f0c767"; + base0A = "7b5687"; + base0B = "3d67a2"; + base0C = "578c7c"; + base0D = "789ebf"; + base0E = "a97fb3"; + base0F = "c7c6c3"; + +} |