mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
shikane: init module (#4096)
This commit is contained in:
parent
496fa9c054
commit
b0cc092405
6 changed files with 162 additions and 0 deletions
|
|
@ -419,6 +419,7 @@ let
|
|||
./services/safeeyes.nix
|
||||
./services/screen-locker.nix
|
||||
./services/sctd.nix
|
||||
./services/shikane.nix
|
||||
./services/signaturepdf.nix
|
||||
./services/skhd.nix
|
||||
./services/snixembed.nix
|
||||
|
|
|
|||
91
modules/services/shikane.nix
Normal file
91
modules/services/shikane.nix
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.shikane;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.therealr5 ];
|
||||
|
||||
options.services.shikane = {
|
||||
|
||||
enable = lib.mkEnableOption "shikane, A dynamic output configuration tool that automatically detects and configures connected outputs based on a set of profiles.";
|
||||
|
||||
package = lib.mkPackageOption pkgs "shikane" { };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
profile = [
|
||||
{
|
||||
name = "external-monitor-default";
|
||||
output = [
|
||||
{
|
||||
match = "eDP-1";
|
||||
enable = true;
|
||||
}
|
||||
{
|
||||
match = "HDMI-A-1";
|
||||
enable = true;
|
||||
position = {
|
||||
x = 1920;
|
||||
y = 0;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "builtin-monitor-only";
|
||||
output = [
|
||||
{
|
||||
match = "eDP-1";
|
||||
enable = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
<filename>$XDG_CONFIG_HOME/shikane/config.toml</filename>.
|
||||
</para><para>
|
||||
See <link xlink:href="https://gitlab.com/w0lff/shikane/-/blob/master/docs/shikane.5.man.md" />
|
||||
for more information.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.shikane" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
xdg.configFile."shikane/config.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "shikane-config" cfg.settings;
|
||||
};
|
||||
|
||||
systemd.user.services.shikane = {
|
||||
Unit = {
|
||||
Description = "Dynamic output configuration tool";
|
||||
Documentation = "man:shikane(1)";
|
||||
After = [ config.wayland.systemd.target ];
|
||||
PartOf = [ config.wayland.systemd.target ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = lib.getExe cfg.package;
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ config.wayland.systemd.target ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -617,6 +617,7 @@ import nmtSrc {
|
|||
./modules/services/remmina
|
||||
./modules/services/restic
|
||||
./modules/services/screen-locker
|
||||
./modules/services/shikane
|
||||
./modules/services/signaturepdf
|
||||
./modules/services/snixembed
|
||||
./modules/services/swayidle
|
||||
|
|
|
|||
47
tests/modules/services/shikane/basic-configuration.nix
Normal file
47
tests/modules/services/shikane/basic-configuration.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
config = {
|
||||
services.shikane = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
settings = {
|
||||
profile = [
|
||||
{
|
||||
name = "external-monitor-default";
|
||||
output = [
|
||||
{
|
||||
match = "eDP-1";
|
||||
enable = true;
|
||||
}
|
||||
{
|
||||
match = "HDMI-A-1";
|
||||
enable = true;
|
||||
position = {
|
||||
x = 1920;
|
||||
y = 0;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "builtin";
|
||||
output = [
|
||||
{
|
||||
match = "eDP-1";
|
||||
enable = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/shikane.service
|
||||
assertFileExists $serviceFile
|
||||
|
||||
assertFileExists home-files/.config/shikane/config.toml
|
||||
assertFileContent home-files/.config/shikane/config.toml ${./expected.toml}
|
||||
'';
|
||||
};
|
||||
}
|
||||
1
tests/modules/services/shikane/default.nix
Normal file
1
tests/modules/services/shikane/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ shikane-basic-configuration = ./basic-configuration.nix; }
|
||||
21
tests/modules/services/shikane/expected.toml
Normal file
21
tests/modules/services/shikane/expected.toml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[[profile]]
|
||||
name = "external-monitor-default"
|
||||
|
||||
[[profile.output]]
|
||||
enable = true
|
||||
match = "eDP-1"
|
||||
|
||||
[[profile.output]]
|
||||
enable = true
|
||||
match = "HDMI-A-1"
|
||||
|
||||
[profile.output.position]
|
||||
x = 1920
|
||||
y = 0
|
||||
|
||||
[[profile]]
|
||||
name = "builtin"
|
||||
|
||||
[[profile.output]]
|
||||
enable = true
|
||||
match = "eDP-1"
|
||||
Loading…
Add table
Add a link
Reference in a new issue