mirror of
https://github.com/haskell-nix/hnix.git
synced 2024-09-11 06:55:38 +03:00
Add a Docker build, as another way of testing out hnix
This commit is contained in:
parent
080f5ead1d
commit
5176cffd2d
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
.git
|
||||
Dockerfile
|
||||
Makefile
|
||||
README.md
|
||||
cabal.sandbox.config
|
||||
.cabal-sandbox/
|
||||
hnix.cabal
|
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM lnl7/nix:2.0
|
||||
|
||||
WORKDIR /tmp/build
|
||||
|
||||
COPY default.nix /tmp/build
|
||||
COPY package.yaml /tmp/build
|
||||
|
||||
# Install tools needed by builtins.fetchTarball, and then install all
|
||||
# dependencies into its own layer, which doesn't change.
|
||||
RUN nix-env -f '<nixpkgs>' -i gnutar gzip && \
|
||||
nix-shell -Q -j2 --run true
|
||||
|
||||
COPY . /tmp/build
|
||||
RUN nix-env -f . -i hnix
|
||||
|
||||
CMD ["/root/.nix-profile/bin/hnix"]
|
16
README.md
16
README.md
@ -24,6 +24,20 @@ $ cabal test
|
||||
$ LANGUAGE_TESTS=yes NIXPKGS_TESTS=yes cabal test
|
||||
$ ./dist/build/hnix/hnix --help
|
||||
```
|
||||
|
||||
## Building a Docker container
|
||||
|
||||
If you don't have Nix installed, or you'd just like to play around with `hnix`
|
||||
completely separately from your main system, you can build a Docker container:
|
||||
|
||||
```bash
|
||||
$ docker build -t hnix .
|
||||
$ docker run hnix hnix --eval --expr '1 + 2'
|
||||
|
||||
# In order to refer to files under the current directory:
|
||||
$ docker run -v $PWD/:/tmp/build run hnix hnix default.nix
|
||||
```
|
||||
|
||||
## Building with full debug info
|
||||
|
||||
To build `hnix` for debugging, and with full tracing output and stack traces,
|
||||
@ -33,7 +47,7 @@ use:
|
||||
$ nix-shell --arg doProfiling true
|
||||
$ cabal configure --enable-tests --enable-profiling --flags=tracing
|
||||
$ cabal build
|
||||
$ ./dist/build/hnix/hnix -v5 <args> +RTS -xc
|
||||
$ ./dist/build/hnix/hnix -v5 --trace <args> +RTS -xc
|
||||
```
|
||||
|
||||
Note that this will run quite slowly, but will give the most information as to
|
||||
|
Loading…
Reference in New Issue
Block a user