mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
redshift: enable geoclue2
This commit is contained in:
parent
092706eff8
commit
34db8df6d9
1 changed files with 28 additions and 7 deletions
|
@ -25,18 +25,33 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
latitude = mkOption {
|
latitude = mkOption {
|
||||||
type = types.str;
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Your current latitude, between
|
Your current latitude, between <literal>-90.0</literal> and
|
||||||
<literal>-90.0</literal> and <literal>90.0</literal>.
|
<literal>90.0</literal>. Must be provided along with
|
||||||
|
longitude.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
longitude = mkOption {
|
longitude = mkOption {
|
||||||
type = types.str;
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Your current longitude, between
|
Your current longitude, between <literal>-180.0</literal> and
|
||||||
between <literal>-180.0</literal> and <literal>180.0</literal>.
|
<literal>180.0</literal>. Must be provided along with
|
||||||
|
latitude.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
provider = mkOption {
|
||||||
|
type = types.enum [ "manual" "geoclue2" ];
|
||||||
|
default = "manual";
|
||||||
|
description = ''
|
||||||
|
The location provider to use for determining your location. If set to
|
||||||
|
<literal>manual</literal> you must also provide latitude/longitude.
|
||||||
|
If set to <literal>geoclue2</literal>, you must also enable the global
|
||||||
|
geoclue2 service.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,11 +137,17 @@ in
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart =
|
ExecStart =
|
||||||
let
|
let
|
||||||
|
providerString =
|
||||||
|
if cfg.provider == "manual"
|
||||||
|
then "${cfg.latitude}:${cfg.longitude}"
|
||||||
|
else cfg.provider;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"-l ${cfg.latitude}:${cfg.longitude}"
|
"-l ${providerString}"
|
||||||
"-t ${toString cfg.temperature.day}:${toString cfg.temperature.night}"
|
"-t ${toString cfg.temperature.day}:${toString cfg.temperature.night}"
|
||||||
"-b ${toString cfg.brightness.day}:${toString cfg.brightness.night}"
|
"-b ${toString cfg.brightness.day}:${toString cfg.brightness.night}"
|
||||||
] ++ cfg.extraOptions;
|
] ++ cfg.extraOptions;
|
||||||
|
|
||||||
command = if cfg.tray then "redshift-gtk" else "redshift";
|
command = if cfg.tray then "redshift-gtk" else "redshift";
|
||||||
in
|
in
|
||||||
"${cfg.package}/bin/${command} ${concatStringsSep " " args}";
|
"${cfg.package}/bin/${command} ${concatStringsSep " " args}";
|
||||||
|
|
Loading…
Reference in a new issue