Add docker files to run nix dev environment on Windows

This commit is contained in:
Wolfgang Walther
2020-12-01 00:42:21 +01:00
committed by Wolfgang Walther
parent f2cb91740e
commit 1a5f6cce46
3 changed files with 39 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
# This Dockerfile is only used as a development environment for
# non-nix systems, i.e. Windows.
FROM nixos/nix:latest
RUN apk --no-cache add \
wget
RUN nix-env -iA cachix -f https://cachix.org/api/v1/install \
&& cachix use postgrest
# We need an unprivileged user here, to make PG run at all.
RUN adduser --disabled-password --ingroup root nix \
&& chown -R nix:root /nix
USER nix:root
ENV USER=nix
VOLUME /nix
VOLUME /postgrest
WORKDIR /postgrest
CMD nix-shell
+5
View File
@@ -12,6 +12,11 @@ their dependencies will be stored. It will also link the Nix executables like
other PostgREST dependencies from here on out. To clean up older build other PostgREST dependencies from here on out. To clean up older build
artifacts from the `/nix/store`, you can run `nix-collect-garbage`. artifacts from the `/nix/store`, you can run `nix-collect-garbage`.
If you are on a system that does not support nix, for example Windows, you can
run the nix development environment in a docker container. Inside the `nix/`
directory run `docker-compose run --rm nix` to start the docker container. This
will set up the binary cache and launch `nix-shell` automatically.
## Building PostgREST ## Building PostgREST
To build PostgREST from your local checkout of the repository, run: To build PostgREST from your local checkout of the repository, run:
+12
View File
@@ -0,0 +1,12 @@
version: '3'
services:
nix:
container_name: postgrest-nix
build: .
volumes:
- ../:/postgrest
- nix:/nix
volumes:
nix: