1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-27 17:08:31 +02:00

redshift: enable geoclue2

This commit is contained in:
rembo10 2018-07-13 21:54:20 +03:00 committed by Robert Helgesson
parent 092706eff8
commit 34db8df6d9
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89

View File

@ -25,18 +25,33 @@ in
};
latitude = mkOption {
type = types.str;
type = types.nullOr types.str;
default = null;
description = ''
Your current latitude, between
<literal>-90.0</literal> and <literal>90.0</literal>.
Your current latitude, between <literal>-90.0</literal> and
<literal>90.0</literal>. Must be provided along with
longitude.
'';
};
longitude = mkOption {
type = types.str;
type = types.nullOr types.str;
default = null;
description = ''
Your current longitude, between
between <literal>-180.0</literal> and <literal>180.0</literal>.
Your current longitude, between <literal>-180.0</literal> and
<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 = {
ExecStart =
let
providerString =
if cfg.provider == "manual"
then "${cfg.latitude}:${cfg.longitude}"
else cfg.provider;
args = [
"-l ${cfg.latitude}:${cfg.longitude}"
"-l ${providerString}"
"-t ${toString cfg.temperature.day}:${toString cfg.temperature.night}"
"-b ${toString cfg.brightness.day}:${toString cfg.brightness.night}"
] ++ cfg.extraOptions;
command = if cfg.tray then "redshift-gtk" else "redshift";
in
"${cfg.package}/bin/${command} ${concatStringsSep " " args}";