Redshift: Difference between revisions

m amend
Phobos (talk | contribs)
No edit summary
Line 7: Line 7:
== Installation ==
== Installation ==
==== Using nix-shell ====
==== Using nix-shell ====
<syntaxhighlight lang="bash" start="3">
<syntaxhighlight lang="console">
nix-shell -p redshift
$ nix-shell -p redshift
</syntaxhighlight>
</syntaxhighlight>


==== Using Global Configuration ====
==== Using Global Configuration ====
<syntaxhighlight lang="text">
{{File|3=environment.systemPackages = [
environment.systemPackages = [
  pkgs.redshift
  pkgs.redshift
];
];|name=/etc/nixos/configuration.nix|lang=nix}}
</syntaxhighlight>After modifying your configuration, apply the changes by running:<syntaxhighlight lang="bash">
After modifying your configuration, apply the changes by running:<syntaxhighlight lang="console">
sudo nixos-rebuild switch
$ sudo nixos-rebuild switch
</syntaxhighlight>
</syntaxhighlight>


==== Using Home Configuration ====
==== Using Home Configuration ====
<syntaxhighlight lang="text">
{{File|3=home.packages = [  
home.packages = [  
   pkgs.redshift  
   pkgs.redshift  
];
];|name=/etc/nixos/home.nix|lang=nix}}
</syntaxhighlight>After updating your configuration, apply the changes by running:<syntaxhighlight lang="bash">
After updating your configuration, apply the changes by running:<syntaxhighlight lang="console">
home-manager switch
$ home-manager switch
</syntaxhighlight>
</syntaxhighlight>


== Configuration ==
== Configuration ==
==== Basic ====
==== Basic ====
<syntaxHighlight lang=nix>
{{File|3=services.redshift = {
services.redshift = {
   enable = true;
   enable = true;
   temperature = {
   temperature = {
Line 41: Line 38:


services.geoclue2.enable = true;
services.geoclue2.enable = true;
location.provider = "geoclue2";
location.provider = "geoclue2";|name=/etc/nixos/configuration.nix|lang=nix}}
</syntaxHighlight>


==== Advanced ====
==== Advanced ====
<syntaxHighlight lang=nix>
{{File|3=services.redshift = {
services.redshift = {
   enable = true;
   enable = true;
    
    
Line 83: Line 78:
# Or like this, which can also be set in services.redshift
# Or like this, which can also be set in services.redshift
location.latitude = "27.9880614";
location.latitude = "27.9880614";
location.longitude = "86.92521";
location.longitude = "86.92521";|name=/etc/nixos/configuration.nix|lang=nix}}
</syntaxHighlight>


== Tips and Tricks ==
== Tips and Tricks ==
Line 93: Line 87:


==== Usage ====
==== Usage ====
<syntaxHighlight lang="shell">
<syntaxhighlight lang="shell"># If services.redshift.enable is true, the systemd unit redshift.service is provided.  
# If services.redshift.enable is true, the systemd unit redshift.service is provided.  
# It can either be started by the user level service manager like this:
# It can either be started by the user level service manager like this:
systemctl --user start redshift
systemctl --user start redshift
Line 102: Line 95:


# After starting the service, make sure to check its status in the service manager:
# After starting the service, make sure to check its status in the service manager:
systemctl --user status redshift
systemctl --user status redshift</syntaxhighlight>
</syntaxHighlight>


== Troubleshooting ==
== Troubleshooting ==
==== Provider is unable to determine location ====
==== Provider is unable to determine location ====
It may happen that redshift gets stuck at ''"Waiting for initial location to become available..."'' when using the {{Ic|geoclue2}} location provider. This may happen when geoclue is unable to determine your location due to missing information. In that case, you may resort to setting the location manually.
It may happen that Redshift gets stuck at ''"Waiting for initial location to become available..."'' when using the {{Ic|geoclue2}} location provider. This may happen when Geoclue is unable to determine your location due to missing information. In that case, you may resort to setting the location manually or using an alternate location service such as [https://beacondb.net/ beaconDB], which can take advantage of WiFi scanning.
 
An example of using beaconDB as an alternative:
 
{{File|3=services.geoclue2 = {
    enable = true;
    geoProviderUrl = "https://api.beacondb.net/v1/geolocate";
  };|name=/etc/nixos/configuration.nix|lang=nix}}


== References ==
== References ==