Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Total Nixification #48

Merged
merged 55 commits into from
Jul 16, 2018
Merged

Total Nixification #48

merged 55 commits into from
Jul 16, 2018

Conversation

nightkr
Copy link
Contributor

@nightkr nightkr commented Jun 16, 2018

All services have been nixified. To build and load the docker images, install Nix, run ./nix-build.sh, and then run docker-compose up as usual.

TODO

  • Windows support? (unlikely, no Docker support anyway)
  • Mac support? (building probably works, but I have no idea whether the Docker images will be usable)
  • web-frontend fails to build ATM
  • Slow rebuilds, mostly due to Docker (on my computer building and importing the Docker images without the actual components takes ~1min 10s, whereas a full non-Docker build takes ~25s and basically once in a (computer's) lifetime)
  • No more reloading code without a container rebuild, wouldn't be an issue if not for the above
  • Generate list of apps automatically (default.nix)
  • Generate lib dependencies automatically (workspace.nix)
  • Update readme with instructions on how to build, run, gc etc using nix
  • Migrate Travis scripts

@nightkr nightkr requested review from indrif and R0tenur June 16, 2018 01:07
@indrif
Copy link
Contributor

indrif commented Jun 18, 2018

Would be nice to:

  • Generate list of apps automatically (default.nix)
  • Generate lib dependencies automatically (workspace.nix)
  • Update readme with instructions on how to build, run, gc etc using nix

@indrif
Copy link
Contributor

indrif commented Jun 21, 2018

Tried on my mac now and get the following:

api-photos_1                            | standard_init_linux.go:190: exec user process caused "exec format error"
be-photo-import_1                       | standard_init_linux.go:190: exec user process caused "exec format error"
gateway_1                               | standard_init_linux.go:190: exec user process caused "exec format error"

@nightkr
Copy link
Contributor Author

nightkr commented Jun 21, 2018

Looks like yarn2nix doesn't support cross-compilation at the moment. Looking into what would be required for it to function.

@nightkr
Copy link
Contributor Author

nightkr commented Jun 21, 2018

Another (although quite ugly) alternative would be to run the nix-builds inside https://hub.docker.com/r/nixos/nix/.

@nightkr
Copy link
Contributor Author

nightkr commented Jun 25, 2018

It seems to work fine(-ish) on Windows, building using WSL and running the containers in Docker for Windows.

Steps:

  1. Install Docker for Windows
  2. Install WSL and Ubuntu for WSL
  3. From WSL, run:
sudo mkdir -p /etc/nix
sudo echo "use-sqlite-wal = false" >> /etc/nix/nix.conf
curl https://nixos.org/nix/install | sh

(SQLite's WAL needs to be disabled due to microsoft/WSL#2395.)
4. Install Docker inside WSL following https://medium.com/@sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4
5. From WSL, run ./docker-build.sh (inside photo-garden)
6. Run docker-compose up

Notes:

  • In my testing the nix-build is very slow inside WSL. I have no idea how much of this is due to Windows problems and how much is due to it running poorly on KVM (which is, I suppose, also a Windows problem).
  • In my testing the downloads seem to fail semi-spuriously. Adding --keep-going to the nix-build invocation in docker-build.sh lets it continue downloading the rest, and then you can pick up the last stragglers by running it a second time. This is a one-time issue when setting up a new machine.

@nightkr
Copy link
Contributor Author

nightkr commented Jun 26, 2018

After some testing with @indrif we got it to work on Mac by following https://github.com/LnL7/nix-docker#running-as-a-remote-builder.

@nightkr nightkr mentioned this pull request Jul 13, 2018
3 tasks
@nightkr nightkr merged commit b56bf70 into master Jul 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants