Skip to content

tiltfive: init at 1.3.2#236695

Open
q3k wants to merge 2 commits intoNixOS:masterfrom
q3k:q3k/tiltfive
Open

tiltfive: init at 1.3.2#236695
q3k wants to merge 2 commits intoNixOS:masterfrom
q3k:q3k/tiltfive

Conversation

@q3k
Copy link
Copy Markdown
Member

@q3k q3k commented Jun 8, 2023

Tilt Five™ Glasses are an AR headset.

This packages its driver (control panel, service) and SDK. It also implements a NixOS module which installs the driver.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 23.11 Release Notes (or backporting 23.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.

Fixes: #235734
Fixes: #235736

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` labels Jun 8, 2023
Copy link
Copy Markdown

@khunt-tiltfive khunt-tiltfive left a comment

Choose a reason for hiding this comment

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

Hope you don't mind a couple of comments inline. I'm not familiar with Nix, so I've not considered that side of things.

(Disclaimer - I work for Tilt Five, but my comments here don't represent an official position or any kind of endorsement).

@khunt-tiltfive
Copy link
Copy Markdown

My comments have been resolved, thank you. Cursory inspection looks ok, but I'm not qualified to comment on nix things.
(Disclaimer - I work for Tilt Five, but my comments here don't represent an official position or any kind of endorsement).

@q3k
Copy link
Copy Markdown
Member Author

q3k commented Jun 8, 2023

@ofborg build tiltfive-control-panel tiltfive-driver tiltfive-sdk
@ofborg test tiltfive

@q3k
Copy link
Copy Markdown
Member Author

q3k commented Jun 8, 2023

Ah, it seems like OfBorg refuses to build/test unfree packages?

@q3k
Copy link
Copy Markdown
Member Author

q3k commented Jun 8, 2023

@ofborg eval

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jun 8, 2023
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
with lib;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There's a bunch of mkXXX calls in there. Why is this with lib; a problem? Should it be nested somewhere deeper? Should I use lib.mkXXX explicitly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

with is an anti-pattern too ingrained in old code. Indeed I am cleaning up this mess, and it is hard as hell.

Why is this with lib; a problem?

  1. with works in a similar manner of #include <> from C language, bringing to the scope of your code a whole bunch of things you are not using. This is not so harmful in Nix because it uses lazy evaluation, however it can be a pain for static analysis, and can be worse if you accidentally invokes a functionality from it.
  2. with works in unexpected ways when used more than once.
  3. its scoping rules are obscure: Scoping is unintuitive nix#490

Should I use lib.mkXXX explicitly?

Yes.

Another less verbose alternative is to substitute from with lib; to inherit (lib) mkXXX mkXXY mkXXZ . . .;

(Usually @SuperSandro2000 prefers the explicit lib. usage, but I have no strong opinions between the options above.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another less verbose alternative is to substitute from with lib; to inherit (lib) mkXXX mkXXY mkXXZ . . .;

where you need to maintain a list of used functions which is also not that great.

Comment on lines 28 to 41
Copy link
Copy Markdown
Member

@AndersonTorres AndersonTorres Jun 12, 2023

Choose a reason for hiding this comment

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

Suggested change
dest=$out/opt/tiltfive/control-panel
pushd opt/tiltfive/control-panel
mkdir -p $dest/data
cp -r data/* $dest/data/
mkdir -p $dest/lib
install -Dm755 lib/* $dest/lib/
install -Dm755 control_panel $dest/
popd
dest=$out/opt/tiltfive/control-panel
pushd opt/tiltfive/control-panel
mkdir -p $dest/data $dest/lib
cp -r data/* $dest/data/
install -Dm755 lib/* $dest/lib/
install -Dm755 control_panel $dest/
popd

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I spersonally find the version with whitespace more readable. Is there a concrete style recommendation to avoid newlines in this case?

Copy link
Copy Markdown
Member

@AndersonTorres AndersonTorres Jun 14, 2023

Choose a reason for hiding this comment

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

nope.



but using two white lines makes no sense

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do not parameterize pname

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nixpkgs $ grep -r '{pname}.desktop' | wc -l
90

This seems to be a fairly common pattern in nixpkgs. Is there a concrete style recommendation against this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be a fairly common pattern in nixpkgs.

That doesn't mean anything since there is lots of code which wasn't touched in a good amount of time and should be updated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, but what is the reason to not do this? I'll gladly change things around, but I'd prefer to know what is the reasoning behind this so that I can then explain the same thing to others :).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pname could be changed with a prefix which does not break with rec but with finalAttrs. Also it increases code complexity and pname does not change often.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be a fairly common pattern in nixpkgs. Is there a concrete style recommendation against this?

90 occurrences in a codebase of 80k+ packages? This is not "fairly common".

Right, but what is the reason to not do this?

  1. it creates a useless dependency link, making static debugging a little more difficult.
  2. sometimes pname is not perfectly parameterizable. E.g. the GitHub repository of openmsx is openMSX/openMSX. What we should do? Pass it under a obfuscated combination of string splitting?
  3. being effectively a constant, using pname makes no real difference to understand the code. It is just harder to read and conveys nothing useful.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be a fairly common pattern in nixpkgs.

That doesn't mean anything since there is lots of code which wasn't touched in a good amount of time and should be updated.

description = "Tilt Five™ Glasses SDK";
homepage = "https://docs.tiltfive.com/index.html";
# Non-redistributable. See: license_sdk_en.txt, 2.1.2.
license = with licenses; unfree;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
license = with licenses; unfree;
license = licenses.unfree;

@h7x4 h7x4 added 8.has: module (new) This PR adds a module in `nixos/` 8.has: tests This PR has tests labels Oct 19, 2023
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
in
{
options.hardware.tiltfive = {
enable = mkEnableOption (lib.mdDoc "tiltfive driver and service");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tilt Five

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 14, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 8.has: tests This PR has tests 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package request: Tilt Five SDK Package request: Tilt Five Driver

7 participants