Skip to content

Commit

Permalink
Add more docs about nix.
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Dec 17, 2020
1 parent dbffa16 commit 615f9ae
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ using the debugger alone? For further refinements of the implementation see
[`frontend{2,3,4}.go`](src/sut/register) and see if you can figure out why they
do or don't work as well.

More about `nix` can be found [here](doc/nix.md), including why it's preferbable
to `docker` and how to overcome some weak points of `nix-shell`.
More about `nix` can be found [here](doc/nix.md), including a recommended
developer workflow and why it's preferbable to `docker`.

### How it works on a higher-level

Expand Down
34 changes: 34 additions & 0 deletions doc/nix.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
### Nix

#### Development workflow

Once you got `nix` installed, it should be a matter of typing
`nix-shell` at the root of the repo to get the development environment
setup as well as access to all binaries, in particular the `detsys`
command-line interface tool.

If you change some detsys component, you can exit the`nix-shell` and
reenter it again, this should only rebuild the change component and any
dependencies of it.

If you find `nix-shell` rebuilding more than necessary, then you can
also try to run `nix-env --install --file default.nix` from within the
directory of the component that gets unnecessarily rebuilt. This is the
`nix` equivalent of `make install`, you can also do `nix-build` from
within the directory of a component to see if the `default.nix` builds
(equivalent to `make`).

If you want to more iteratively develop your component, you can also use
whatever language specific compiler or build tool the component uses.
Note however that `detsys` will use whatever binary it finds first in
your `PATH`, which could be old versions installed by `nix-env`. All
`detsys` components come with a `--version` flag and the `detsys`
command-line interface tool also has a `versions` subcommand to help you
ensure that you are using the intended versions of the components.

This entering `nix-shell`, leaving and reentering it again is obviously
annoying. `lorri` is beefed up version of `nix-shell` that is supposed
to address some of these shortcomings, but we've still not figured out
how to use it.

#### Why `nix` over `docker`?

* Just `cd` into the directory and it automatically makes all your tools
Expand Down Expand Up @@ -62,6 +93,9 @@ purpose.

#### How to setup `nix` for a software component

TODO(stevan): the following is slightly outdated, we currently have a
single `niv init` at the top-level which all components use.

```bash
cd $component
niv init
Expand Down

0 comments on commit 615f9ae

Please sign in to comment.