Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shell.nix for Nix(OS) users #18

Merged
merged 23 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0f54a00
Add shell.nix for Nix(OS) users
enderger Mar 14, 2021
6a5d20b
Add GitHub action
enderger Mar 14, 2021
3283cd6
Merge pull request #1 from enderger/feature/github-actions
enderger Mar 14, 2021
034288a
Test md modify
enderger Mar 14, 2021
42bc947
Merge branch 'master' of github.com:enderger/lmt
enderger Mar 14, 2021
a9114bd
retangle main[bot]
actions-user Mar 14, 2021
3547a96
Update tangle.yml to only listen for relevant files
enderger Mar 14, 2021
22e6384
Significant refactor as per comments, also finally found context and …
enderger Mar 14, 2021
72acdb6
Add markdown version of shell.nix
enderger Mar 14, 2021
3648f05
Make note in README
enderger Mar 14, 2021
a2e9a9e
Add a bit more to the Nix shell markdown
enderger Mar 14, 2021
b86ffa6
Small formatting fixes
enderger Mar 14, 2021
3c9ed25
Fix stupid mistakes
enderger Mar 14, 2021
eb117a6
Merge branch 'feature/github-actions'
enderger Mar 14, 2021
85d4a61
Merge branch 'master' of github.com:enderger/lmt
enderger Mar 14, 2021
58d477b
Test commit
enderger Mar 14, 2021
d2f43fb
Run script on any update, probably for the best
enderger Mar 14, 2021
3df24be
Run script on any update, probably for the best
enderger Mar 14, 2021
20cb318
Run script on any update, probably for the best
enderger Mar 14, 2021
9a39619
Merge branch 'feature/shell.nix' of github.com:enderger/lmt into feat…
enderger Mar 29, 2021
3f0c53d
Improve Nix-Shell.md
enderger Mar 29, 2021
c76bdda
Merge branch 'master' into feature/shell.nix
enderger Mar 29, 2021
fe7853c
Revert change made during testing
enderger Apr 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Nix-Shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Nix Shell
Nix development shells can be used to get development environments which can be accessed using the `nix-shell` command.

Firstly, we must define a function. Nix expressions are written in a functional language (also called Nix) and use the function as their basic unit. This one takes a parameter called `pkgs` with a default value of the primary Nix package collection.
```nix shell.nix+=
{ pkgs ? import <nixpkgs> {} }:
```

Now, we can create a shell using the `pkgs.mkShell` function. This function creates the shell that will be accessed and defines properties of it. In our case, we use the `buildInputs` parameter to include our build dependencies (ie. Golang) in this shell.
```nix shell.nix+=
pkgs.mkShell {
buildInputs = with pkgs; [ go ];
}
```

# About Nix
Nix is a package manager designed to allow for completely reproducible builds. It allows for developers to ensure that software builds the same on 1 computer as it does on any other. For more information, see <https://nixos.org/>.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ directory. You can use the `-o $path` argument to `go build` to build
the binary in a different location. (i.e. `go build -o ~/bin/` to put the
binary in `~/bin/`.)

#### A note for Nix(OS) users
This repo also comes with a `shell.nix` file. While an existing version is included, like lmt itself, this is mainly for bootstrapping purposes. To compile it, use `lmt Nix-Shell.md`

## Demo

To observe `lmt` at work, put this file in an empty directory, cd to that
Expand Down
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [ go ];
}