From 12f1b97f1c2e683ebfa59fb67b55d8ca6675f211 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sat, 13 Jul 2024 22:08:21 +0200 Subject: [PATCH] trying to get mpd working --- flake.nix | 1 + hosts/vali/hermit/configuration.nix | 5 + hosts/vali/hermit/programs.nix | 7 + modules/editors/nvf/plugins/settings/lsp.nix | 2 +- modules/gui/anyrun/anyrun.nix | 55 +++-- modules/gui/foot.nix | 2 +- modules/runners/rofi/default.nix | 208 +++++++++++++++++++ modules/services/default.nix | 2 +- modules/services/mpd.nix | 61 ++++++ modules/tui/ncmpcpp.nix | 9 +- modules/wms/wayland/hypr/land.nix | 3 + 11 files changed, 333 insertions(+), 22 deletions(-) create mode 100644 modules/runners/rofi/default.nix create mode 100644 modules/services/mpd.nix diff --git a/flake.nix b/flake.nix index 64dab36..db41866 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,7 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Hyprland, my main compositor hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + #hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1&ref=aquamarine"; # Plugins for hyprland hyprland-plugins = { url = "github:hyprwm/hyprland-plugins"; diff --git a/hosts/vali/hermit/configuration.nix b/hosts/vali/hermit/configuration.nix index 752203a..5c4a096 100644 --- a/hosts/vali/hermit/configuration.nix +++ b/hosts/vali/hermit/configuration.nix @@ -70,6 +70,7 @@ kitty.enable = true; newsboat.enable = true; fish.enable = true; + ncmpcpp.enable = true; nh.enable = true; wtfutil.enable = true; waybar.enable = true; @@ -94,6 +95,10 @@ services = { pipewire.enable = true; dunst.enable = true; + mpd = { + enable = true; + musicDirectory = "/home/${config.modules.other.system.username}/Nextcloud/Media/Music"; + }; }; theming = { quickshell.enable = true; diff --git a/hosts/vali/hermit/programs.nix b/hosts/vali/hermit/programs.nix index adf82d6..e8c0b12 100644 --- a/hosts/vali/hermit/programs.nix +++ b/hosts/vali/hermit/programs.nix @@ -19,7 +19,10 @@ in { bun cachix calc + calcure + calibre cmake + cmus difftastic dig discordo @@ -48,12 +51,15 @@ in { impala imv inetutils + jrnl keepassxc lazygit libtool links2 mapscii mars-mips + moc + musikcube ncmpcpp neofetch networkmanagerapplet @@ -106,6 +112,7 @@ in { xournalpp yt-dlp zapzap + zathura zip zoxide ]; diff --git a/modules/editors/nvf/plugins/settings/lsp.nix b/modules/editors/nvf/plugins/settings/lsp.nix index 34ded6c..c0184b7 100644 --- a/modules/editors/nvf/plugins/settings/lsp.nix +++ b/modules/editors/nvf/plugins/settings/lsp.nix @@ -4,7 +4,7 @@ _: { formatOnSave = true; lspkind.enable = true; lsplines.enable = true; - lightbulb.enable = true; + lightbulb.enable = false; lspsaga.enable = false; lspSignature.enable = true; nvimCodeActionMenu.enable = true; diff --git a/modules/gui/anyrun/anyrun.nix b/modules/gui/anyrun/anyrun.nix index 2af1421..ff20bf7 100644 --- a/modules/gui/anyrun/anyrun.nix +++ b/modules/gui/anyrun/anyrun.nix @@ -20,7 +20,6 @@ in { plugins = with inputs.anyrun.packages.${pkgs.system}; [ applications dictionary - # kidex rink shell # symbols @@ -33,25 +32,51 @@ in { hidePluginInfo = true; closeOnClick = true; showResultsImmediately = true; - maxEntries = 50; + maxEntries = 10; width.fraction = 0.3; y.absolute = 15; }; - extraCss = builtins.readFile (./. + "/style.css"); + extraCss = builtins.readFile ./style.css; - extraConfigFiles."applications.ron".text = '' - Config( - desktop_actions: false, + extraConfigFiles = { + "applications.ron".text = '' + Config( + desktop_actions: true, + max_entries: 10, + terminal: Some("foot"), + ) + ''; + "websearch.ron".text = '' + Config( + prefix: "?", + engines: [DuckDuckGo] + ) + ''; + + "symbols.ron".text = '' + Config( + // The prefix that the search needs to begin with to yield symbol results + prefix: ":sy", + + // Custom user defined symbols to be included along the unicode symbols + symbols: { + // "name": "text to be copied" + "shrug": "¯\\_(ツ)_/¯", + }, + + // The number of entries to be displayed max_entries: 5, - terminal: Some("foot"), - ) - ''; - extraConfigFiles."websearch.ron".text = '' - Config( - prefix: "?", - engines: [DuckDuckGo] - ) - ''; + ) + ''; + + "translate.ron".text = '' + Config( + prefix: ":tr", + language_delimiter: ">", + max_entries: 3, + ) + ''; + }; }; }; }; diff --git a/modules/gui/foot.nix b/modules/gui/foot.nix index c5d2aa7..40e51de 100644 --- a/modules/gui/foot.nix +++ b/modules/gui/foot.nix @@ -68,7 +68,7 @@ in { abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[]''; }; cursor = { - style = "beam"; + style = "block"; blink = "true"; }; mouse = { diff --git a/modules/runners/rofi/default.nix b/modules/runners/rofi/default.nix new file mode 100644 index 0000000..f2c9746 --- /dev/null +++ b/modules/runners/rofi/default.nix @@ -0,0 +1,208 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf optionals; + inherit (config.modules.other.system) username; + cfg = config.modules.programs.rofi; + + rofiPackage = with pkgs; rofi-wayland; +in { + config = mkIf env.programs.launchers.rofi.enable { + programs.rofi = { + enable = true; + package = rofiPackage.override { + plugins = [ + pkgs.rofi-rbw + ]; + }; + font = "Iosevka Nerd Font 14"; + extraConfig = { + modi = "drun,filebrowser,calc,emoji"; + drun-display-format = " {name} "; + sidebar-mode = true; + matching = "prefix"; + scroll-method = 0; + disable-history = false; + show-icons = true; + + display-drun = " Run"; + display-run = " Run"; + display-filebrowser = " Files"; + display-calc = "󰃬 Calculator"; + display-emoji = "💀 Emoji"; + }; + + theme = let + inherit (osConfig.modules.style.colorScheme) colors; + inherit (config.lib.formats.rasi) mkLiteral; + in { + "*" = { + background = mkLiteral "#${colors.base02}"; + background-alt = mkLiteral "#${colors.base02}"; + foreground = mkLiteral "#${colors.base05}"; + selected = mkLiteral "#${colors.base00}"; + active = mkLiteral "#${colors.base0D}"; + urgent = mkLiteral "#${colors.base00}"; + }; + "window" = { + transparency = "real"; + location = mkLiteral "center"; + anchor = mkLiteral "center"; + fullscreen = mkLiteral "false"; + width = mkLiteral "600px"; + x-offset = mkLiteral "0px"; + y-offset = mkLiteral "0px"; + enabled = mkLiteral "true"; + border-radius = mkLiteral "20px"; + border = mkLiteral "4px"; + border-color = mkLiteral "#${colors.base02}"; + cursor = "default"; + background-color = mkLiteral "@background"; + }; + "mainbox" = { + enabled = true; + spacing = mkLiteral "0px"; + background-color = mkLiteral "transparent"; + orientation = mkLiteral "vertical"; + children = mkLiteral "[inputbar,listbox]"; + }; + "listbox" = { + spacing = mkLiteral "10px"; + padding = mkLiteral "10px 10px 10px 15px"; + background-color = mkLiteral "transparent"; + orientation = mkLiteral "vertical"; + children = mkLiteral "[message,listview]"; + }; + "inputbar" = { + enabled = true; + spacing = mkLiteral "10px"; + padding = mkLiteral "30px 20px 30px 20px"; + background-color = mkLiteral "@selected"; + text-color = mkLiteral "@foreground"; + orientation = mkLiteral "horizontal"; + children = mkLiteral "[prompt,entry]"; + }; + "entry" = { + enabled = true; + expand = true; + width = mkLiteral "300px"; + padding = mkLiteral "12px 15px"; + border-radius = mkLiteral "15px"; + background-color = mkLiteral "@background-alt"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "text"; + placeholder = "Search"; + placeholder-color = mkLiteral "inherit"; + }; + "prompt" = { + width = mkLiteral "64px"; + font = "Iosevka Nerd Font 13"; + padding = mkLiteral "10px 20px 10px 20px"; + border-radius = mkLiteral "15px"; + background-color = mkLiteral "@background-alt"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "pointer"; + }; + "mode-switcher" = { + enabled = true; + spacing = mkLiteral "10px"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "@foreground"; + }; + "button" = { + width = mkLiteral "48px"; + font = "Iosevka Nerd Font 14"; + padding = mkLiteral "8px 5px 8px 8px"; + border-radius = mkLiteral "15px"; + background-color = mkLiteral "@background-alt"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "pointer"; + }; + "button selected" = { + background-color = mkLiteral "@selected"; + text-color = mkLiteral "@foreground"; + }; + "listview" = { + enabled = true; + columns = 2; + lines = 7; + cycle = true; + dynamic = true; + srollbar = false; + layout = mkLiteral "vertical"; + reverse = false; + fixed-height = true; + fixed-columns = false; + spacing = mkLiteral "5px"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "@foreground"; + cursor = mkLiteral "default"; + }; + "element" = { + enabled = true; + spacing = mkLiteral "15px"; + padding = mkLiteral "7px"; + border-radius = mkLiteral "100%"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "@foreground"; + cursor = mkLiteral "pointer"; + }; + "element normal.normal" = { + background-color = mkLiteral "inherit"; + text-color = mkLiteral "inherit"; + }; + "element normal.urgent" = { + background-color = mkLiteral "@urgent"; + text-color = mkLiteral "@foreground"; + }; + "element normal.active" = { + background-color = mkLiteral "@background"; + text-color = mkLiteral "@active"; + }; + "element selected.normal" = { + background-color = mkLiteral "@selected"; + text-color = mkLiteral "@foreground"; + }; + "element selected.urgent" = { + background-color = mkLiteral "@urgent"; + text-color = mkLiteral "@foreground"; + }; + "element selected.active" = { + background-color = mkLiteral "@urgent"; + text-color = mkLiteral "@active"; + }; + "element-icon" = { + background-color = mkLiteral "transparent"; + text-color = mkLiteral "inherit"; + size = mkLiteral "32px"; + cursor = mkLiteral "inherit"; + }; + "element-text" = { + background-color = mkLiteral "transparent"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "inherit"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.0"; + }; + "message" = {background-color = mkLiteral "transparent";}; + "textbox" = { + padding = mkLiteral "12px"; + border-radius = mkLiteral "100%"; + background-color = mkLiteral "@background-alt"; + text-color = mkLiteral "@foreground"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.0"; + }; + "error-message" = { + padding = mkLiteral "12px"; + border-radius = mkLiteral "20px"; + background-color = mkLiteral "@background"; + text-color = mkLiteral "@foreground"; + }; + }; + }; + }; +} diff --git a/modules/services/default.nix b/modules/services/default.nix index e147e91..35ca86a 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -1 +1 @@ -_: {imports = [./pipewire.nix ./ssh.nix ./greetd.nix ./dunst.nix];} +_: {imports = [./pipewire.nix ./ssh.nix ./greetd.nix ./dunst.nix ./mpd.nix];} diff --git a/modules/services/mpd.nix b/modules/services/mpd.nix new file mode 100644 index 0000000..5769b47 --- /dev/null +++ b/modules/services/mpd.nix @@ -0,0 +1,61 @@ +{ + config, + lib, + ... +}: let + cfg = config.modules.services.mpd; + inherit (config.modules.other.system) username; + + inherit (lib) mkEnableOption mkIf mkOption; + inherit (lib.types) str; +in { + options.modules.services.mpd = { + enable = mkEnableOption "mpd"; + musicDirectory = mkOption { + description = "music directory for mpd"; + type = str; + }; + }; + + config = mkIf cfg.enable { + home-manager.users.${username} = { + services = { + mpd = { + enable = true; + inherit (cfg) musicDirectory; + extraConfig = '' + user "${username}" + restore_paused "yes" + + follow_outside_symlinks "yes" + follow_inside_symlinks "yes" + + audio_output { + type "pipewire" + name "PipeWire Sound Server" + } + audio_output { + type "fifo" + name "FIFO" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + }; + mpd-mpris = { + enable = true; + mpd = { + host = "127.0.0.1"; + network = "unix"; + port = 6600; + useLocal = true; + }; + }; + + playerctld = { + enable = true; + }; + }; + }; + }; +} diff --git a/modules/tui/ncmpcpp.nix b/modules/tui/ncmpcpp.nix index 5980891..2aa9841 100644 --- a/modules/tui/ncmpcpp.nix +++ b/modules/tui/ncmpcpp.nix @@ -6,20 +6,21 @@ }: with lib; let cfg = config.modules.programs.ncmpcpp; - username = config.modules.other.system.username; + inherit (config.modules.other.system) username; in { options.modules.programs.ncmpcpp.enable = mkEnableOption "ncmpcpp"; config = mkIf cfg.enable { home-manager.users.${username} = { - xdg.configFile."ncmpcpp/config".source = ./config; + #xdg.configFile."ncmpcpp/config".source = ./config; programs.ncmpcpp = { enable = true; package = pkgs.ncmpcpp.override {visualizerSupport = true;}; - mpdMusicDir = "/home/vali/Nextcloud/Media/Music"; + mpdMusicDir = "/home/${username}/Nextcloud/Media/Music"; settings = { mpd_host = "127.0.0.1"; mpd_port = "6600"; + /* alternative_header_first_line_format = "$5{$b%t$/b}$9"; alternative_header_second_line_format = "$3by $7{$b%a$/b}$9 $3from $7{$b%b$/b}$9 $5{(%y)}"; song_list_format = "♫ $2%n$(end) $9 $3%a$(end) $(245)-$9 $(246)%t$9 $R{ $5%y$9}$(end) $(246)%lq$(end)"; @@ -71,7 +72,6 @@ in { mouse_list_scroll_whole_page = "no"; show_hidden_files_in_local_browser = "no"; startup_screen = "playlist"; - execute_on_song_change = "/home/dobbie/.bin/np"; connected_message_on_startup = "no"; playlist_separate_albums = "no"; allow_for_physical_item_deletion = "no"; @@ -79,6 +79,7 @@ in { visualizer_data_source = "/tmp/mpd.fifo"; visualizer_type = "wave_filled"; visualizer_look = "▉▋"; + */ }; }; }; diff --git a/modules/wms/wayland/hypr/land.nix b/modules/wms/wayland/hypr/land.nix index 4da1e90..a13c618 100644 --- a/modules/wms/wayland/hypr/land.nix +++ b/modules/wms/wayland/hypr/land.nix @@ -173,6 +173,9 @@ in { debug.disable_logs = false; + cursor = { + hide_on_key_press = true; + }; misc = { enable_swallow = true; swallow_regex = "foot";