From e5a1d5aa68f5ad158405c9bd9780963793229690 Mon Sep 17 00:00:00 2001 From: Malte Tammena Date: Sat, 4 Nov 2023 12:08:03 +0100 Subject: [PATCH] Add README.md --- README.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c24f70 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# 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 +```