Skip to content

beszel: fix testing compilation and darwin issues#513197

Open
arunoruto wants to merge 2 commits intoNixOS:masterfrom
arunoruto:beszel-pkg
Open

beszel: fix testing compilation and darwin issues#513197
arunoruto wants to merge 2 commits intoNixOS:masterfrom
arunoruto:beszel-pkg

Conversation

@arunoruto
Copy link
Copy Markdown
Contributor

@arunoruto arunoruto commented Apr 24, 2026

The testing tag introduces a problem where the internal/hub/systems/systems_test_helpers.go file is being compiled, which should be a moc file for testing, instead of the actual file systems_production.go. By removing the testing tag and just adding it to the checkFlags variable, this should be solved.

Resolves: #510220

Darwin tries to run the GPU tests, which fails, since most of the utilities needed are not available for darwin systems (nvidia and amd). We skip those tests just for the darwin systems.
Darwin has also a weird behaviour where a racing condition is happening. To solve this, we need to introduce a small defer statement in the function which causing the racing condition.

Resolves: #512864

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

The `testing` tag was interfering with SMART data collection in sertain
scenarios according to NixOS#512864.
Since the tag isn't needed, removing it should solve this problem.
Darwin doesn't support Nvidia and AMD GPU utilities, so such test should
be skipped.

While building on darwin a racing condition is happening.
To solve this, we add the following line to the
`internal/hub/systems/system.go` file:
```go
defer func() { recover() }();
```
@arunoruto arunoruto requested a review from BonusPlay April 24, 2026 22:16
@nixpkgs-ci nixpkgs-ci Bot requested a review from Bot-wxt1221 April 24, 2026 22:21
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Apr 24, 2026
@ofborg ofborg Bot added the 6.topic: darwin Running or building packages on Darwin label Apr 25, 2026
@BonusPlay
Copy link
Copy Markdown
Member

A friend of mine has suggested following things instead of patching the code:

  1. __darwinAllowLocalNetworking = true;
  2. Add following tests to the exclusion:
skippedTests = [
      "TestCollectorStartHelpers"
      "TestConfigSyncWithTokens"
      "TestApiRoutesAuthentication"
      "TestNewGPUManager"
    ]

@arunoruto
Copy link
Copy Markdown
Contributor Author

  1. __darwinAllowLocalNetworking = true;

I tried it but I am still getting:

beszel> panic: runtime error: invalid memory address or nil pointer dereference
beszel> [signal SIGSEGV: segmentation violation code=0x2 addr=0xb0 pc=0x1007db5b0]
beszel>
beszel> goroutine 39250 [running]:
beszel> github.com/pocketbase/pocketbase/core.(*BaseApp).RecordQuery(0x4e4027620708, {0x101dbdee0?, 0x4e40278c6908?})
beszel>         /nix/var/nix/builds/nix-11741-2322230898/source/vendor/github.com/pocketbase/pocketbase/core/record_query.go:38 +0x70
beszel> github.com/pocketbase/pocketbase/core.(*BaseApp).FindRecordById(0x4e4027620708, {0x101c335e0?, 0x101df26b0?}, {0x4e40276241f0, 0xf}, {0x0, 0x0, 0x1009662e8?})
beszel>         /nix/var/nix/builds/nix-11741-2322230898/source/vendor/github.com/pocketbase/pocketbase/core/record_query.go:223 +0x78
beszel> github.com/henrygd/beszel/internal/hub/systems.(*System).getRecord(0x4e4027998a80, {0x101e22aa8?, 0x4e4027996000?})
beszel>         /nix/var/nix/builds/nix-11741-2322230898/source/internal/hub/systems/system.go:348 +0x50
beszel> github.com/henrygd/beszel/internal/hub/systems.(*System).setDown(0x4e4027998a80, {0x101df9e00, 0x4e4027573ae0})
beszel>         /nix/var/nix/builds/nix-11741-2322230898/source/internal/hub/systems/system.go:373 +0xc4
beszel> github.com/henrygd/beszel/internal/hub/systems.(*System).StartUpdater(0x4e4027998a80)
beszel>         /nix/var/nix/builds/nix-11741-2322230898/source/internal/hub/systems/system.go:89 +0xc4
beszel> created by github.com/henrygd/beszel/internal/hub/systems.(*SystemManager).AddSystem in goroutine 38496
beszel>         /nix/var/nix/builds/nix-11741-2322230898/source/internal/hub/systems/system_manager.go:255 +0x17c
beszel> FAIL    github.com/henrygd/beszel/internal/alerts       68.499s
beszel> FAIL

But it seems like the problem does appear upstream and should be fixed with this PR: henrygd/beszel#1951

Copy link
Copy Markdown
Member

@BonusPlay BonusPlay left a comment

Choose a reason for hiding this comment

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

I guess we could merge this one (I'd just add comment on the patchPhase with link to the upstream PR)

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 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: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

beszel: Beszel Hub doesn't collect S.M.A.R.T. data Build failure: beszel

2 participants