Skip to content

nightlight: init#400178

Merged
wegank merged 1 commit intoNixOS:masterfrom
aspauldingcode:nightlight-macOS
May 13, 2025
Merged

nightlight: init#400178
wegank merged 1 commit intoNixOS:masterfrom
aspauldingcode:nightlight-macOS

Conversation

@aspauldingcode
Copy link
Contributor

@aspauldingcode aspauldingcode commented Apr 19, 2025

Add nightlight macOS utility to Nixpkgs upstream.

This package allows you to toggle and modify macOS vanilla Night Shift feature.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@aspauldingcode aspauldingcode marked this pull request as draft April 19, 2025 21:04
@aspauldingcode
Copy link
Contributor Author

@sarahec sorry for ping, but do you know how to find a cargoHash sha256 for this package??

@SigmaSquadron
Copy link
Contributor

SigmaSquadron commented Apr 19, 2025

Looks like upstream's Cargo.lock is extremely old, and the fetcher is unable to parse it because it lacks the checksum field found in newer Rust projects. You can ask upstream to update their lockfile, or generate a patch yourself.

Are you sure you want to add a project that's been unmaintained for over 4 years to Nixpkgs? Are there really no replacements for this?

@aspauldingcode
Copy link
Contributor Author

Looks like upstream's Cargo.lock is extremely old, and the fetcher is unable to parse it because it lacks the checksum field found in newer Rust projects. You can ask upstream to update their lockfile, or generate a patch yourself.

Are you sure you want to add a project that's been unmaintained for over 4 years to Nixpkgs? Are there really no replacements for this?

Hm. That's actually a good point.

Well, I would like to have it upstream in nixpkgs because I want toggle feature in sketchybar.
I'm sure it will benefit others until something else is developed. I'll ask smudge to update the lockfile.

@sarahec
Copy link
Contributor

sarahec commented Apr 19, 2025

I just tested in homebrew (which builds from source) and nightlight still works. I'm surprised as many other solutions have come and gone in the past few years.

@sarahec
Copy link
Contributor

sarahec commented Apr 19, 2025

@aspauldingcode to answer you question, the process is:

  1. set cargoHash to an empty string.
  2. Build your package with nix-build. It will fail, and the failure message will contain the computed hash.
  3. Paste the computed hash into cargoHash
  4. Build again and it should work.

@aspauldingcode
Copy link
Contributor Author

aspauldingcode commented Apr 19, 2025

@aspauldingcode to answer you question, the process is:

  1. set cargoHash to an empty string.

  2. Build your package with nix-build. It will fail, and the failure message will contain the computed hash.

  3. Paste the computed hash into cargoHash

  4. Build again and it should work.

Thanks.
I thought I did it right. So it really is an outdate Cargo.lock that doesn't even contain the checksum needed to verify the hash

@aspauldingcode
Copy link
Contributor Author

I'm leaning towards not merging this since it's not maintained. I'll probably fork it and maintain my own fork, then open a pr for that project instead.

@smudge
Copy link

smudge commented Apr 21, 2025

I'd be more than happy to merge a PR that fixes the lockfile!

Also, I'd contend that a project doesn't always require commit activity in order to be considered maintained - since it still builds and works on all of my machines, I haven't had a reason to ship a new release in four years! 😅

@SigmaSquadron
Copy link
Contributor

SigmaSquadron commented Apr 21, 2025 via email

@sarahec
Copy link
Contributor

sarahec commented Apr 26, 2025

I tested running cargo update --verbose on a fork of nightlight and it generally worked. You'll need to bump the edition field to 2024. You could update gio, time, and objc to their latest versions, but you will need to make corresponding changes to the code.

@aspauldingcode I don't know what your time looks like these days, but if you have the time this could be a valuable learning project.

@aspauldingcode
Copy link
Contributor Author

@sarahec I ran out of storage space and taking several classes, waiting on my new laptop to arrive before I merge my fixes, but I made some changes to nightlight I'd like to share and I'm not abandoning this pr just yet 😄 thanks for heads up on cargo dependencies

@aspauldingcode
Copy link
Contributor Author

aspauldingcode commented Apr 28, 2025

Looks like I need cargo from unstable. Otherwise I cannot use cargo update after setting Cargo.toml edition = 2024.
I've managed to clear up some storage space but I was failing to rebuild due to this issue after a recent nix flake update invocation. I think it's fixed now upstream.

@sarahec
Copy link
Contributor

sarahec commented Apr 28, 2025

Looks like I need cargo from unstable. Otherwise I cannot use cargo update after setting Cargo.toml edition = 2024.

You could also back up to an earlier edition, just not all the way back to 2018.

@aspauldingcode aspauldingcode marked this pull request as ready for review April 29, 2025 17:05
@aspauldingcode
Copy link
Contributor Author

Ready for review.

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Apr 29, 2025
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/5445

Copy link
Contributor

@nicolas-goudry nicolas-goudry left a comment

Choose a reason for hiding this comment

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

Reviewed points

  • package path fits guidelines
  • package name fits guidelines
  • package version fits guidelines
  • meta.description is set and fits guidelines
  • meta.license fits upstream license
  • meta.platforms is set
  • meta.maintainers is set
  • meta.mainProgram is set, if applicable.
  • build time only dependencies are declared in nativeBuildInputs
  • source is fetched using the appropriate function
  • the list of phases is not overridden

Comments

Can’t build nor test it since I’m on Linux.

@aspauldingcode
Copy link
Contributor Author

Brilliant suggestions.

Copy link
Contributor

@nicolas-goudry nicolas-goudry left a comment

Choose a reason for hiding this comment

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

LGTM but as I said previously I cannot build nor test it since I’m on Linux.

Thanks for contributing!

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label May 7, 2025
Nightlight cargo hash added.

suggested changes

sri hash change, remove unnecessary wrapper
@wegank
Copy link
Member

wegank commented May 13, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 400178


aarch64-darwin

✅ 1 package built:
  • nightlight

@wegank wegank merged commit 0105c7d into NixOS:master May 13, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants