home-manager/programs/kando: init

This commit is contained in:
Gabriel Arazas 2025-04-17 16:09:08 +08:00
parent 72f4576508
commit ec5871b524
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
6 changed files with 180 additions and 0 deletions

View File

@ -1,6 +1,7 @@
{
imports = [
./files/mutable-files.nix
./programs/kando.nix
./programs/pipewire.nix
./programs/pop-launcher.nix
./programs/borgmatic.nix

View File

@ -0,0 +1,141 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.kando;
settingsFormat = pkgs.formats.json { };
in
{
options.programs.kando = {
enable = lib.mkEnableOption "Kando, a pie menu";
package = lib.mkPackageOption pkgs "kando" { };
settings = lib.mkOption {
type = settingsFormat.type;
default = { };
description = ''
Settings for Kando to be generated at
{file}`$XDG_CONFIG_HOME/kando/config.json`.
'';
example = lib.literalExpression ''
{
enableVersionCheck = false;
menuTheme = "my-menu-theme";
darkMenuTheme = "my-dark-menu-theme";
soundTheme = "my-sound-theme";
soundVolume = 0.8;
iconTheme = "my-icon-theme";
}
'';
};
menuSettings = lib.mkOption {
type = settingsFormat.type;
default = { };
description = ''
Menu-specific configuration for Kando to be generated at
{file}`$XDG_CONFIG_HOME/kando/menus.json`.
'';
example = lib.literalExpression ''
{
menus = [
{
shortcut = "Ctrl+Space";
shortcutId = "example-menu";
root = {
type = "submenu";
name = "example-menu.submenu";
children = [
# ...
];
};
}
{
shortcut = "Super+Space";
shortcutId = "super-menu";
root = {
type = "submenu";
name = "super-menu.submenu";
children = [
# ...
];
};
}
];
}
'';
};
themes = let
mkThemeOption = type: expectedOutputDir:
lib.mkOption {
type = with lib.types; listOf package;
default = [ ];
description = ''
A list of packages containing Kando ${type} themes expected at
{file}`${expectedOutputDir}`.
'';
example = lib.literalExpression ''
with pkgs.kandoThemes; [
doggo
catpuccin
];
'';
};
in {
menus = mkThemeOption "menu" "$out/share/kando/menu-themes";
sounds = mkThemeOption "sound" "$out/share/kando/sound-themes";
icons = mkThemeOption "icon" "$out/share/kando/icon-themes";
};
enableGnomeInegration = lib.mkEnableOption "GNOME Shell integration";
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ] ++ lib.optionals cfg.enableGnomeInegration [
pkgs.gnomeExtensions.kando-integration
];
xdg.configFile = {
"kando/config.json" = lib.mkIf (cfg.settings != { }) {
source = settingsFormat.generate "kando-settings-home-manager" cfg.settings;
};
"kando/menus.json" = lib.mkIf (cfg.menuSettings != { }) {
source = settingsFormat.generate "kando-menu-settings-home-manager" cfg.menuSettings;
};
"kando/menu-themes" = lib.mkIf (cfg.themes.menus != [ ]) {
source = pkgs.buildEnv {
paths = cfg.themes.menus;
pathsToLink = [
"/share/kando/menu-themes"
];
};
};
"kando/sound-themes" = lib.mkIf (cfg.themes.sounds != [ ]) {
source = pkgs.buildEnv {
paths = cfg.themes.menus;
pathsToLink = [
"/share/kando/sound-themes"
];
};
};
"kando/icon-themes" = lib.mkIf (cfg.themes.icons != [ ]) {
source = pkgs.buildEnv {
paths = cfg.themes.menus;
pathsToLink = [
"/share/kando/icon-themes"
];
};
};
};
};
}

View File

@ -50,6 +50,7 @@ in import nmt {
# TODO: Fix nmt to accept specialArgs or something.
tests = builtins.foldl' (a: b: a // (import b)) { } ([
#./programs/borgmatic
./programs/kando
./programs/diceware
./programs/sesh
./programs/pipewire

View File

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
{
programs.kando = {
enable = true;
settings = {
hello = "there";
a = "bc";
_1 = 23;
};
menuSettings = {
shortcut = "Ctrl+Space";
shortcutId = "example-menu";
};
};
nmt.script = ''
assertFileExists home-files/.config/kando/config.json
assertFileExists home-files/.config/kando/menus.json
'';
}

View File

@ -0,0 +1,4 @@
{
kando-basic-setup = ./basic.nix;
kando-empty-settings = ./empty-settings.nix;
}

View File

@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
programs.kando.enable = true;
nmt.script = ''
assertPathNotExists home-files/.config/kando/config.json
assertPathNotExists home-files/.config/kando/menus.json
'';
}