Skip to content

Commit a9ba3ec

Browse files
authored
Add shell.nix example to README
1 parent cb1626f commit a9ba3ec

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,22 @@ I want to run a program called `foo`. When I run `./foo` it complains I don't ha
1717

1818
Now it complains I don't have asciidoc so I come out of the shell and edit the last command to add asciidoc by running `nix-shell -p python asciidoc`. Now it works.
1919

20-
I exit my shell and change `nix-shell -p python asciidoc` to `nix-shellify -p python asciidoc`. It then creates a `shell.nix` which I keep next to foo. Now I can just type `nix-shell` and I have what I need to run foo. I can share and everybody else can run foo too without the same search. They also don't need to run it in a conatainer or VM or to maintain depenencies on their system themself.
20+
I exit my shell and change `nix-shell -p python asciidoc` to `nix-shellify -p python asciidoc`. It then creates a `shell.nix` which I keep next to foo. It looks like this:
21+
22+
```nix
23+
{ pkgs ? import <nixpkgs> {} }:
24+
25+
pkgs.mkShell {
26+
27+
buildInputs = [
28+
pkgs.asciidoc
29+
pkgs.python
30+
];
31+
32+
}
33+
```
34+
35+
Now I can just type `nix-shell` and I have what I need to run foo. I can share and everybody else can run foo too without the same search. They also don't need to run it in a conatainer or VM or to maintain depenencies on their system themself.
2136

2237
## Example usage with flakes
2338

0 commit comments

Comments
 (0)