Skip to content

Commit

Permalink
build: updates to Docker resources (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobBuchananCompPhys authored and rprospero committed Apr 9, 2024
1 parent 23ce2fd commit 5dfd54d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.nix text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ aclocal.m4
/autom4te.cache/
Makefile
.deps/
.direnv
config.h
config.log
config.status
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ RUN echo "substituters = https://cache.nixos.org https://dissolve-nix.cachix.org
RUN echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= dissolve-nix.cachix.org-1:b7kp954+mmuowr7XZsAIBugv+xp7+n3aSF/5obidRDE=" >> /etc/nix/nix.conf
RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
RUN /root/.nix-profile/bin/nix build github:disorderedmaterials/dissolve#devShells.x86_64-linux.default
RUN nix-env -iA nixpkgs.dos2unix
VOLUME /dissolve
WORKDIR /dissolve

CMD [ "/bin/sh", "-c", "./scripts/setup.sh" ]
CMD "/root/.nix-profile/bin/nix" "develop" "--extra-experimental-features" "nix-command" "--extra-experimental-features" "flakes" "/dissolve#"
3 changes: 0 additions & 3 deletions scripts/setup.sh

This file was deleted.

24 changes: 23 additions & 1 deletion web/docs/userguide/developers/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ This will run a new instance of the built image in an interactive terminal - you

Notice that this command maps the IP address of the host machine to the container (a requirement for X11 forwarding of graphics to take place) as well as mapping the dissolve code into the container.

Before starting any work, initialise the environment variables using `direnv`:
```shell
nix-env -iA nixpkgs.direnv
direnv allow
echo "$(direnv hook bash)" > /root/.bashrc
```
This will allow the environment to be reloaded automatically on future instances of starting the container (simply execute an interactive terminal with `bash` as the entrypoint - see step 4).

To build the dissolve software using `cmake`, you will need to run the following commands
```shell
cmake --preset GUI-nix
cmake --build build
```
The build products should now be visible in the `/build` directory on both the host and container file systems.

To build the dissolve software using `cmake`, you will need to run the following commands
```shell
cmake --preset GUI-nix
Expand All @@ -77,4 +92,11 @@ nixGLIntel ./build/bin/dissolve-gui
```
to start the software.

You should now see the dissolve home screen open in a new window.
You should now see the dissolve home screen open in a new window.

When the container is closed, the development shell with close, taking the environment dependencies with it.
Therefore, any time returning to work inside the container, run `docker start $CONTAINER_NAME`, and then
```shell
docker exec -it $CONTAINER_NAME sh -c "echo "$(direnv hook bash)" > /root/.bashrc; bash"
```
which will hook dissolve's dev environment into the new shell.

0 comments on commit 5dfd54d

Please sign in to comment.