dev/README.md
2023-11-04 12:12:32 +01:00

2.7 KiB

Development environments

Powered with Nix ❄️ , Nix Flakes, and direnv. 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

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

nix develop git+https://git.tammena.me/megamanmalte/dev?ref=main#nix

See below for other shell options.

Templates

Rust 🦀

Initialize a new Rust project with either

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

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

  .
 ├──  .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

rename YOUR_NEW_COOL_PROJECT_NAME

Output Tree

nix flake show:

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