diff --git a/examples/shell-environments/README.md b/examples/shell-environments/README.md new file mode 100644 index 0000000..a5d81e8 --- /dev/null +++ b/examples/shell-environments/README.md @@ -0,0 +1,28 @@ +# shell-environment + +This example shows how to create a shell environment which +includes a diverse set of tools: + +``` +terraform +wget +bat +git +``` + +You can search for more package in [nix packages](https://search.nixos.org/packages) + +## Usage + +The [`devShells` option](https://flake.parts/options/flake-parts.html#opt-perSystem.devShells) is used by the following command: + +```sh +nix develop +``` + +You can have as many shells as you want, in this [flake.nix](./flake.nix), you also have +`another_env` which includes `curl`. To open it: + +```sh +nix develop .#another_env +``` \ No newline at end of file diff --git a/examples/shell-environments/flake.nix b/examples/shell-environments/flake.nix new file mode 100644 index 0000000..298579c --- /dev/null +++ b/examples/shell-environments/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Description for the project"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; + perSystem = { config, self', inputs', pkgs, system, ... }: { + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ terraform wget bat git ]; + }; + + devShells.another_env = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ curl ]; + }; + }; + + }; +}