howto:languages
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howto:languages [2023/07/29 11:22] – tcmal | howto:languages [2024/02/23 11:05] (current) – tcmal | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | If you want to run some code you wrote, you probably need some language or runtime to do so - eg Python, GCC, Haskell. | + | If you want to run some code you wrote, you probably need some language or runtime to do so - eg Python, GCC, Haskell. |
- | This lets us use older versions when we need to, and means you don't have to wait for an admin to install something | + | Nix is able to do a lot more things, but for most cases you can use it like so: |
- | ===== Installing asdf ===== | + | < |
+ | # install ' | ||
+ | $ nix profile install nixpkgs# | ||
+ | $ hello | ||
+ | Hello, world! | ||
+ | # it works! | ||
- | asdf gets installed | + | # see everything |
+ | $ nix profile list | ||
+ | 0 flake: | ||
- | First, download it with '' | + | # uninstall |
+ | $ nix profile remove 0 | ||
+ | removing ' | ||
+ | </ | ||
- | Then, make sure we load it whenever we login by doing '' | + | To search for packages, go [[https://search.nixos.org/packages|here]]. |
- | We can also get completions by doing '' | + | We're using a super small subset of what Nix can do here. It's also able to do things like per-project environments, |
- | Now we can load it in our current session by doing '' | + | * [[https:// |
+ | * [[https:// | ||
+ | * [[https:// | ||
- | ===== Installing some plugins | + | ===== Alternatives |
- | To deal with all the different languages | + | The language versions that Nix can install might not be the ones you want, or it might be missing |
- | You can see a full list of plugins | + | * Rust has [[https:// |
+ | * Node.JS has [[https:// | ||
+ | * Ruby has [[https:// | ||
+ | * [[https://asdf-vm.com/|asdf]] supports many other languages | ||
+ | * You can just compile it from source | ||
- | Install it with '' | + | If you're having problems, feel free to ask an admin. |
- | + | ||
- | ===== Installing NodeJS ===== | + | |
- | + | ||
- | Now we have the nodejs plugin, we can list all the versions with '' | + | |
- | + | ||
- | To try it out, let's install a specific version of Nodejs - run '' | + | |
- | + | ||
- | If you try to run '' | + | |
- | + | ||
- | ===== Local overrides ===== | + | |
- | + | ||
- | We set nodejs as a global default in the previous step, but suppose we have one project that runs an old version and one that needs a newer one. | + | |
- | + | ||
- | For this, we can use local overrides. If you run '' | + |
howto/languages.1690629763.txt.gz · Last modified: 2023/07/29 11:22 by tcmal