82 lines
2.7 KiB
Markdown
82 lines
2.7 KiB
Markdown
|
# Development environments
|
||
|
|
||
|
Powered with [Nix ❄️ ](https://nixos.org/), [Nix Flakes](https://nixos.wiki/wiki/Flakes), and [direnv](https://direnv.net/). Only usefull if you have Nix installed.
|
||
|
|
||
|
## Shells
|
||
|
A few custom development shells are available. Use with
|
||
|
|
||
|
### direnv
|
||
|
Create a .envrc file with the following contents to use a generic `nix`-shell
|
||
|
```text
|
||
|
use flake git+https://git.tammena.me/megamanmalte/dev?ref=main#nix
|
||
|
```
|
||
|
*See below for other shell options.*
|
||
|
|
||
|
### nix develop
|
||
|
Simply run the following to enter a generic nix shell
|
||
|
```shell
|
||
|
nix develop git+https://git.tammena.me/megamanmalte/dev?ref=main#nix
|
||
|
```
|
||
|
*See below for other shell options.*
|
||
|
|
||
|
## Templates
|
||
|
|
||
|
### Rust 🦀
|
||
|
Initialize a new [Rust](https://www.rust-lang.org/) project with either
|
||
|
```shell
|
||
|
nix flake new NEW_PROJECT_DIR -t git+https://git.tammena.me/megamanmalte/dev?ref=main#rust
|
||
|
```
|
||
|
to create a new directory NEW_PROJECT_DIR.
|
||
|
Or run
|
||
|
```shell
|
||
|
nix flake init -t git+https://git.tammena.me/megamanmalte/dev?ref=main#rust
|
||
|
```
|
||
|
to create the template inside the current directory
|
||
|
|
||
|
The layout is as follows
|
||
|
```text
|
||
|
.
|
||
|
├── .envrc
|
||
|
│ To load the defined shell, in case you run direnv
|
||
|
├── .gitignore
|
||
|
├── Cargo.lock
|
||
|
├── Cargo.toml
|
||
|
├── flake.lock
|
||
|
├── flake.nix
|
||
|
│ Heart of the repo, defines a development shell and a package, try `nix flake show`
|
||
|
├── nix
|
||
|
│ └── packages
|
||
|
│ └── change-my-name.nix
|
||
|
│ The package definitions, try `nix run`, it will build this package
|
||
|
└── src
|
||
|
│ YOUR future code lives here
|
||
|
└── main.rs
|
||
|
```
|
||
|
|
||
|
After running either of the above commands, you will probably want to rename your project
|
||
|
```shell
|
||
|
rename YOUR_NEW_COOL_PROJECT_NAME
|
||
|
```
|
||
|
|
||
|
## Output Tree
|
||
|
`nix flake show`:
|
||
|
```text
|
||
|
dev
|
||
|
├───devShells
|
||
|
│ └───x86_64-linux
|
||
|
│ ├───beste-schule: development environment 'beste.schule'
|
||
|
│ ├───markdown: development environment 'generic-markdown'
|
||
|
│ ├───nix: development environment 'generic-nix'
|
||
|
│ ├───node: development environment 'generic-node'
|
||
|
│ ├───nodeIonic: development environment 'generic-node-+-ionic'
|
||
|
│ ├───nodePhp: development environment 'generic-node-+-php'
|
||
|
│ ├───php: development environment 'generic-php'
|
||
|
│ └───python: development environment 'generic-python'
|
||
|
├───hydraJobs [omitted]
|
||
|
├───packages
|
||
|
│ └───x86_64-linux
|
||
|
│ └───mdpls: package 'mdpls-30761508593d85b5743ae39c4209947740eec92d'
|
||
|
└───templates
|
||
|
└───rust: template: Simple Rust + Nix template
|
||
|
```
|