mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nix: update to 24.11
Reviewed-on: https://codeberg.org/leana8959/.files/pulls/1 Co-authored-by: Léana 江 <leana.jiang+git@icloud.com> Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
This commit is contained in:
parent
57ed96f0ea
commit
f6a89cba08
60 changed files with 696 additions and 752 deletions
|
|
@ -1,59 +1,49 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.programs.cmus.enable = lib.mkEnableOption "cmus";
|
||||
|
||||
config = lib.mkIf config.programs.cmus.enable {
|
||||
home.packages = [ pkgs.cmus ];
|
||||
xdg.configFile."cmus/rc".text = lib.mkMerge [
|
||||
(builtins.readFile ./rc)
|
||||
programs.cmus.extraConfig =
|
||||
let
|
||||
# dispatch to multiple callbacks
|
||||
callback-script = pkgs.writeShellApplication {
|
||||
name = "cmus-callback-script";
|
||||
runtimeInputs = [
|
||||
pkgs.cmusfm
|
||||
pkgs.libnotify
|
||||
];
|
||||
text = ''
|
||||
argv=("$@")
|
||||
declare -A map
|
||||
while [ $# -gt 0 ]; do
|
||||
map["$1"]="$2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux (
|
||||
let
|
||||
# dispatch to multiple callbacks
|
||||
callback = pkgs.writeShellApplication {
|
||||
name = "cmus-callback-script";
|
||||
runtimeInputs = [
|
||||
pkgs.cmusfm
|
||||
pkgs.libnotify
|
||||
];
|
||||
text = ''
|
||||
argv=("$@")
|
||||
declare -A map
|
||||
while [ $# -gt 0 ]; do
|
||||
map["$1"]="$2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
notify-send "''${map[title]}" "''${map[artist]} / ''${map[album]}"
|
||||
cmusfm "''${argv[@]}"
|
||||
'';
|
||||
};
|
||||
in
|
||||
(builtins.readFile ./rc)
|
||||
|
||||
notify-send "''${map[title]}" "''${map[artist]} / ''${map[album]}"
|
||||
cmusfm "''${argv[@]}"
|
||||
'';
|
||||
};
|
||||
in
|
||||
''
|
||||
set status_display_program=${lib.getExe callback}
|
||||
''
|
||||
))
|
||||
+ (lib.optionalString pkgs.stdenv.isLinux ''
|
||||
set status_display_program=${lib.getExe callback-script}
|
||||
'')
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin ''
|
||||
set status_display_program=${lib.getExe pkgs.cmusfm}
|
||||
'')
|
||||
+ (lib.optionalString pkgs.stdenv.isDarwin ''
|
||||
set status_display_program=${lib.getExe pkgs.cmusfm}
|
||||
'')
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux ''
|
||||
set output_plugin=alsa
|
||||
'')
|
||||
+ (lib.optionalString pkgs.stdenv.isLinux ''
|
||||
set output_plugin=alsa
|
||||
'')
|
||||
|
||||
# When switching over bluetooth, toggle the output device to coreaudio
|
||||
# and back to ao would fix the no sound issue.
|
||||
+ (lib.optionalString pkgs.stdenv.isDarwin ''
|
||||
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
||||
set output_plugin=ao
|
||||
'');
|
||||
|
||||
# When switching over bluetooth, toggle the output device to coreaudio
|
||||
# and back to ao would fix the no sound issue.
|
||||
(lib.mkIf pkgs.stdenv.isDarwin ''
|
||||
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
||||
set output_plugin=ao
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue