Skip to content

Nix packaging - #256

Open
Lillecarl wants to merge 1 commit into
dynamist:mainfrom
Lillecarl:nix
Open

Lillecarl wants to merge 1 commit into
dynamist:mainfrom
Lillecarl:nix

Conversation

@Lillecarl

Copy link
Copy Markdown

Packaging phabfive with Nix.
Exposes a flake as well as "traditional Nix" with support for user-supplied nixpkgs instance, nixpkgs from NIX_PATH or the nixpkgs version locked in the flake.

@Lillecarl

Copy link
Copy Markdown
Author

@holmboe I'm open to walking through the complete changeset 1on1 once/if you have a moment to spare :)

Comment thread nix/phabfive.nix Outdated
build-system = [ hatchling ];
dependencies = [
installShellFiles
# deps

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible, and advisable, to get this list fromTOML somehow?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's possible with https://pyproject-nix.github.io/uv2nix I've been packing up https://github.com/dynamist/weav with uv2nix so you'll be able to see the different approaches (It's more complex but it also uses uv.lock to fetch deps which is more correct).

When packaging with the nixpkgs Python builders it's not recommended however.

Comment thread .envrc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this direnv? See T2157 for context and evaluate if this is desirable.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It is direnv, using direnv is absolutely optional (you don't have to install it and you don't have to approve a projects .envrc if you don't want to). It's not possible to get a Nix environment without executing Nix.
Without direnv you can run either "nix-shell" or "nix develop" but IMO they're slightly worse since they force you into a bash subprocess (which is technically good since you get access to Nix bash builder functions) but it's not nice if you're an alternative shell user. (You can hack your way around that by exec'ing $SHELL in shellHook).

I think it's worthwhile to revisit T2157 if we're pivoting towards exploring the world of Nix (direnv is authored by numtide which is a Nix consultancy). Static .env files doesn't work when you bring in Nix.

@Lillecarl
Lillecarl force-pushed the nix branch 3 times, most recently from aad4bb5 to df86bbb Compare July 15, 2026 13:34
@Lillecarl
Lillecarl force-pushed the nix branch 2 times, most recently from a7b575d to e63bef8 Compare August 17, 2026 10:23
@Lillecarl
Lillecarl force-pushed the nix branch 4 times, most recently from 99d9cab to 6a45672 Compare October 2, 2026 08:48
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 1/5

[Low risk] Adds Nix packaging and development environment configuration.

The PR does not appear safe to merge because four previously reported packaging failures remain outstanding.

Findings

  1. P1 Lockfile fallback fails ▶
  2. P1 Development shell gets nested dependencies ▶
  3. P1 Required Python dependencies omitted ▶
  4. P1 Standalone package lacks requests ▶

Summary

Adds Nix flake and traditional-Nix entry points for phabfive, along with package definitions, a development shell, and shell-completion installation.

  • The changes since the previous review are empty.
  • The four previously reported packaging issues remain unchanged.

Reviews (2) · Last reviewed commit: "fix(nix): pin phabricator 0.9.1, whose R..."

Comment thread default.nix Outdated
flake-compatish {
source = ./.;
overrides = {
# override nixpkgs with NIX_PATH if available

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Lockfile fallback fails

If NIX_PATH has no nixpkgs entry, importing shell.nix or default.nix without supplying pkgs forces this <nixpkgs> override and fails during evaluation. It never falls back to the nixpkgs revision in flake.lock, so the traditional-Nix entry point cannot be used in that environment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

flake-compatish forces the fallback in a builtins.tryEval block so if doesn't exist it'll use the nixpkgs pinned in flake.lock

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You're right — I missed that flake-compatish evaluates supplied overrides through builtins.tryEval. The <nixpkgs> override is lazy, so when NIX_PATH has no nixpkgs entry, its evaluation fails inside tryEval; resolveOverride returns null, and evaluation proceeds with the locked nixpkgs node. The fallback works as intended, so this comment is not valid.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

Comment thread nix/shell.nix Outdated
Comment on lines +12 to +14
(python3.withPackages (_: [
phabfive.propagatedBuildInputs
]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Development shell gets nested dependencies

phabfive.propagatedBuildInputs is already a list. Wrapping it in another list passes python3.withPackages a list containing a list, rather than Python packages. Entering the new development shell therefore cannot construct the intended Python environment.

Comment thread nix/phabfive.nix Outdated
Comment on lines +25 to +37
dependencies = [
installShellFiles
# deps
anyconfig
appdirs
inquirerpy
jinja2
phabricator
pyyaml
rich
ruamel-yaml
typer
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Required Python dependencies omitted

This list omits click, requests, urllib3, and the Python 3.10 dependency tomli, all declared as direct runtime dependencies in pyproject.toml. The CLI imports click at startup, including when postInstall runs it to generate completions. If these packages are not supplied transitively, the Nix build fails or installed commands lose functionality; those transitive dependencies are not guaranteed.

Comment thread nix/phabricator.nix Outdated
patches = [ ./patches/python-phabricator-no-pkg-resources.patch ];

build-system = [ setuptools ];
dependencies = [ responses ];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Standalone package lacks requests

The separately exposed phabricator package declares responses here but omits its actual runtime dependency, requests. If a consumer installs this Nix output on its own, it does not receive the dependency phabricator needs to create its HTTP session, even though phabfive may supply it through another route.

pydd reads uv.lock in a recursive-nix planner and builds one node per
package, so the Nix code restates no dependency. phabfive installs from
its sdist, with no dependency group, and its root adds the shell
completions and the agent skill from `phabfive --skill`.

The dev shell installs the dev group from the same lock, with phabfive
editable over the checkout. Its source holds no code, so an edit does
not change its plan. Impure evaluation names the checkout directly.
Pure evaluation has no currentSystem, so a shellHook finds it with git.

flake.nix holds the outputs. default.nix evaluates the same flake with
flake-compatish, in place, and takes nixpkgs from NIX_PATH when it names
one. A local nixidae checkout goes in the gitignored overrides.nix.

The build needs the experimental features flakes, ca-derivations,
dynamic-derivations and recursive-nix, and recursive-nix added to
system-features. nix/README.md gives the settings.

Assisted-By: Claude Opus 5.5

This branch has not been deployed

No deployments
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.

2 participants