mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
docs: add examples folder
This commit is contained in:
parent
93292ab70a
commit
a530cce721
2 changed files with 50 additions and 0 deletions
28
examples/shell-environments/README.md
Normal file
28
examples/shell-environments/README.md
Normal file
|
@ -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
|
||||
```
|
22
examples/shell-environments/flake.nix
Normal file
22
examples/shell-environments/flake.nix
Normal file
|
@ -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 ];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue