Closed tomeon closed 1 year ago
FLAKE_ROOT
environment variable before running anything. Otherwise, we're bound to re-implement the heuristic and it will drift over time.I've just pushed some updates:
README.md
and docs/flake-app.md
covering running devshells as Nix applications.devshell.prj_root_fallback
for controlling the last-ditch definition of PRJ_ROOT
if it isn't already defined and non-empty. The default value is whatever PWD
expands to, which may run afoul of the concern that "the heuristic [...] will drift over time" -- devshell.prj_root_fallback
also supports being set to null
for signifying "no fallback", and I'm happy to switch to that as the default value. I'll just note that I think nix run 'github:somebody/cool-thing' -- do-cool-thing
is a nicer experience than nix run 'github:somebody/cool-thing' -- --prj-root "$PWD" -- do-cool-thing
(or bailing out if --prj-root
is absent and PRJ_ROOT
is empty or unset).Edit: I also broke some stuff, but it's fixed now :)
Build succeeded!
The publicly hosted instance of bors-ng is deprecated and will go away soon.
If you want to self-host your own instance, instructions are here. For more help, visit the forum.
If you want to switch to GitHub's built-in merge queue, visit their help page.
I was poking at a
devshell
derivation innix repl
recently when I noticed itsflakeApp
attribute. This is a cool feature! I would love to be able tonix run '.#my-devshell' -- <command>
and access commands from my devshell without having to first enter anix develop
sesson. It looks like theflakeApp
definition needs some updates to account fordevshell.nix
refactors; this PR is my attempt to apply those updates. It also adds some convenience features, like a CLI option for specifying the project root path.Have a few questions I'd like to resolve before removing "Draft" status from this PR:
flakeApp
/nix run
, where would you like me to document it? I took a look at the files in./docs
and nothing jumped out as an appropriate spot.PRJ_ROOT
when running the devshell entrypoint as a flake app? Seems likePRJ_ROOT
should refer to the flake's root directory? For instance, maybe a devshell command references files in the flake by expanding them relative toPRJ_ROOT
. UsingPWD
asPRJ_ROOT
in this circumstance might work, as long asPWD
is the working tree toplevel of the git repository for the flake providing the devshell. But it almost certainly wouldn't work if trying tonix run 'some-other-flake#devshell-flake-app'
. On the hand, maybe there are also cases wherePRJ_ROOT
should refer to (say) the current working directory -- for instance, maybe I want to run a linting command provided by a "foreign" flake, and that command searches for files that live underPRJ_ROOT
.apps.<system>.devshell
, as a kind of demo of theflakeApp
feature. Is this worthwhile? If so, should it be advertised somehow (in the README, or elsewhere)?Thanks!