Hai questo problema, diciamo che test/shell.nix sia:
{ pkgs ? import <nixpkgs> {} }:
with pkgs; mkShell { buildInputs = [ pkgs.hello ]; }
tu fai:
> cd test
test> hello
The program ‘hello’ is currently not installed. It is provided by
several packages. You can install it by typing one of the following:
nix-env -iA nixos.hello
nix-env -iA nixos.mbedtls
nix-env -iA nixos.perkeep
test> nix-shell
test (nix-shell)> hello
hello, world
test (nix-shell)> emacs .
-------- dentro emacs --------
M-x shell
> hello
The program ‘hello’ is currently not installed. It is provided by
several packages. You can install it by typing one of the following:
nix-env -iA nixos.hello
nix-env -iA nixos.mbedtls
nix-env -iA nixos.perkeep
In tal caso potresti essere interessato a direnv. Devi:
- installare
direnvnel tuo/etc/nixos/configuration.nix. - aggiungere l’hook nella tua
$SHELLcome qui. - nella tua configurazione privata di
doom-emacs(SPC f p) nel fileinit.elattivadirenv(sotto:tools).
Ora crea il file test/.envrc contenente:
use_nix
dai, in test, il comando
direnv allow
ora apri emacs. Se lavori su un qualunque file nella directory test, emacs
leggerà la configurazione di direnv, impostata in questo caso per leggere
nix-shell, quindi se parti una shell M-x shell avrai il comando disponibile.
ps. emacs aprilo normalmente, non hai bisogno di partirlo dalla nix-shell