probar-paquete

Por alguna razón, es posible que quieras probar un paquete antes de instalarlo en tu sistema Linux. Si es así, ¡tienes suerte! Hoy te mostraré cómo hacerlo en Linux usando el administrador de paquetes Nix. Una de las características notables del administrador de paquetes Nix es que permite a los usuarios probar los paquetes sin tener que instalarlos primero. Esto puede ser útil cuando quiera usar una aplicación en particular temporalmente.

Asegúrate de haber instalado el administrador de paquetes Nix primero. Si aún no lo has instalado, consulte la siguiente guía.

Por ejemplo, supongamos que quieres probar tu código C ++. No tiene que instalar GCC. Simplemente ejecuta el siguiente comando:

$ nix-shell -p gcc

Este comando construye o descarga el paquete gcc y sus dependencias, luego lo coloca en un shell Bash donde está presente el comando gcc, todo sin afectar tu entorno normal.

 LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
download-using-manifests.pl: perl: warning: Setting locale failed.
download-using-manifests.pl: perl: warning: Please check that your locale settings:
download-using-manifests.pl: LANGUAGE = (unset),
download-using-manifests.pl: LC_ALL = (unset),
download-using-manifests.pl: LANG = "en_US.UTF-8"
download-using-manifests.pl: are supported and installed on your system.
download-using-manifests.pl: perl: warning: Falling back to the standard locale ("C").
download-from-binary-cache.pl: perl: warning: Setting locale failed.
download-from-binary-cache.pl: perl: warning: Please check that your locale settings:
download-from-binary-cache.pl: LANGUAGE = (unset),
download-from-binary-cache.pl: LC_ALL = (unset),
download-from-binary-cache.pl: LANG = "en_US.UTF-8"

[...]

fetching path ‘/nix/store/6mk1s81va81dl4jfbhww86cwkl4gyf4j-stdenv’...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

*** Downloading ‘https://cache.nixos.org/nar/0aznfg1g17a8jdzvnp3pqszs9rq2wiwf2rcgczyg5b3k6d0iricl.nar.xz’ to ‘/nix/store/6mk1s81va81dl4jfbhww86cwkl4gyf4j-stdenv’...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8324 100 8324 0 0 6353 0 0:00:01 0:00:01 --:--:-- 6373

[nix-shell:~]$

Verifica la versión de GCC:

[nix-shell:~]$ gcc -v
Using built-in specs.
COLLECT_GCC=/nix/store/dyj2k6ch35r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/bin/gcc
COLLECT_LTO_WRAPPER=/nix/store/dyj2k6ch35r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: 
Thread model: posix
gcc version 5.4.0 (GCC)

Ahora, adelante y prueba el código. Una vez que hayas terminado, escribe exit para regresar a tu consola.

[nix-shell:~]$ exit
exit

Una vez que salgas de nix-shell, no puedes usar GCC.

Aquí hay otro ejemplo.

$ nix-shell -p hello

Esto construye o descarga GNU Hello y sus dependencias, luego lo coloca en un shell Bash donde está presente el comando hello, todo sin afectar tu entorno normal:

[nix-shell:~]$ hello
Hello, world!

Escribe exit para regresar a la consola.

[nix-shell:~]$ exit

Ahora prueba si el programa hello está disponible o no.

$ hello 
hello: command not found

Para obtener más detalles sobre el administrador de paquetes Nix, consulta la siguiente guía.

 

Fuente: Original | maslinux

¿Quién está en línea?

Hay 21318 invitados y ningún miembro en línea