Skip to content

Add Nix flake for NixOS/nix-based builds#34

Closed
vinylen wants to merge 1 commit intolevel1techs:mainfrom
vinylen:nixos-flake
Closed

Add Nix flake for NixOS/nix-based builds#34
vinylen wants to merge 1 commit intolevel1techs:mainfrom
vinylen:nixos-flake

Conversation

@vinylen
Copy link
Copy Markdown
Contributor

@vinylen vinylen commented Mar 26, 2026

Adds flake.nix and flake.lock so siomon can be built and used on NixOS or any system with Nix, without manual setup.

Flake outputs

Output Description
packages.{x86_64,aarch64}-linux.default The sio binary
packages.{x86_64,aarch64}-linux.sinfo-io-kmod sinfo_io.ko against the default nixpkgs kernel
overlays.default Adds pkgs.siomon to a nixpkgs instance
lib.{system}.mkSinfoIoKmod Factory to build sinfo_io.ko against any kernel

Usage

Run without installing:

nix run github:level1techs/siomon

Use the overlay in a NixOS or home-manager config:

nixpkgs.overlays = [ inputs.siomon.overlays.default ];

Notes

  • cargoLock.lockFile = ./Cargo.lock is used instead of cargoHash,
    so no hash needs updating when dependencies change.
  • nixpkgs-unstable is required; Rust ≥ 1.85 is not yet
    in a stable nixpkgs channel.

Flake maintenance

Maintenance of flake is minimal since only version string is required to match the Cargo.toml version

Adds flake.nix and the generated flake.lock so siomon can be built,
installed, and integrated on NixOS (or any system with Nix) without
manual setup.
@vinylen
Copy link
Copy Markdown
Contributor Author

vinylen commented Mar 26, 2026

I just saw that we already have a nixpkgs version.. https://search.nixos.org/packages?channel=unstable&query=siomon&show=siomon

Closing this :)

@vinylen vinylen closed this Mar 26, 2026
@emansom
Copy link
Copy Markdown
Contributor

emansom commented Mar 26, 2026

Hey @vinylen, thanks for putting this together! Nice to see NixOS interest.

Just wanted to point you to some existing work around distro packaging:

Our target is to follow the way each distro officially manages and distributes packages through its own package manager and repositories. For NixOS, that means upstreaming to Nixpkgs — the central package set that nix and NixOS pull from — rather than maintaining a flake in-tree (see the Nixpkgs manual).

What we'd love is an automated GitHub Actions workflow — similar to the AUR and PPA ones — that opens a PR against Nixpkgs from a temporary branch on each release. The approach would follow the same pattern from PR #24: a templated packaging/nix/flake.nix with placeholder values (version, hash, etc.) that the workflow sed-substitutes with actual release values, pushes to a temporary branch, and opens a PR against Nixpkgs. Same idea as how the AUR workflow substitutes pkgver/_tag/pkgrel into the PKGBUILD template, or the PPA workflow rewrites debian/changelog and debian/control.

Some prior art and tooling around automated Nixpkgs contributions that might be useful:

Would you be up for taking a stab at that kind of workflow? Would be great to have Nix covered alongside AUR and PPA!

@emansom
Copy link
Copy Markdown
Contributor

emansom commented Mar 26, 2026

I just saw that we already have a nixpkgs version.. https://search.nixos.org/packages?channel=unstable&query=siomon&show=siomon

Closing this :)

Hey @sheevy, thanks for getting siomon into Nixpkgs (NixOS/nixpkgs#501034) — that's awesome!

Since you're already familiar with the Nixpkgs contribution process, would you be interested in contributing an automated GitHub Actions workflow that keeps the Nixpkgs package up to date on new siomon releases?

As described above, the idea is to follow the same pattern we're setting up for AUR and PPA (derived from PR #24): a templated packaging/nix/flake.nix with placeholder values that the workflow sed-substitutes with actual release values, pushes to a temporary branch, and opens a PR against Nixpkgs automatically.

Some tooling and context that might be helpful:

You'd be the perfect person for this since you already know how the package is structured in Nixpkgs. Would love to have you on board!

@vinylen
Copy link
Copy Markdown
Contributor Author

vinylen commented Mar 26, 2026

I think that auto updating for siomon in nixpkgs is already implemented by the maintainer - https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/si/siomon/package.nix#L27

@sheevy
Copy link
Copy Markdown
Contributor

sheevy commented Mar 26, 2026

Hey @emansom

As far as I understand, my original PR already handles that, see my comments:
NixOS/nixpkgs#501034 (comment)
NixOS/nixpkgs#501034 (comment)

@emansom
Copy link
Copy Markdown
Contributor

emansom commented Mar 26, 2026

I think that auto updating for siomon in nixpkgs is already implemented by the maintainer - https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/si/siomon/package.nix#L27

Hey @emansom

As far as I understand, my original PR already handles that, see my comments: NixOS/nixpkgs#501034 (comment) NixOS/nixpkgs#501034 (comment)

Oh very meta. Very interesting. Even better! Apologies, I should've researched a bit more before. Let's see if that works on the next tagged version!

emansom added a commit to emansom/siomon that referenced this pull request Mar 28, 2026
level1techs#34
NixOS/nixpkgs#501034

Co-authored-by: vinylen <victor@viclab.me>
Co-authored-by: sheevy <mw.kubica@gmail.com>
emansom added a commit to emansom/siomon that referenced this pull request Mar 30, 2026
level1techs#34
NixOS/nixpkgs#501034

Co-authored-by: vinylen <victor@viclab.me>
Co-authored-by: sheevy <mw.kubica@gmail.com>
@emansom
Copy link
Copy Markdown
Contributor

emansom commented Apr 5, 2026

Let's see if that works on the next tagged version!

Yep, automation works. Cool!

NixOS/nixpkgs#505942

@sheevy
Copy link
Copy Markdown
Contributor

sheevy commented Apr 5, 2026

Indeed, but it took a while.
According to Nix folks they are not opposed to having our own automation. However, it would require involving a someone with commit rights to nixpkgs, while having their bot making a PR is lighter, and only a maintainer is required.
So for now I would stick with the existing setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants