nushell / nufmt

MIT License
64 stars 8 forks source link

Revert "Add direnv (#44)" #50

Closed amtoine closed 10 months ago

amtoine commented 10 months ago

related to

Important should be superseded by a PR from @IogaMaster soon (see this comment)

Description of changes

this PR reverts #44.

without any justification for this, i'd rather revert the changes :yum:

IogaMaster commented 10 months ago

Direnv allows automatic environment setup, not just for nix. I did notice you had a setup script, this could run that script automatically on entering the project directory.

amtoine commented 10 months ago

so direnv would run the content of .envrc automatically, right?

but then what would use flake do? is that Nushell code? do you need to be on NixOS to have all this working?

IogaMaster commented 10 months ago

use flake is a hook that is part of nix-direnv. It automatticaly runs nix develop and a does a few things to integrate the devshell into the env. We could wrap that with a check that would see if you have nix installed.

IogaMaster commented 10 months ago

do you need to be on NixOS to have all this working?

Just have nix installed and flakes enabled.

IogaMaster commented 10 months ago

is that Nushell code?

No its regular shell code. I think we could #!/usr/bin/env nu to make it run nushell code.

AucaCoyan commented 10 months ago

Direnv allows automatic environment setup, not just for nix

Correct, but bear in mind that direnv works on *sh shells, and we kinda are in a new shell project From the direnv homepage

It supports hooks for all the common shells like bash, zsh, tcsh and fish source

Is it possible to transcode .envrc to nushell compatible? so we all have the benefit. It feels awkward to have personal config files (like .vscode or .idea folders), and even more if some OSes are cut out

The other possible approach would be put in an if that checks if you're on Nix?

IogaMaster commented 10 months ago

The other possible approach would be put in an if that checks if you're on Nix?

That was what I was planning after the splitting of lib and bin

amtoine commented 10 months ago

That was what I was planning after the splitting of lib and bin

that's great and sounds like the best compromise

  • adding support for nix direnv
  • don't break other folks using direnv but not nix

:ok_hand:

i'll leave that PR open for now, just as a reminder to update the .envrc script :wink: and i'll go ahead and update the PR description to mention that!

amtoine commented 10 months ago

https://github.com/nushell/nufmt/pull/54 did land and will supersede this PR :+1: