trying to get mpd working

This commit is contained in:
Charlie Root 2024-07-13 22:08:21 +02:00
commit 12f1b97f1c
11 changed files with 333 additions and 22 deletions

View file

@ -9,6 +9,7 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Hyprland, my main compositor # Hyprland, my main compositor
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; 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 # Plugins for hyprland
hyprland-plugins = { hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins"; url = "github:hyprwm/hyprland-plugins";

View file

@ -70,6 +70,7 @@
kitty.enable = true; kitty.enable = true;
newsboat.enable = true; newsboat.enable = true;
fish.enable = true; fish.enable = true;
ncmpcpp.enable = true;
nh.enable = true; nh.enable = true;
wtfutil.enable = true; wtfutil.enable = true;
waybar.enable = true; waybar.enable = true;
@ -94,6 +95,10 @@
services = { services = {
pipewire.enable = true; pipewire.enable = true;
dunst.enable = true; dunst.enable = true;
mpd = {
enable = true;
musicDirectory = "/home/${config.modules.other.system.username}/Nextcloud/Media/Music";
};
}; };
theming = { theming = {
quickshell.enable = true; quickshell.enable = true;

View file

@ -19,7 +19,10 @@ in {
bun bun
cachix cachix
calc calc
calcure
calibre
cmake cmake
cmus
difftastic difftastic
dig dig
discordo discordo
@ -48,12 +51,15 @@ in {
impala impala
imv imv
inetutils inetutils
jrnl
keepassxc keepassxc
lazygit lazygit
libtool libtool
links2 links2
mapscii mapscii
mars-mips mars-mips
moc
musikcube
ncmpcpp ncmpcpp
neofetch neofetch
networkmanagerapplet networkmanagerapplet
@ -106,6 +112,7 @@ in {
xournalpp xournalpp
yt-dlp yt-dlp
zapzap zapzap
zathura
zip zip
zoxide zoxide
]; ];

View file

@ -4,7 +4,7 @@ _: {
formatOnSave = true; formatOnSave = true;
lspkind.enable = true; lspkind.enable = true;
lsplines.enable = true; lsplines.enable = true;
lightbulb.enable = true; lightbulb.enable = false;
lspsaga.enable = false; lspsaga.enable = false;
lspSignature.enable = true; lspSignature.enable = true;
nvimCodeActionMenu.enable = true; nvimCodeActionMenu.enable = true;

View file

@ -20,7 +20,6 @@ in {
plugins = with inputs.anyrun.packages.${pkgs.system}; [ plugins = with inputs.anyrun.packages.${pkgs.system}; [
applications applications
dictionary dictionary
# kidex
rink rink
shell shell
# symbols # symbols
@ -33,25 +32,51 @@ in {
hidePluginInfo = true; hidePluginInfo = true;
closeOnClick = true; closeOnClick = true;
showResultsImmediately = true; showResultsImmediately = true;
maxEntries = 50; maxEntries = 10;
width.fraction = 0.3; width.fraction = 0.3;
y.absolute = 15; y.absolute = 15;
}; };
extraCss = builtins.readFile (./. + "/style.css"); extraCss = builtins.readFile ./style.css;
extraConfigFiles."applications.ron".text = '' extraConfigFiles = {
Config( "applications.ron".text = ''
desktop_actions: false, 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, max_entries: 5,
terminal: Some("foot"), )
) '';
'';
extraConfigFiles."websearch.ron".text = '' "translate.ron".text = ''
Config( Config(
prefix: "?", prefix: ":tr",
engines: [DuckDuckGo] language_delimiter: ">",
) max_entries: 3,
''; )
'';
};
}; };
}; };
}; };

View file

@ -68,7 +68,7 @@ in {
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[]''; abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[]'';
}; };
cursor = { cursor = {
style = "beam"; style = "block";
blink = "true"; blink = "true";
}; };
mouse = { mouse = {

View file

@ -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";
};
};
};
};
}

View file

@ -1 +1 @@
_: {imports = [./pipewire.nix ./ssh.nix ./greetd.nix ./dunst.nix];} _: {imports = [./pipewire.nix ./ssh.nix ./greetd.nix ./dunst.nix ./mpd.nix];}

61
modules/services/mpd.nix Normal file
View file

@ -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;
};
};
};
};
}

View file

@ -6,20 +6,21 @@
}: }:
with lib; let with lib; let
cfg = config.modules.programs.ncmpcpp; cfg = config.modules.programs.ncmpcpp;
username = config.modules.other.system.username; inherit (config.modules.other.system) username;
in { in {
options.modules.programs.ncmpcpp.enable = mkEnableOption "ncmpcpp"; options.modules.programs.ncmpcpp.enable = mkEnableOption "ncmpcpp";
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${username} = { home-manager.users.${username} = {
xdg.configFile."ncmpcpp/config".source = ./config; #xdg.configFile."ncmpcpp/config".source = ./config;
programs.ncmpcpp = { programs.ncmpcpp = {
enable = true; enable = true;
package = pkgs.ncmpcpp.override {visualizerSupport = true;}; package = pkgs.ncmpcpp.override {visualizerSupport = true;};
mpdMusicDir = "/home/vali/Nextcloud/Media/Music"; mpdMusicDir = "/home/${username}/Nextcloud/Media/Music";
settings = { settings = {
mpd_host = "127.0.0.1"; mpd_host = "127.0.0.1";
mpd_port = "6600"; mpd_port = "6600";
/*
alternative_header_first_line_format = "$5{$b%t$/b}$9"; 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)}"; 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)"; 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"; mouse_list_scroll_whole_page = "no";
show_hidden_files_in_local_browser = "no"; show_hidden_files_in_local_browser = "no";
startup_screen = "playlist"; startup_screen = "playlist";
execute_on_song_change = "/home/dobbie/.bin/np";
connected_message_on_startup = "no"; connected_message_on_startup = "no";
playlist_separate_albums = "no"; playlist_separate_albums = "no";
allow_for_physical_item_deletion = "no"; allow_for_physical_item_deletion = "no";
@ -79,6 +79,7 @@ in {
visualizer_data_source = "/tmp/mpd.fifo"; visualizer_data_source = "/tmp/mpd.fifo";
visualizer_type = "wave_filled"; visualizer_type = "wave_filled";
visualizer_look = ""; visualizer_look = "";
*/
}; };
}; };
}; };

View file

@ -173,6 +173,9 @@ in {
debug.disable_logs = false; debug.disable_logs = false;
cursor = {
hide_on_key_press = true;
};
misc = { misc = {
enable_swallow = true; enable_swallow = true;
swallow_regex = "foot"; swallow_regex = "foot";