From 52da0ad1dcafb9ee5c7c4481147fe185638cd116 Mon Sep 17 00:00:00 2001 From: ooks-io Date: Mon, 4 Dec 2023 16:03:49 +1300 Subject: [PATCH] rework: base/shell --- home/ooks/base/default.nix | 3 + home/ooks/base/shell/bat.nix | 6 -- home/ooks/base/shell/{ => cli}/bash.nix | 0 home/ooks/base/shell/cli/default.nix | 64 ++++++++++++++++++ home/ooks/base/shell/{ => cli}/fish.nix | 0 home/ooks/base/shell/{ => cli}/git.nix | 0 home/ooks/base/shell/{ => cli}/lf/default.nix | 0 home/ooks/base/shell/{ => cli}/lf/icons | 0 .../base/shell/{ => cli}/live-buds-cli.nix | 0 home/ooks/base/shell/cli/nix-index.nix | 35 ++++++++++ home/ooks/base/shell/{ => cli}/starship.nix | 0 home/ooks/base/shell/default.nix | 66 ++++++++++++++----- home/ooks/base/shell/editors/default.nix | 6 ++ .../shell/{ => editors}/helix/default.nix | 0 .../base/shell/{ => editors}/helix/theme.nix | 0 home/ooks/base/shell/{ => editors}/nvim.nix | 0 home/ooks/base/shell/fzf.nix | 5 -- home/ooks/base/shell/pfetch.nix | 8 --- home/ooks/base/xdg.nix | 41 ++++++++++++ home/ooks/features/essentials/default.nix | 1 - .../essentials/eww/config/eww-widgets.yuck | 25 ++++--- .../essentials/eww/config/eww-windows.yuck | 9 +-- .../wayland/essentials/eww/config/eww.scss | 2 +- .../window-manager/hyprland/default.nix | 14 ++-- 24 files changed, 225 insertions(+), 60 deletions(-) delete mode 100644 home/ooks/base/shell/bat.nix rename home/ooks/base/shell/{ => cli}/bash.nix (100%) create mode 100644 home/ooks/base/shell/cli/default.nix rename home/ooks/base/shell/{ => cli}/fish.nix (100%) rename home/ooks/base/shell/{ => cli}/git.nix (100%) rename home/ooks/base/shell/{ => cli}/lf/default.nix (100%) rename home/ooks/base/shell/{ => cli}/lf/icons (100%) rename home/ooks/base/shell/{ => cli}/live-buds-cli.nix (100%) create mode 100644 home/ooks/base/shell/cli/nix-index.nix rename home/ooks/base/shell/{ => cli}/starship.nix (100%) create mode 100644 home/ooks/base/shell/editors/default.nix rename home/ooks/base/shell/{ => editors}/helix/default.nix (100%) rename home/ooks/base/shell/{ => editors}/helix/theme.nix (100%) rename home/ooks/base/shell/{ => editors}/nvim.nix (100%) delete mode 100644 home/ooks/base/shell/fzf.nix delete mode 100644 home/ooks/base/shell/pfetch.nix create mode 100644 home/ooks/base/xdg.nix diff --git a/home/ooks/base/default.nix b/home/ooks/base/default.nix index e3c1c00..dd3a492 100644 --- a/home/ooks/base/default.nix +++ b/home/ooks/base/default.nix @@ -6,6 +6,7 @@ in imports = [ inputs.nix-colors.homeManagerModule ./shell +# ./xdg.nix ] ++ (builtins.attrValues outputs.homeManagerModules); nixpkgs = { @@ -38,6 +39,8 @@ in FLAKE = "$HOME/.dotfiles/nix"; }; }; + + xdg.portal.enable = true; colorscheme = lib.mkDefault colorSchemes.everforest; home.file.".colorscheme".text = config.colorscheme.slug; diff --git a/home/ooks/base/shell/bat.nix b/home/ooks/base/shell/bat.nix deleted file mode 100644 index 145895e..0000000 --- a/home/ooks/base/shell/bat.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - programs.bat = { - enable = true; - config.theme = "base16"; - }; -} diff --git a/home/ooks/base/shell/bash.nix b/home/ooks/base/shell/cli/bash.nix similarity index 100% rename from home/ooks/base/shell/bash.nix rename to home/ooks/base/shell/cli/bash.nix diff --git a/home/ooks/base/shell/cli/default.nix b/home/ooks/base/shell/cli/default.nix new file mode 100644 index 0000000..386d391 --- /dev/null +++ b/home/ooks/base/shell/cli/default.nix @@ -0,0 +1,64 @@ +{ pkgs, config, ... }: { + imports = [ + ./lf + ./fzf.nix + ./git.nix + ./bash.nix + ./fish.nix + ./pfetch.nix + ./starship.nix + ]; + home.packages = with pkgs; [ + bc # Calculator + + # file utility + duf + du-dus + fd + ripgrep + + # archive + zip + uzip + unrar + + # file transfer + wget + httpie # Better curl + + # resource manager + powertop + + diffsitter # Better diff + jq # JSON pretty printer and manipulator + lazygit # git uitlity + comma # Install and run with "," + tldr # Community maintained help pages + tmux # Terminal multiplexer + progress + killall + gcc + acpi + ]; + + programs = { + btop.enable = true; + eza.enable = true; + bat = { + enable = true; + config = { + theme = "base16"; + pager = "less -FR"; + }; + }; + skim = { + enable = true; + enableFishIntergration = true; + defaultCommand = "rg --files --hidden"; + changeDirWidgetOptions = [ + "--preview 'ea --icons --git --color always -T -L 3 {} | head -200'" + "--exact" + ]; + } + }; +} diff --git a/home/ooks/base/shell/fish.nix b/home/ooks/base/shell/cli/fish.nix similarity index 100% rename from home/ooks/base/shell/fish.nix rename to home/ooks/base/shell/cli/fish.nix diff --git a/home/ooks/base/shell/git.nix b/home/ooks/base/shell/cli/git.nix similarity index 100% rename from home/ooks/base/shell/git.nix rename to home/ooks/base/shell/cli/git.nix diff --git a/home/ooks/base/shell/lf/default.nix b/home/ooks/base/shell/cli/lf/default.nix similarity index 100% rename from home/ooks/base/shell/lf/default.nix rename to home/ooks/base/shell/cli/lf/default.nix diff --git a/home/ooks/base/shell/lf/icons b/home/ooks/base/shell/cli/lf/icons similarity index 100% rename from home/ooks/base/shell/lf/icons rename to home/ooks/base/shell/cli/lf/icons diff --git a/home/ooks/base/shell/live-buds-cli.nix b/home/ooks/base/shell/cli/live-buds-cli.nix similarity index 100% rename from home/ooks/base/shell/live-buds-cli.nix rename to home/ooks/base/shell/cli/live-buds-cli.nix diff --git a/home/ooks/base/shell/cli/nix-index.nix b/home/ooks/base/shell/cli/nix-index.nix new file mode 100644 index 0000000..b35a4f6 --- /dev/null +++ b/home/ooks/base/shell/cli/nix-index.nix @@ -0,0 +1,35 @@ +{ pkgs, ... }: +let + update-script = pkgs.writeShellApplication { + name = "fetch-nix-index-database"; + runtimeInputs = with pkgs; [ wget coreutils ]; + text = '' + filename="index-x86_64-linux" + mkdir -p ~/.cache/nix-index + cd ~/.cache/nix-index + wget -N "https://github.com/Mic92/nix-index-database/releases/latest/download/$filename" + ln -f "$filename" files + ''; + }; +in +{ + programs.nix-index.enable = true; + + systemd.user.services.nix-index-database-sync = { + Unit = { Description = "fetch mic92/nix-index-database"; }; + Service = { + Type = "oneshot"; + ExecStart = "${update-script}/bin/fetch-nix-index-database"; + Restart = "on-failure"; + RestartSec = "5m"; + }; + }; + systemd.user.timers.nix-index-database-sync = { + Unit = { Description = "Automatic github:mic92/nix-index-database fetching"; }; + Timer = { + OnBootSec = "10m"; + OnUnitActiveSec = "24h"; + }; + Install = { WantedBy = [ "timers.target" ]; }; + }; +} diff --git a/home/ooks/base/shell/starship.nix b/home/ooks/base/shell/cli/starship.nix similarity index 100% rename from home/ooks/base/shell/starship.nix rename to home/ooks/base/shell/cli/starship.nix diff --git a/home/ooks/base/shell/default.nix b/home/ooks/base/shell/default.nix index cdf5093..d9e13de 100644 --- a/home/ooks/base/shell/default.nix +++ b/home/ooks/base/shell/default.nix @@ -1,37 +1,69 @@ -{ pkgs, ... }: { +{ pkgs, config, ... }: { imports = [ - ./bat.nix ./lf - ./nvim.nix - ./fzf.nix + ./nix-index.nix ./git.nix - ./bash.nix ./fish.nix - ./pfetch.nix ./starship.nix - ./helix ]; home.packages = with pkgs; [ bc # Calculator - ncdu # disk util - eza # Ls - fd # Find - ripgrep # Better grep + + # file utility + duf + du-dus + fd + ripgrep + + # archive + zip + uzip + unrar + + # file transfer + wget httpie # Better curl + + # resource manager + powertop + diffsitter # Better diff jq # JSON pretty printer and manipulator - lazygit # Better git + lazygit # git uitlity comma # Install and run with "," - btop # Resource manager tldr # Community maintained help pages tmux # Terminal multiplexer - unzip progress killall gcc - wget - powertop acpi - + pfetch ]; + + programs = { + btop.enable = true; + eza.enable = true; + fzf.enable = true; + bash.enable = true; + bat = { + enable = true; + config = { + theme = "base16"; + pager = "less -FR"; + }; + }; + skim = { + enable = true; + enableFishIntergration = true; + defaultCommand = "rg --files --hidden"; + changeDirWidgetOptions = [ + "--preview 'ea --icons --git --color always -T -L 3 {} | head -200'" + "--exact" + ]; + }; + direnv = { + enable = true; + nix-direnv.enable = true; + }; + }; } diff --git a/home/ooks/base/shell/editors/default.nix b/home/ooks/base/shell/editors/default.nix new file mode 100644 index 0000000..d35f7ff --- /dev/null +++ b/home/ooks/base/shell/editors/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./nvim.nix + ./helix + ]; +} diff --git a/home/ooks/base/shell/helix/default.nix b/home/ooks/base/shell/editors/helix/default.nix similarity index 100% rename from home/ooks/base/shell/helix/default.nix rename to home/ooks/base/shell/editors/helix/default.nix diff --git a/home/ooks/base/shell/helix/theme.nix b/home/ooks/base/shell/editors/helix/theme.nix similarity index 100% rename from home/ooks/base/shell/helix/theme.nix rename to home/ooks/base/shell/editors/helix/theme.nix diff --git a/home/ooks/base/shell/nvim.nix b/home/ooks/base/shell/editors/nvim.nix similarity index 100% rename from home/ooks/base/shell/nvim.nix rename to home/ooks/base/shell/editors/nvim.nix diff --git a/home/ooks/base/shell/fzf.nix b/home/ooks/base/shell/fzf.nix deleted file mode 100644 index 9134638..0000000 --- a/home/ooks/base/shell/fzf.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - programs.fzf = { - enable = true; - }; -} diff --git a/home/ooks/base/shell/pfetch.nix b/home/ooks/base/shell/pfetch.nix deleted file mode 100644 index 5808519..0000000 --- a/home/ooks/base/shell/pfetch.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: -{ - home = { - packages = with pkgs; [ pfetch ]; - sessionVariables.PF_INFO = - "ascii title os kernel uptime shell desktop scheme palette"; - }; -} diff --git a/home/ooks/base/xdg.nix b/home/ooks/base/xdg.nix new file mode 100644 index 0000000..8ac36a9 --- /dev/null +++ b/home/ooks/base/xdg.nix @@ -0,0 +1,41 @@ +{ config, ... }: let + browser = ["firefox.desktop"]; + + associations = { + "application/x-extension-htm" = browser; + "application/x-extension-html" = browser; + "application/x-extension-shtml" = browser; + "application/x-extension-xht" = browser; + "application/x-extension-xhtml" = browser; + "application/xhtml+xml" = browser; + "text/html" = browser; + "x-scheme-handler/about" = browser; + "x-scheme-handler/chrome" = ["chromium-browser.desktop"]; + "x-scheme-handler/ftp" = browser; + "x-scheme-handler/http" = browser; + "x-scheme-handler/https" = browser; + "x-scheme-handler/unknown" = browser; + + "audio/*" = ["mpv.desktop"]; + "video/*" = ["mpv.desktop"]; + "image/*" = ["imv.desktop"]; + "application/json" = browser; + "application/pdf" = ["org.pwmt.zathura.desktop.desktop"]; + }; +in { + xdg = { + portal.enable = true; + cacheHome = config.home.homeDirectory + "/.local/cache"; + mimeApps = { + enable = true; + defaultApplications = associations; + }; + usrDirs = { + enable = true; + creatDirectories = true; + extraConfig = { + XDG_SCREENSHOT_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; + }; + }; + }; +} diff --git a/home/ooks/features/essentials/default.nix b/home/ooks/features/essentials/default.nix index ad36787..f263796 100644 --- a/home/ooks/features/essentials/default.nix +++ b/home/ooks/features/essentials/default.nix @@ -10,5 +10,4 @@ ./yt-dlp.nix ./playerctl.nix ]; - xdg.portal.enable = true; } diff --git a/home/ooks/features/wayland/essentials/eww/config/eww-widgets.yuck b/home/ooks/features/wayland/essentials/eww/config/eww-widgets.yuck index 9d3f2c9..a556985 100644 --- a/home/ooks/features/wayland/essentials/eww/config/eww-widgets.yuck +++ b/home/ooks/features/wayland/essentials/eww/config/eww-widgets.yuck @@ -6,22 +6,11 @@ (label :text "${TIME}" :class "text" - :halign "left" + :halign "start" :valign "center" ) ) -;; Battery -(defwidget widget-bat-bar [] - (progress - :class "${BATTERY-COLOR}" - :value "${BATTERY-PERCENTAGE}" - :orientation "horizontal" - :valign "center" - :halign "center" - :tooltip "${BATTERY-PERCENTAGE}" - ) -) (defwidget widget-battery [] (label @@ -29,7 +18,7 @@ :class "${BATTERY-COLOR}" :orientation "horizontal" :valign "center" - :halign "center" + :halign "end" ) ) @@ -42,4 +31,12 @@ :valign "center" :halign "center" ) -) \ No newline at end of file +) + +(defwidget bar-box [] + (centerbox + (widget-clock) + (widget-earbuds) + (widget-battery) + ) +) diff --git a/home/ooks/features/wayland/essentials/eww/config/eww-windows.yuck b/home/ooks/features/wayland/essentials/eww/config/eww-windows.yuck index b3ce01f..cefdb16 100644 --- a/home/ooks/features/wayland/essentials/eww/config/eww-windows.yuck +++ b/home/ooks/features/wayland/essentials/eww/config/eww-windows.yuck @@ -51,12 +51,13 @@ :anchor "top center" :x "0" :y "0" - :width "100%" - :height "3%" + :width "99%" + :height "22px" ) - :stacking "bg" + :stacking "fg" :exclusive "true" :focusable "false" - " " + :namespace "bar" + (bar-box) ) diff --git a/home/ooks/features/wayland/essentials/eww/config/eww.scss b/home/ooks/features/wayland/essentials/eww/config/eww.scss index b0ca088..1dbb4b2 100644 --- a/home/ooks/features/wayland/essentials/eww/config/eww.scss +++ b/home/ooks/features/wayland/essentials/eww/config/eww.scss @@ -7,6 +7,6 @@ text { font-family: "JetBrains Mono Nerd Font"; } .bar { - font-size: 12px; + font-size: 17px; } diff --git a/home/ooks/features/wayland/window-manager/hyprland/default.nix b/home/ooks/features/wayland/window-manager/hyprland/default.nix index f822d0b..88285ad 100644 --- a/home/ooks/features/wayland/window-manager/hyprland/default.nix +++ b/home/ooks/features/wayland/window-manager/hyprland/default.nix @@ -105,12 +105,18 @@ exec = [ "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" "${pkgs.swaybg}/bin/swaybg -i ~/.dotfiles/nix/walls/gruvbox/gruvbox-blank.png --mode fill" - "earbuds -d" - "eww open-many bar window-clock window-battery window-earbuds" ]; - exec-once = [ - "${pkgs._1password-gui}/bin/1password --silent" + exec-once = + #let + #eww = "${pkgs.eww-wayland}/bin/eww"; + #in + [ + "${pkgs._1password-gui}/bin/1password --silent" + # "${eww} daemon & ${eww} open bar & ${eww} open window-clock & ${eww} open window-battery & ${eww} open window-earbuds" + "${pkgs.live-buds-cli}/bin/earbuds -d" + "eww daemon && eww open bar" + "eww open-many window-clock window-battery window-earbuds" ]; }; };