Skip to content

lib/services: move portable service infrastructure out of nixos/ - #506519

Merged
roberth merged 2 commits into
NixOS:masterfrom
KiaraGrouwstra:modular-services-portable-move
Apr 5, 2026
Merged

lib/services: move portable service infrastructure out of nixos/#506519
roberth merged 2 commits into
NixOS:masterfrom
KiaraGrouwstra:modular-services-portable-move

Conversation

@KiaraGrouwstra

Copy link
Copy Markdown
Contributor

Move the portable modular service base from nixos/modules/system/service/portable/ to lib/services/, making it importable by any module system (home-manager, nix-darwin, ...) without reaching into the nixos/ tree, given this should not actually depend on NixOS.

No functional changes - only import paths differ.

Precursor to #506343.

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.

Move the portable modular service base from
nixos/modules/system/service/portable/ to lib/services/, making it
importable by any module system (home-manager, nix-darwin) without
reaching into the nixos/ tree.

Moved files: service.nix, lib.nix, config-data.nix, config-data-item.nix,
test.nix. All external references updated (systemd/system.nix,
doc/manual/default.nix, assertions.nix, README.md).

No functional changes - only import paths differ.
@KiaraGrouwstra
KiaraGrouwstra requested a review from roberth April 4, 2026 06:48
@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. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: lib The Nixpkgs function library 8.has: documentation This PR adds or changes documentation labels Apr 4, 2026
Include the moved-out modular service infrastructure into the set of
files to evaluate during the docs build.
This was previously unnecessary because even the portable parts were
stored inside the nixos tree.
@roberth
roberth force-pushed the modular-services-portable-move branch from 4c8665d to 1baf57f Compare April 4, 2026 09:24
@roberth

roberth commented Apr 4, 2026

Copy link
Copy Markdown
Member

Not sure if this should go into lib/, as it's not even really connected to lib proper.

Maybe we should actually carry out the division into multiple "libs" that better reflects the purposes and maintenance models for these things.

Still inclined to merge as that could be figured out and agreed upon later.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 4, 2026
@nixos-discourse

Copy link
Copy Markdown

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

https://discourse.nixos.org/t/prs-already-reviewed/2617/2913

@eveeifyeve eveeifyeve left a comment

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.

I agree with @roberth, However this can be argued later. Apart from that, the rest LGTM/SGTM.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Apr 5, 2026
@baileylu121

Copy link
Copy Markdown
Contributor

It would also be nice if we have a proper attribute to reference for portable-lib instead of a file path we have to manually import, something like lib.portable or the lib division @roberth was talking about, since this change won't be backwards compatible (mind you this only effects a grand total of ~2 non nixpkgs repositories based on a quick github search, so it's not a huge concern)

@eveeifyeve

eveeifyeve commented Apr 5, 2026

Copy link
Copy Markdown
Member

It would also be nice if we have a proper attribute to reference for portable-lib instead of a file path we have to manually import, something like lib.portable or the lib division @roberth was talking about, since this change won't be backwards compatible (mind you this only effects a grand total of ~2 non nixpkgs repositories based on a quick github search, so it's not a huge concern)

This is probably best done in a followup pr, as this seems to be a nitpick more than of a merge blocker.

@roberth
roberth added this pull request to the merge queue Apr 5, 2026
Merged via the queue into NixOS:master with commit f303cb4 Apr 5, 2026
31 of 34 checks passed
@KiaraGrouwstra
KiaraGrouwstra deleted the modular-services-portable-move branch April 5, 2026 20:02
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Apr 5, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
@KiaraGrouwstra

Copy link
Copy Markdown
Contributor Author

It would also be nice if we have a proper attribute to reference for portable-lib instead of a file path we have to manually import, something like lib.portable or the lib division @roberth was talking about, since this change won't be backwards compatible (mind you this only effects a grand total of ~2 non nixpkgs repositories based on a quick github search, so it's not a huge concern)

opened #507052 now for this.
i'm hoping lib.services might help alleviate confusion from the internal 'portable' vs external 'modular' naming, but feedback welcome there...

ilai-deutel pushed a commit to ilai-deutel/nixpkgs that referenced this pull request Apr 6, 2026
ju1m added a commit to ju1m/app-store that referenced this pull request Apr 7, 2026
…astructure

`inputs.nixpkgs` is here updated to the latest commit
of the PR introducing the change:
NixOS/nixpkgs#506519
phanirithvij added a commit to phanirithvij/nimi that referenced this pull request Apr 9, 2026
nixpkgs PR: NixOS/nixpkgs#506519

Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
phanirithvij added a commit to phanirithvij/nimi that referenced this pull request Apr 9, 2026
nixpkgs PR: NixOS/nixpkgs#506519

Co-Authored-By: Luke Bailey <baileylu@tcd.ie>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
phanirithvij added a commit to phanirithvij/nimi that referenced this pull request Apr 9, 2026
nixpkgs PR: NixOS/nixpkgs#506519

Co-Authored-By: Luke Bailey <baileylu@tcd.ie>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
phanirithvij added a commit to phanirithvij/nimi that referenced this pull request Apr 9, 2026
nixpkgs PR: NixOS/nixpkgs#506519

Co-Authored-By: Luke Bailey <baileylu@tcd.ie>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
phanirithvij added a commit to phanirithvij/nimi that referenced this pull request Apr 9, 2026
nixpkgs PR: NixOS/nixpkgs#506519

Co-Authored-By: Luke Bailey <baileylu@tcd.ie>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
phanirithvij added a commit to phanirithvij/nimi that referenced this pull request Apr 9, 2026
nixpkgs PR: NixOS/nixpkgs#506519

Co-Authored-By: Luke Bailey <baileylu@tcd.ie>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
imincik added a commit to ngi-nix/nimi that referenced this pull request Apr 14, 2026
Update nixpkgs version and fix portable-lib path changed in
NixOS/nixpkgs#506519.
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Jul 24, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Jul 25, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Jul 25, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Aug 7, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Aug 30, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this pull request Aug 30, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
BerriJ pushed a commit to BerriJ/nixpkgs that referenced this pull request Sep 6, 2026
Followup to NixOS#506519. Adds `lib.services` so consumers can reference the
portable service infrastructure directly instead of using fragile
relative path imports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants