- Nix 64.5%
- Python 24.8%
- Shell 10.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| docs | ||
| flake.nix | ||
| pk-catalog-curated.tsv | ||
| pk-catalog-merge.py | ||
| pk-catalog.nix | ||
| pk-fork-package.nix | ||
| pk-managed-helper.sh | ||
| pk-managed-policy | ||
| pk-managed.nix | ||
| README.md | ||
packagekit-flake
PackageKit option 1 for NixOS: a forked PackageKit daemon with a Nix
backend, plus a managed-helper NixOS module. It lets a GUI "install/remove"
action (for example from KDE Discover) land on the declarative system: the action
edits a small JSON file and runs nixos-rebuild, producing a normal, rollback-able
NixOS generation with no drift outside the Nix store.
This flake is the reusable Nix glue. It is hosted under the Public org so a
consumer's root can fetch it over anonymous HTTPS with no deploy key.
Outputs
nixosModules.default(aliasnixosModules.packagekit) — thepk-managed.nixmodule. It installs the fork daemon, setsDefaultBackend=nix, writesPackageKit.conf/Vendor.conf, registers thepk-managed-install/pk-managed-removeCLI wrappers and their polkit actions, and exposespk-nix-managed-helper.overlays.default— overridespackagekitwith the fork package.packages.<system>.packagekit— the fork package by itself (the module uses this internally viacallPackage ./pk-fork-package.nix).
The module reaches its siblings (pk-fork-package.nix, pk-managed-helper.sh,
pk-managed-policy) by relative path, so the flake is self-contained: just add
packagekit.nixosModules.default to your nixosSystem modules.
Files
| File | Role |
|---|---|
pk-managed.nix |
NixOS module (the public interface). |
pk-fork-package.nix |
Builds packagekit-1.4.0-pk-option1 via builtins.fetchGit of the fork daemon repo (branch option1-1.4.0), with -Dpackaging_backend=nix. |
pk-managed-helper.sh |
Privileged helper for install/remove/status: validates the attribute path, edits the managed packages.json, and rebuilds with rollback. |
pk-managed-policy |
polkit actions ca.randomrepair.pk-managed.install / .remove. |
The daemon source is separate
No C/C++ lives in this flake. pk-fork-package.nix does a builtins.fetchGit of
the forked daemon repo RandomRepair/PackageKit (branch option1-1.4.0). That repo
is private; a host that builds it needs whatever credential that fetch uses (a
deploy key). This flake's hosting in the Public org only governs how the flake
itself is fetched.
Host glue stays out of this flake
How the helper rebuilds the system — reading a host-specific packages.json at an
absolute path and resolving it into environment.systemPackages — is intentionally
left to the consuming config (a managed-packages.nix on that host). This flake
stays generic and reusable.
Request flow
KDE Discover -> packagekitd (fork, DefaultBackend=nix)
-> polkit ca.randomrepair.pk-managed.install|remove (AUTH_ADMIN_KEEP)
-> pk-managed-install / pk-managed-remove (CLI wrappers)
-> pk-nix-managed-helper install|remove <attr>
1. flock to serialize
2. nix eval nixpkgs#<attr>.pname (validate)
3. edit the host's packages.json
4. nixos-rebuild switch
-> host's managed-packages.nix resolves packages.json into systemPackages
-> new NixOS generation (or rollback on failure)
Pinning consequence for consumers
A consumer that rebuilds with --no-write-lock-file (as the helper does) uses the
packagekit rev pinned in its flake.lock. Update this flake and a consumer picks
it up only after running nix flake update packagekit there and deploying. Keep the
lockfile tracked; a new input that is not git-tracked breaks flake eval.