From f559671cae7b02526dedf7923b135c09e0d095d5 Mon Sep 17 00:00:00 2001 From: Miran Bastaja Date: Fri, 3 Nov 2023 15:59:16 +0100 Subject: Inital commit ;P --- share/home/default.nix | 64 +++++++++++++++++++ share/home/eww/config/eww.scss | 13 ++++ share/home/eww/config/eww.yuck | 54 ++++++++++++++++ share/home/eww/default.nix | 7 +++ share/home/firefox/default.nix | 62 +++++++++++++++++++ .../home/firefox/usercss/compact-about-config.css | 24 ++++++++ share/home/firefox/usercss/context-menu.css | 12 ++++ share/home/firefox/usercss/tab-separator-lines.css | 23 +++++++ .../firefox/usercss/unified-extensions-view.css | 46 ++++++++++++++ share/home/git.nix | 12 ++++ share/home/helix.nix | 42 +++++++++++++ share/home/hyprland.nix | 65 +++++++++++++++++++ share/home/kitty.nix | 26 ++++++++ share/home/wezterm/config.lua | 62 +++++++++++++++++++ share/home/wezterm/default.nix | 10 +++ share/home/wpaperd.nix | 15 +++++ share/home/zsh.nix | 72 ++++++++++++++++++++++ 17 files changed, 609 insertions(+) create mode 100644 share/home/default.nix create mode 100644 share/home/eww/config/eww.scss create mode 100644 share/home/eww/config/eww.yuck create mode 100644 share/home/eww/default.nix create mode 100644 share/home/firefox/default.nix create mode 100644 share/home/firefox/usercss/compact-about-config.css create mode 100644 share/home/firefox/usercss/context-menu.css create mode 100644 share/home/firefox/usercss/tab-separator-lines.css create mode 100644 share/home/firefox/usercss/unified-extensions-view.css create mode 100644 share/home/git.nix create mode 100644 share/home/helix.nix create mode 100644 share/home/hyprland.nix create mode 100644 share/home/kitty.nix create mode 100644 share/home/wezterm/config.lua create mode 100644 share/home/wezterm/default.nix create mode 100644 share/home/wpaperd.nix create mode 100644 share/home/zsh.nix (limited to 'share/home') diff --git a/share/home/default.nix b/share/home/default.nix new file mode 100644 index 0000000..f1ecf45 --- /dev/null +++ b/share/home/default.nix @@ -0,0 +1,64 @@ +# Minimal home configuration containing everything that I want on all of +# my machines +{ pkgs, config, ... }: { + imports = [ ./helix.nix ./zsh.nix ]; + + home.packages = with pkgs; [ + xclip + wget + hunspell + hunspellDicts.en_US + hunspellDicts.hr_HR + ripgrep + git + age + gnupg + xh + fd + sd + bc # CLI calculator + ffmpeg + amfora # Gemini CLI browser + trashy # Trash CLI + + # Useful nix tooling + nix-tree + ]; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + xdg = { + enable = true; + systemDirs.data = + let + gds = pkgs.gsettings-desktop-schemas; + gtk3 = pkgs.gtk3; + in + [ + "${gds}/share/gsettings-schemas/${gds.name}" + "${gtk3}/share/gsettings-schemas/${gtk3.name}" + ]; + userDirs = { + enable = true; + createDirectories = true; + }; + }; + + # Lots of these are courtesy of xdg-ninja + # https://github.com/b3nj5m1n/xdg-ninja + home.sessionVariables = with config.xdg; { + CARGO_HOME = "${dataHome}/cargo"; + GOPATH = "${dataHome}/go"; + WINEPREFIX = "${dataHome}/wine"; + XCOMPOSECACHE = "${cacheHome}/X11/xcompose"; + GTK2_RC_FILES = "${configHome}/gtk-2.0/gtkrc"; + NODE_REPL_HISTORY = "${dataHome}/node_repl_history"; + NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc"; + # shell + HISTFILE = "${stateHome}/shell/history"; + ZDOTDIR = "${configHome}/zsh"; + }; +} diff --git a/share/home/eww/config/eww.scss b/share/home/eww/config/eww.scss new file mode 100644 index 0000000..8172b28 --- /dev/null +++ b/share/home/eww/config/eww.scss @@ -0,0 +1,13 @@ +* { + all: unset; // Unsets everything so you can style everything from scratch +} + +.bar { + background-color: #3a3a3a; + color: #fff; +} + +.workspaces { + font-size: 1.5em; +} + diff --git a/share/home/eww/config/eww.yuck b/share/home/eww/config/eww.yuck new file mode 100644 index 0000000..0f27d9f --- /dev/null +++ b/share/home/eww/config/eww.yuck @@ -0,0 +1,54 @@ +(defwidget bar [] + (centerbox :orientation "v" + (workspaces) + "test" + (battery))) + +(defwidget workspace-btn [n ?icon] + (button :onclick "hyprctl dispatch 'workspace ${n}'" + :halign "baseline" + :hexpand true + "${icon ?: n}")) + +(defwidget workspaces [] + (box :class "workspaces" + :orientation "v" + :space-evenly true + :valign "start" + :halign "center" + (workspace-btn :n 1 :icon "") + (workspace-btn :n 2 :icon "") + (workspace-btn :n 3 :icon "󰈹") + (workspace-btn :n 4 :icon "󰭹") + (workspace-btn :n 5 :icon "") + (workspace-btn :n 6 :icon "") + (workspace-btn :n 7 :icon "") + (workspace-btn :n 8 :icon "") + (workspace-btn :n 9 :icon ""))) + +(defwidget battery [] + (metric :label "󰁹" + :value {EWW_BATTERY} + :onchange "")) + +(defwidget metric [label value onchange] + (box :orientation "v" + :class "metric" + :space-evenly false + (box :class "label" label) + (scale :min 0 + :max 101 + :active {onchange != ""} + :value value + :onchange onchange))) + +(defwindow bar + :monitor 0 + :geometry (geometry :width "1.25%" + :height "98%" + :anchor "right center") + :stacking "fg" + :windowtype "dock" + :exclusive true + (bar)) + diff --git a/share/home/eww/default.nix b/share/home/eww/default.nix new file mode 100644 index 0000000..63fe356 --- /dev/null +++ b/share/home/eww/default.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: { + programs.eww = { + enable = true; + configDir = ./config; + package = pkgs.eww-wayland; # If you're using x11, delete this + }; +} diff --git a/share/home/firefox/default.nix b/share/home/firefox/default.nix new file mode 100644 index 0000000..f1ee260 --- /dev/null +++ b/share/home/firefox/default.nix @@ -0,0 +1,62 @@ +{ pkgs, ... }: +let + # Concatenate all files in the `./usercss` directory into one string + css-files = + map (n: ./usercss/${n}) (builtins.attrNames (builtins.readDir ./usercss)); + userChrome = builtins.concatStringsSep "\n" (map builtins.readFile css-files); +in +{ + programs.firefox = { + enable = true; + profiles = { + alice = { + name = "alice"; + isDefault = true; + inherit userChrome; + + search = { + default = "DuckDuckGo"; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + }]; + + icon = + "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + + "Bing".metaData.hidden = true; + # builtin engines only support specifying one additional alias + "Google".medaData.alias = "@g"; + }; + }; # end of search + + settings = { + "browser.compactmode.show" = true; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + }; + }; # end of alice (profile) + }; # end of profiles + }; +} diff --git a/share/home/firefox/usercss/compact-about-config.css b/share/home/firefox/usercss/compact-about-config.css new file mode 100644 index 0000000..55e30f7 --- /dev/null +++ b/share/home/firefox/usercss/compact-about-config.css @@ -0,0 +1,24 @@ +/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/content/compact_about_config.css made available under Mozilla Public License v. 2.0 +See the above repository for updates as well as full license text. */ + +/* Makes about:config list more compact */ + +@-moz-document url("about:config"){ + .button-delete, + .button-edit, + .button-reset, + .button-save, + .button-toggle{ + margin-block: 1px !important; + padding-block: 11px 0 !important; + padding-inline: 0 !important; + min-height: 22px !important; + width: 22px !important; + outline-offset: 0 !important; + } + .cell-edit{ width: 28px !important; } + form > input, + tr:not(.add) > th, + tr:not(.add) > .cell-value{ padding-block: 0 !important; } + tr:not(:hover) .semi-transparent:not(.primary,.button-add){ background-color: transparent !important; } +} diff --git a/share/home/firefox/usercss/context-menu.css b/share/home/firefox/usercss/context-menu.css new file mode 100644 index 0000000..0bf5749 --- /dev/null +++ b/share/home/firefox/usercss/context-menu.css @@ -0,0 +1,12 @@ +/*** Remove items from image context menu ***/ +#context-sendimage, /* Email image */ +#context-inspect-a11y, +#context-savelinktopocket, +#context-pocket, +#context-savepage, +#context-print-selection, /* Print selected text */ +#context-selectall, +#context-sep-selectall /* Seperator bar */ +{ + display: none !important; +} diff --git a/share/home/firefox/usercss/tab-separator-lines.css b/share/home/firefox/usercss/tab-separator-lines.css new file mode 100644 index 0000000..2f77db4 --- /dev/null +++ b/share/home/firefox/usercss/tab-separator-lines.css @@ -0,0 +1,23 @@ +/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/tab_separator_lines.css made available under Mozilla Public License v. 2.0 +See the above repository for updates as well as full license text. */ + +/* Bring back tab separator lines that were removed in Proton */ + +.tabbrowser-tab{ + border-inline-start: 1px solid transparent !important; + border-image: 0 1 linear-gradient( + transparent 20%, + color-mix(in srgb, currentColor 20%, transparent) 20%, + color-mix(in srgb, currentColor 20%, transparent) 80%, + transparent 80% + ) !important; +} + +.tabbrowser-tab:hover, +#tabbrowser-tabs:not([movingtab]) .tabbrowser-tab:hover + .tabbrowser-tab:not([first-visible-unpinned-tab]), +.tabbrowser-tab:first-child, +.tabbrowser-tab[selected], +.tabbrowser-tab[multiselected], +#tabbrowser-arrowscrollbox[overflowing] > .tabbrowser-tab[first-visible-unpinned-tab], +#tabbrowser-tabs:not([movingtab]) .tabbrowser-tab[multiselected] + .tabbrowser-tab, +#tabbrowser-tabs:not([movingtab]) .tabbrowser-tab[selected] + .tabbrowser-tab { border-image: none !important; } \ No newline at end of file diff --git a/share/home/firefox/usercss/unified-extensions-view.css b/share/home/firefox/usercss/unified-extensions-view.css new file mode 100644 index 0000000..876a7d0 --- /dev/null +++ b/share/home/firefox/usercss/unified-extensions-view.css @@ -0,0 +1,46 @@ +/*** Clean and tight extensions menu ***/ +#unified-extensions-view { + --uei-icon-size: 20px; +} + +#unified-extensions-view .panel-header, +#unified-extensions-view .panel-header + toolbarseparator, +#unified-extensions-view .panel-subview-body + toolbarseparator, +#unified-extensions-view #unified-extensions-manage-extensions { + display:none !important; +} + +#unified-extensions-view .unified-extensions-item-menu-button.subviewbutton { + visibility: hidden !important; + transition: 300ms !important; + -moz-margin-end: -3.6em !important; +} + +#unified-extensions-view .panel-subview-body { + padding-top: 8px !important; + padding-bottom: 8px !important; +} + +#unified-extensions-view:hover +.unified-extensions-item-menu-button.subviewbutton { + visibility: visible !important; + transition: 300ms !important; + -moz-margin-end: initial !important; +} + +#unified-extensions-view .unified-extensions-item .unified-extensions-item-icon, +#unified-extensions-view .unified-extensions-item .toolbarbutton-badge-stack { + margin-inline-end: 2px !important; +} + +#unified-extensions-view .unified-extensions-item-name, +#unified-extensions-view .unified-extensions-item-message { + padding-inline-start: 0.5em !important; + width: 21em !important; +} + +#unified-extensions-view .unified-extensions-item-action-button.subviewbutton { + padding-top: 2px !important; + padding-bottom: 2px !important; +} + diff --git a/share/home/git.nix b/share/home/git.nix new file mode 100644 index 0000000..98cafa2 --- /dev/null +++ b/share/home/git.nix @@ -0,0 +1,12 @@ +{ ... }: { + programs.git = { + enable = true; + userEmail = "miran.bastaja04@gmail.com"; + userName = "Miran Bastaja"; + signing = { + key = "002426427AE095E093D51B3EF42E936D529F5760"; + signByDefault = true; + }; + delta.enable = true; + }; +} diff --git a/share/home/helix.nix b/share/home/helix.nix new file mode 100644 index 0000000..c7b7cad --- /dev/null +++ b/share/home/helix.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: { + programs.helix = { + enable = true; + defaultEditor = true; + + extraPackages = with pkgs; [ + rust-analyzer + rustfmt + nil + nixfmt + python311Packages.python-lsp-server + clang-tools + black + ]; + + settings = { + theme = "tokyonight"; + editor = { + line-number = "relative"; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + whitespace.render = { + space = "all"; + tab = "all"; + newline = "none"; + }; + whitespace.characters = { + space = "·"; + nbsp = "⍽"; + tab = "→"; + newline = "⏎"; + tabpad = "·"; # Tabs will look like "→···" (depending on tab width) + }; + cursorline = true; + lsp.display-messages = true; + }; + }; + }; +} diff --git a/share/home/hyprland.nix b/share/home/hyprland.nix new file mode 100644 index 0000000..63d5d77 --- /dev/null +++ b/share/home/hyprland.nix @@ -0,0 +1,65 @@ +# IMPORTANT: this module requires the system to already have `programs.hyprland` +# enabled. You can enable it by importing `share/system/hyprland.nix` +{ pkgs, ... }: { + imports = [ ./kitty.nix ./wpaperd.nix ./eww ]; + + wayland.windowManager.hyprland = { + enable = true; + extraConfig = '' + $mod = SUPER + + bind = $mod SHIFT, Return, exec, kitty + + general { + layout = master + } + + master { + mfact = 0.5 + new_is_master = false + } + + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + ${builtins.concatStringsSep "\n" (builtins.genList (x: + let ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10)); + in '' + bind = $mod, ${ws}, workspace, ${toString (x + 1)} + bind = $mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)} + '') 10)} + + bind = $mod SHIFT, C, killactive + bind = $mod SHIFT, F, togglefloating + bind = $mod SHIFT, Q, exit + bind = $mod, P, exec, rofi -show run + + bind = $mod, H, cyclenext, prev + bind = $mod, L, cyclenext + bind = $mod SHIFT, H, swapnext, prev + bind = $mod SHIFT, L, swapnext + + # audio control + binde =, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ --limit 1.0 5%+ + binde =, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ --limit 1.0 5%- + bind =, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + + # monitor brightness control + binde =, XF86MonBrightnessUp, exec, brightnessctl set +5% + binde =, XF86MonBrightnessDown, exec, brightnessctl set 5%- + + input { + # focus change on cursor move + follow_mouse = 1 + accel_profile = flat + } + monitor=,preferred,auto,1 + + # set opacity to 0.9 active and 0.5 inactive for kitty + windowrule = opacity 0.9 override 0.5 override,^(kitty)$ + ''; + }; + + home.packages = with pkgs; [ brightnessctl wireplumber ]; + services.dunst.enable = true; + programs.rofi.enable = true; +} diff --git a/share/home/kitty.nix b/share/home/kitty.nix new file mode 100644 index 0000000..3cdc18b --- /dev/null +++ b/share/home/kitty.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: { + programs.kitty = { + enable = true; + theme = "Mayukai"; + + font = { + package = pkgs.nerdfonts.override { fonts = [ "AnonymousPro" ]; }; + name = "AnonymousPro"; + size = 10; + }; + + settings = { cursor_shape = "beam"; }; + + keybindings = { + "ctrl+tab" = "new_tab"; + + "alt+1" = "goto_tab 1"; + "alt+2" = "goto_tab 2"; + "alt+3" = "goto_tab 3"; + "alt+4" = "goto_tab 4"; + "alt+5" = "goto_tab 5"; + }; + }; + + home.shellAliases = { s = "kitty +kitten ssh"; }; +} diff --git a/share/home/wezterm/config.lua b/share/home/wezterm/config.lua new file mode 100644 index 0000000..872a1aa --- /dev/null +++ b/share/home/wezterm/config.lua @@ -0,0 +1,62 @@ +local wezterm = require 'wezterm' +local act = wezterm.action +local config = {} + +if wezterm.config_builder then + config = wezterm.config_builder() +end + +config.color_scheme = 'Catppuccin Mocha' +config.window_background_opacity = 0.9 + +config.default_cursor_style = "SteadyBar" +config.font = wezterm.font('Blex Mono Nerd Font') +config.font_size = 9.5 + +config.keys = { + -- Tab management + { key = '1', mods = 'ALT', action = act.ActivateTab(0) }, + { key = '2', mods = 'ALT', action = act.ActivateTab(1) }, + { key = '3', mods = 'ALT', action = act.ActivateTab(2) }, + { key = '4', mods = 'ALT', action = act.ActivateTab(3) }, + { key = '5', mods = 'ALT', action = act.ActivateTab(4) }, + { key = '6', mods = 'ALT', action = act.ActivateTab(5) }, + { key = '7', mods = 'ALT', action = act.ActivateTab(6) }, + { key = '8', mods = 'ALT', action = act.ActivateTab(7) }, + { key = 't', mods = 'CTRL|SHIFT', action = act.SpawnTab 'CurrentPaneDomain' }, + { key = 'w', mods = 'CTRL|SHIFT', action = act.CloseCurrentTab{ confirm = true}}, + { key = '{', mods = 'CTRL|SHIFT', action = act.MoveTabRelative(-1) }, + { key = '}', mods = 'CTRL|SHIFT', action = act.MoveTabRelative(1) }, + + -- Split management + { + key = 'h', + mods = 'CTRL', + action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, + }, + { + key = 'v', + mods = 'CTRL', + action = act.SplitVertical { domain = 'CurrentPaneDomain' }, + }, + { + key = 'q', + mods = 'CTRL', + action = act.CloseCurrentPane { confirm = true }, + }, + -- Split movement + -- activate pane selection mode with the default alphabet (labels are "a", "s", "d", "f" and so on) + -- (j)ump to split + { key = 'j', mods = 'CTRL', action = act.PaneSelect }, + -- show the pane selection mode, but have it swap the active and selected panes + -- (m)ove split + { + key = 'm', + mods = 'CTRL', + action = act.PaneSelect { + mode = 'SwapWithActive', + }, + }, +} + +return config diff --git a/share/home/wezterm/default.nix b/share/home/wezterm/default.nix new file mode 100644 index 0000000..b06022b --- /dev/null +++ b/share/home/wezterm/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + programs.wezterm = { + enable = true; + extraConfig = builtins.readFile ./config.lua; + }; + + fonts.fontconfig.enable = true; + home.packages = with pkgs; + [ (nerdfonts.override { fonts = [ "IBMPlexMono" ]; }) ]; +} diff --git a/share/home/wpaperd.nix b/share/home/wpaperd.nix new file mode 100644 index 0000000..d348c27 --- /dev/null +++ b/share/home/wpaperd.nix @@ -0,0 +1,15 @@ +# IMPORTANT: this is the config for a custom module that's located at +# /share/hm-modules/wpaperd.nix. In order to use this config you have to also +# import that module. +{ config, ... }: +let wallpapers-dir = "${config.xdg.userDirs.pictures}/Wallpapers"; +in { + services.wpaperd = { + enable = true; + settings.default = { + path = wallpapers-dir; + duration = "5m"; + sorting = "random"; + }; + }; +} diff --git a/share/home/zsh.nix b/share/home/zsh.nix new file mode 100644 index 0000000..ef79acb --- /dev/null +++ b/share/home/zsh.nix @@ -0,0 +1,72 @@ +{ pkgs, ... }: { + programs.zsh = { + enable = true; + enableAutosuggestions = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + enableVteIntegration = true; + autocd = true; + dotDir = ".config/zsh"; + + shellAliases = { + battery-status = '' + upower -i $(upower -e | grep BAT) | grep -E "state|to full|percentage" + ''; + ip = ''ip --color=auto''; + ltg = "ls --git --tree"; + ltgi = "ltg --git-ignore"; + sl = "sl -awFc5"; + }; + }; + home.packages = with pkgs; [ sl ]; + + programs.eza = { + enable = true; + enableAliases = true; + icons = true; + extraOptions = [ "--header" "--group-directories-first" "--long" ]; + }; + + programs.starship = { + enable = true; + enableZshIntegration = true; + + # settings = let + # lightblue-bg = "bg:#769ff0"; + # lightblue-fg = "fg:#e3e5e5"; + # lightblue = "${lightblue-fg} ${lightblue-bg}"; + # in { + # format = lib.concatStrings [ + # "[░▒▓](#a3aed2)" + # "[$username @ $hostname](${lightblue})" + # "$directory" + # "$rust" + # "$package" + # "\n" + # "> " + # ]; + # + # hostname = { + # ssh_only = false; + # format = "[$hostname]($style)"; + # trim_at = ""; # disable trimming + # style = lightblue; + # }; + # + # username = { + # show_always = true; + # format = "[$user]($style)"; + # style_user = lightblue; + # style_root = "${lightblue-bg} fg:red bold"; + # }; + # + # directory = { + # format = "[ $path ]($style)"; + # truncation_length = 3; + # truncation_symbol = "…/"; + # }; + # }; # end of settings + }; # end of programs.starship + + programs.wezterm.enableZshIntegration = true; +} -- cgit v1.3.1