Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clight: init #64309

Merged
merged 5 commits into from Aug 12, 2019
Merged

clight: init #64309

merged 5 commits into from Aug 12, 2019

Conversation

eadwu
Copy link
Member

@eadwu eadwu commented Jul 4, 2019

I scared myself so many times before remembering the webcam lighting up was due to the program.

Motivation for this change

Auto adjusting brightness is one fine feature (or at least in my opinion).

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
pkgs/applications/misc/clight/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah something like that, nice

nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/redshift.nix Show resolved Hide resolved
nixos/modules/services/x11/redshift.nix Outdated Show resolved Hide resolved
@eadwu eadwu force-pushed the init/clight branch 3 times, most recently from d82f166 to 47b7ed1 Compare July 16, 2019 22:29
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some things to complain about, I hope you don't mind. Overall this PR looks very good, nice work! Feel free to ping me when you did the changes, GitHub doesn't send notifications just from pushing new commits unfortunately

Once everything is addressed, I'll do a final test to double check various combinations of options work and merge it afterwards assuming no problems

nixos/modules/services/x11/clight.nix Outdated Show resolved Hide resolved
nixos/modules/services/x11/redshift.nix Show resolved Hide resolved
nixos/modules/services/x11/clight.nix Show resolved Hide resolved
@eadwu eadwu force-pushed the init/clight branch 2 times, most recently from 59f30d7 to ae91a33 Compare August 12, 2019 15:10
@infinisil
Copy link
Member

And while testing this I found these changes necessary too:

diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index faa2ea82181..6228c95ae91 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -258,8 +258,18 @@ with lib;
     (mkRenamedOptionModule [ "networking" "resolvconfOptions" ] [ "networking" "resolvconf" "extraOptions" ])
 
     # Redshift
-    (mkAliasOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ])
-    (mkAliasOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ])
+    (mkChangedOptionModule [ "services" "redshift" "latitude" ] [ "location" "latitude" ]
+      (config:
+        let value = getAttrFromPath [ "services" "redshift" "latitude" ] config;
+        in if value == null then
+          throw "services.redshift.latitude is set to null, you can remove this"
+          else builtins.fromJSON value))
+    (mkChangedOptionModule [ "services" "redshift" "longitude" ] [ "location" "longitude" ]
+      (config:
+        let value = getAttrFromPath [ "services" "redshift" "longitude" ] config;
+        in if value == null then
+          throw "services.redshift.longitude is set to null, you can remove this"
+          else builtins.fromJSON value))
 
   ] ++ (flip map [ "blackboxExporter" "collectdExporter" "fritzboxExporter"
                    "jsonExporter" "minioExporter" "nginxExporter" "nodeExporter"
diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix
index e46c70e5f3b..55f8f75021b 100644
--- a/nixos/modules/services/x11/redshift.nix
+++ b/nixos/modules/services/x11/redshift.nix
@@ -89,7 +89,7 @@ in {
     systemd.user.services.redshift =
     let
       providerString = if lcfg.provider == "manual"
-        then "${lcfg.latitude}:${lcfg.longitude}"
+        then "${toString lcfg.latitude}:${toString lcfg.longitude}"
         else lcfg.provider;
     in
     {

The first one to convert from the strings services.redshift.* to the float options location.*, and the second one to have the floats be turned to strings in redshift

@eadwu
Copy link
Member Author

eadwu commented Aug 12, 2019

Applied patch.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patience :)

@infinisil infinisil merged commit a7c7bb1 into NixOS:master Aug 12, 2019
@turboMaCk
Copy link
Member

is there any documentation on how this can be used? I was using provider on redshift service and have no idea how to make it compatible with this change.

@infinisil
Copy link
Member

@turboMaCk You should only be getting a warning, no errors, so this is backwards compatible. Is that the case?

@turboMaCk
Copy link
Member

I got error

The option services-redshify.provider defined in .... does not exist

Anyway I think I've got it working by using location.provider = "goeclue2" instead.

infinisil added a commit to infinisil/nixpkgs that referenced this pull request Sep 15, 2019
This was an oversight in NixOS#64309
resulting it backwards incompatibilities
@infinisil
Copy link
Member

@turboMaCk Ah thanks for the report, this was a mistake in this PR, #68852 fixes it

infinisil added a commit that referenced this pull request Sep 15, 2019
This was an oversight in #64309
resulting it backwards incompatibilities

(cherry picked from commit e686b39)
@eadwu eadwu deleted the init/clight branch November 17, 2020 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants