# 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 ```