Add cmus as own module with desktop file (not linked out of box)

This commit is contained in:
Daniel Siepmann 2022-02-03 14:34:32 +01:00
parent 114d72cd23
commit c41a367660
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
3 changed files with 49 additions and 0 deletions

View file

@ -1,6 +1,10 @@
{ config, pkgs, ... }:
{
imports = [
./home/modules/programs/cmus.nix
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "daniels";
@ -56,6 +60,9 @@
};
tmux = import ./home/programs/tmux.nix {
};
# Media
cmus.enable = true;
};
home.file = {

View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.cmus;
desktopItem = pkgs.writeTextDir "share/applications/cmus.desktop"
(generators.toINI { } {
"Desktop Entry" = {
Type = "Application";
Exec = "${cfg.package}/bin/cmus";
Terminal = true;
Name = "C* Music Player";
Comment = "A small, fast and powerful console music player";
GenericName = "Music player";
Categories = "ConsoleOnly;Audio;Player";
Keywords = "cmus;audio;player";
};
});
in {
options.programs.cmus = {
enable = mkEnableOption "Cmus";
package = mkOption {
type = types.package;
default = pkgs.cmus;
defaultText = literalExpression "pkgs.cmus";
description = "Cmus package to install.";
};
};
config = mkIf cfg.enable {
home = {
packages = optional cfg.enable (hiPrio desktopItem);
};
};
}

View file

@ -84,6 +84,9 @@ List of manual needed changes for various reasons.
* robo3t desktop file is not linked, that's done by hand for now.
* I now create a desktop file for cmus (first module ;) yeay)
But that is not linked as well, done by hand now …
Todos
-----