mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 09:29:41 +08:00
vicinae: Update to post 0.17 settings
This commit is contained in:
committed by
Austin Horstman
parent
398bc87bc8
commit
113b155fe8
@@ -12,6 +12,7 @@ let
|
||||
|
||||
packageVersion = if cfg.package != null then lib.getVersion cfg.package else null;
|
||||
themeIsToml = lib.versionAtLeast packageVersion "0.15.0";
|
||||
versionPost0_17 = lib.versionAtLeast packageVersion "0.17.0";
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.leiserfg ];
|
||||
@@ -43,7 +44,12 @@ in
|
||||
useLayerShell = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "If vicinae should use the layer shell";
|
||||
description = ''
|
||||
Whether vicinae should use the layer shell.
|
||||
If you are using version 0.17 or newer, you should use
|
||||
{option}.programs.vicinae.settings.launcher_window.layer_shell.enabled = false
|
||||
instead.
|
||||
'';
|
||||
};
|
||||
|
||||
extensions = lib.mkOption {
|
||||
@@ -127,7 +133,7 @@ in
|
||||
settings = lib.mkOption {
|
||||
inherit (jsonFormat) type;
|
||||
default = { };
|
||||
description = "Settings written as JSON to `~/.config/vicinae/vicinae.json.";
|
||||
description = "Settings written as JSON to `~/.config/vicinae/settings.json.";
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
faviconService = "twenty";
|
||||
@@ -158,6 +164,10 @@ in
|
||||
assertion = cfg.systemd.enable -> cfg.package != null;
|
||||
message = "{option}programs.vicinae.systemd.enable requires non null {option}programs.vicinae.package";
|
||||
}
|
||||
{
|
||||
assertion = !cfg.useLayerShell -> !versionPost0_17;
|
||||
message = ''After version 0.17, if you want to explicitly disable the use of layer shell, you need to set {option}.programs.vicinae.settings.launcher_window.layer_shell.enabled = false.'';
|
||||
}
|
||||
];
|
||||
lib.vicinae.mkExtension = (
|
||||
{
|
||||
@@ -223,10 +233,11 @@ in
|
||||
source = themeFormat.generate "vicinae-${name}-theme" theme;
|
||||
}
|
||||
) cfg.themes;
|
||||
settingsPath = if versionPost0_17 then "vicinae/settings.json" else "vicinae/vicinae.json";
|
||||
in
|
||||
{
|
||||
configFile = {
|
||||
"vicinae/vicinae.json" = lib.mkIf (cfg.settings != { }) {
|
||||
"${settingsPath}" = lib.mkIf (cfg.settings != { }) {
|
||||
source = jsonFormat.generate "vicinae-settings" cfg.settings;
|
||||
};
|
||||
}
|
||||
@@ -250,14 +261,16 @@ in
|
||||
PartOf = [ cfg.systemd.target ];
|
||||
};
|
||||
Service = {
|
||||
EnvironmentFile = pkgs.writeText "vicinae-env" ''
|
||||
USE_LAYER_SHELL=${if cfg.useLayerShell then builtins.toString 1 else builtins.toString 0}
|
||||
'';
|
||||
Type = "simple";
|
||||
ExecStart = "${lib.getExe' cfg.package "vicinae"} server";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
KillMode = "process";
|
||||
EnvironmentFile = lib.mkIf (!versionPost0_17) (
|
||||
pkgs.writeText "vicinae-env" ''
|
||||
USE_LAYER_SHELL=${if cfg.useLayerShell then builtins.toString 1 else builtins.toString 0}
|
||||
''
|
||||
);
|
||||
};
|
||||
Install = lib.mkIf cfg.systemd.autoStart {
|
||||
WantedBy = [ cfg.systemd.target ];
|
||||
|
||||
@@ -81,10 +81,11 @@
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists "home-files/.config/vicinae/vicinae.json"
|
||||
assertFileExists "home-files/.config/vicinae/settings.json"
|
||||
assertFileExists "home-files/.config/systemd/user/vicinae.service"
|
||||
assertFileExists "home-files/.local/share/vicinae/themes/catppuccin-mocha.toml"
|
||||
assertFileExists "home-files/.local/share/vicinae/extensions/gif-search/package.json"
|
||||
assertFileExists "home-files/.local/share/vicinae/extensions/test-extension/package.json"
|
||||
assertFileContent "home-files/.config/systemd/user/vicinae.service" ${./service.service}
|
||||
'';
|
||||
}
|
||||
|
||||
15
tests/modules/programs/vicinae/service.service
Normal file
15
tests/modules/programs/vicinae/service.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
|
||||
[Service]
|
||||
ExecStart=@vicinae@/bin/vicinae server
|
||||
KillMode=process
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
Type=simple
|
||||
|
||||
[Unit]
|
||||
After=graphical-session.target
|
||||
Description=Vicinae server daemon
|
||||
Documentation=https://docs.vicinae.com
|
||||
PartOf=graphical-session.target
|
||||
Reference in New Issue
Block a user