diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..e1de7e67b3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.nix text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index dc94ffd06f..f25140faf5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ aclocal.m4 /autom4te.cache/ Makefile .deps/ +.direnv config.h config.log config.status diff --git a/Dockerfile b/Dockerfile index 188a6134cb..a31124f7b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] \ No newline at end of file +CMD "/root/.nix-profile/bin/nix" "develop" "--extra-experimental-features" "nix-command" "--extra-experimental-features" "flakes" "/dissolve#" \ No newline at end of file diff --git a/scripts/setup.sh b/scripts/setup.sh deleted file mode 100644 index 6e5f658cd8..0000000000 --- a/scripts/setup.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -dos2unix flake.nix -"/root/.nix-profile/bin/nix" "develop" "--extra-experimental-features" "nix-command" "--extra-experimental-features" "flakes" "/dissolve#" diff --git a/web/docs/userguide/developers/docker.md b/web/docs/userguide/developers/docker.md index 4796ec07bb..6e79f3b219 100644 --- a/web/docs/userguide/developers/docker.md +++ b/web/docs/userguide/developers/docker.md @@ -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 @@ -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. \ No newline at end of file +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. \ No newline at end of file