-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(nix): flake with binary package and NixOS module #290
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a71c3d3
feat(nix): add flake with binary package and NixOS module
hyperb1iss 200cf4b
ci(nix): build the flake on changes and pin it after each release
hyperb1iss bf52498
docs(install): document the Nix flake and NixOS module
hyperb1iss acf0e64
fix(daemon): treat epoch-normalized UI mtimes as unknown age
hyperb1iss 14a2076
ci(nix): validate the release pin before opening its pull request
hyperb1iss 9d9d337
docs(install): show how to activate the Nix profile unit
hyperb1iss c133ad3
chore(nix): clarify epoch mtime handling and trim the module check
hyperb1iss 3fb8bfd
ci(nix): harden the flake lane and stop swallowing pin PR failures
hyperb1iss 58f4175
fix(nix): create the daemon state directories before the unit starts
hyperb1iss 6d2bc09
docs(install): declare the nixpkgs input in the NixOS flake example
hyperb1iss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| { | ||
| description = "Hypercolor: open-source RGB lighting orchestration engine"; | ||
|
|
||
| inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
|
|
||
| outputs = | ||
| { self, nixpkgs }: | ||
| let | ||
| systems = [ | ||
| "x86_64-linux" | ||
| "aarch64-linux" | ||
| ]; | ||
| forEachSystem = nixpkgs.lib.genAttrs systems; | ||
| pkgsFor = system: nixpkgs.legacyPackages.${system}; | ||
| in | ||
| { | ||
| overlays.default = final: _prev: { | ||
| hypercolor = final.callPackage ./nix/package.nix { }; | ||
| }; | ||
|
|
||
| packages = forEachSystem ( | ||
| system: | ||
| let | ||
| hypercolor = (pkgsFor system).callPackage ./nix/package.nix { }; | ||
| in | ||
| { | ||
| inherit hypercolor; | ||
| default = hypercolor; | ||
| } | ||
| ); | ||
|
|
||
| nixosModules = { | ||
| hypercolor = | ||
| { pkgs, ... }: | ||
| { | ||
| imports = [ ./nix/module.nix ]; | ||
| services.hypercolor.package = | ||
| nixpkgs.lib.mkDefault | ||
| self.packages.${pkgs.stdenv.hostPlatform.system}.default; | ||
| }; | ||
| default = self.nixosModules.hypercolor; | ||
| }; | ||
|
|
||
| checks = forEachSystem ( | ||
| system: | ||
| let | ||
| # Evaluate the module against a minimal host and build only the | ||
| # user unit, so `nix flake check` proves the options and the unit | ||
| # text without assembling a whole system closure. | ||
| host = nixpkgs.lib.nixosSystem { | ||
| inherit system; | ||
| modules = [ | ||
| self.nixosModules.default | ||
| { | ||
| services.hypercolor = { | ||
| enable = true; | ||
| input.allDevices = true; | ||
| extraArgs = [ | ||
| "--log-level" | ||
| "debug" | ||
| ]; | ||
| }; | ||
| fileSystems."/" = { | ||
| device = "/dev/null"; | ||
| fsType = "ext4"; | ||
| }; | ||
| boot.loader.grub.enable = false; | ||
| system.stateVersion = "25.05"; | ||
| } | ||
| ]; | ||
| }; | ||
| pkgs = pkgsFor system; | ||
| hypercolor = self.packages.${system}.default; | ||
| unit = host.config.systemd.user.units."hypercolor.service".unit; | ||
| in | ||
| { | ||
| package = hypercolor; | ||
| module = | ||
| assert builtins.elem hypercolor host.config.services.udev.packages; | ||
| assert builtins.elem "i2c-dev" host.config.boot.kernelModules; | ||
| assert builtins.elem "default.target" host.config.systemd.user.services.hypercolor.wantedBy; | ||
| pkgs.runCommand "hypercolor-module-check" { } '' | ||
| unit=${unit}/hypercolor.service | ||
| grep -q -- "--ui-dir ${hypercolor}/share/hypercolor/ui" "$unit" | ||
| grep -q -- "--effects-dir ${hypercolor}/share/hypercolor/effects/bundled" "$unit" | ||
| grep -q -- "--log-level debug" "$unit" | ||
| grep -q "^ProtectSystem=strict" "$unit" | ||
| grep -q 'HYPERCOLOR_LOG=info' "$unit" | ||
| touch $out | ||
| ''; | ||
| } | ||
| ); | ||
| }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.