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 22 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
1 change: 1 addition & 0 deletions .github/workflows/tangle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
- push
- pull_request


env:
FILES: 'Implementation.md WhitespacePreservation.md SubdirectoryFiles.md LineNumbers.md IndentedBlocks.md'
GOVER: '^1.16'
Expand Down
2 changes: 1 addition & 1 deletion Implementation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# lmt - literate markdown tangle

This file implements a tangle program for a literate programming style
where the code is weaved into markdown code blocks. There is no corresponding
where the code is tangled from markdown code blocks. There is no corresponding
weave, because the markdown itself can already be read as the documentation,
either through a text editor or through an online system that already renders
markdown such as GitHub.
Expand Down
18 changes: 18 additions & 0 deletions Nix-Shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# About Nix
Nix is a package manager designed to allow for completely reproducible builds. It allows for developers to have reproducible build environments in order to ensure consistency. For more information, see <https://nixos.org/>.

# 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 ];
}
```

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
2 changes: 1 addition & 1 deletion SubdirectoryFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ a little help from the Go standard library `path/filepath` functions.

We'll get the directory of the string, and if it's not "." (filepath.Dir
returns ".", not "" for empty paths) call `os.MkdirAll` on it in order to create
the directory before creating the file.
the directory before creating the file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this punctuation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry about that. My master branch had some temporary changes made while testing the actions PR.


```go "Output files"
for filename, codeblock := range files {
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 ];
}