1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

walker: add module (#7649)

This commit is contained in:
Aguirre Matteo 2025-08-11 04:23:58 +00:00 committed by GitHub
parent 91586008a2
commit 0d492b89d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 205 additions and 0 deletions

120
modules/services/walker.nix Normal file
View file

@ -0,0 +1,120 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
types
mkIf
mkMerge
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.services.walker;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.services.walker = {
enable = mkEnableOption "walker";
package = mkPackageOption pkgs "walker" { nullable = true; };
settings = mkOption {
inherit (tomlFormat) type;
default = { };
example = {
app_launch_prefix = "";
terminal_title_flag = "";
locale = "";
close_when_open = false;
theme = "default";
monitor = "";
hotreload_theme = false;
as_window = false;
timeout = 0;
disable_click_to_close = false;
force_keyboard_focus = false;
};
description = ''
Configuration settings for walker. All the available options can be found here:
<https://github.com/abenz1267/walker/wiki/Basic-Configuration>
'';
};
theme = mkOption {
type =
with types;
nullOr (submodule {
options = {
name = mkOption {
type = types.str;
default = "nixos";
description = "The theme name.";
};
layout = mkOption {
inherit (tomlFormat) type;
default = { };
description = ''
The layout of the theme.
See <https://github.com/abenz1267/walker/wiki/Theming> for the full list of options.
'';
};
style = mkOption {
type = lines;
default = "";
description = "The styling of the theme, written in GTK CSS.";
};
};
});
default = null;
description = "The custom theme used by walker. Setting this option overrides `settings.theme`.";
};
systemd.enable = mkOption {
type = types.bool;
default = false;
example = true;
description = "Whatever to enable Walker's Systemd Unit.";
};
};
config = mkIf cfg.enable (mkMerge [
{
assertions = [
(lib.hm.assertions.assertPlatform "services.walker" pkgs lib.platforms.linux)
{
assertion = cfg.systemd.enable -> (cfg.package != null);
message = "Can't set services.walker.package to null if services.walker.systemd.enable is set to true;";
}
];
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."walker/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "walker-config" cfg.settings;
};
systemd.user.services.walker = mkIf (cfg.systemd.enable && cfg.package != null) {
Unit.Description = "Walker - Application Runner";
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart = "${lib.getExe cfg.package} --gapplication-service";
Restart = "on-failure";
};
};
}
(mkIf (cfg.theme != null) {
services.walker.settings.theme = cfg.theme.name;
xdg.configFile = {
"walker/themes/${cfg.theme.name}.toml".source =
tomlFormat.generate "walker-theme-${cfg.theme.name}.toml" cfg.theme.layout;
"walker/themes/${cfg.theme.name}.css".text = cfg.theme.style;
};
})
]);
}

View file

@ -0,0 +1,11 @@
app_launch_prefix = ""
as_window = false
close_when_open = false
disable_click_to_close = false
force_keyboard_focus = false
hotreload_theme = false
locale = ""
monitor = ""
terminal_title_flag = ""
theme = "mytheme"
timeout = 0

View file

@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
walker-example-config = ./example-config.nix;
}

View file

@ -0,0 +1,57 @@
{
services.walker = {
enable = true;
systemd.enable = true;
settings = {
app_launch_prefix = "";
terminal_title_flag = "";
locale = "";
close_when_open = false;
monitor = "";
hotreload_theme = false;
as_window = false;
timeout = 0;
disable_click_to_close = false;
force_keyboard_focus = false;
};
theme = {
name = "mytheme";
layout = {
ui = {
anchors = {
bottom = true;
left = true;
right = true;
top = true;
};
window = {
h_align = "fill";
v_align = "fill";
};
};
};
style = ''
* {
color: #dcd7ba;
}
'';
};
};
nmt.script = ''
assertFileExists home-files/.config/walker/config.toml
assertFileExists home-files/.config/walker/themes/mytheme.toml
assertFileExists home-files/.config/walker/themes/mytheme.css
assertFileContent home-files/.config/walker/config.toml \
${./config.toml}
assertFileContent home-files/.config/walker/themes/mytheme.toml \
${./mytheme.toml}
assertFileContent home-files/.config/walker/themes/mytheme.css \
${./mytheme.css}
'';
}

View file

@ -0,0 +1,3 @@
* {
color: #dcd7ba;
}

View file

@ -0,0 +1,9 @@
[ui.anchors]
bottom = true
left = true
right = true
top = true
[ui.window]
h_align = "fill"
v_align = "fill"