-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nix flake #3485
Add nix flake #3485
Conversation
Not sure how people feel about nix support. Just adds files, no change to existing functionality. Can be simplified if required by leaving off the NIX packaging, which isn't currently working anyway. |
Do you run your TeslaMate production on NixOS as well? As docker container or as flake? |
At present I am currently doing deploys using Docker. Nix would be better, but haven't got to that point just yet. And would be better if we could avoid the need for the manual update steps in the package build process. At present time for my other Elixir projects (which I do deploy with Nix) when dependabot updates stuff, I have to manual update things to ensure the nix package build works, which is kind of yuck. Just setting up a development environment is easy though. This PR currently attempts to do both. Wondering if maybe I should limit it to the development environment as the first step. |
✅ Deploy Preview for teslamate ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Simplified the node dependencies. At present the package build is attempting to download locale files at build time, which is a big no-no as far as nix is concerned for reproducible reasons. |
It builds now. Wow. Amazing. No idea if it actually works. That can come later. And the ability to override the LOCALES directory by environment variable probably needs more work. Ideally it should be possible to build it without that environment variable set. Should be easy to fix. This is why the CI failed. |
Mostly works. Currently getting errors that the token is expired and cannot be refreshed. That is not surprising with this old database. Also getting errors from tzdata cannot write to read only file system. In theory this should be easy, just change the data directory:
But this did not work last I tried (I can't remember why). You can also disable auto updates entirely:
Not sure I like this. I ended up switching to the Relevant docs: https://github.com/lau/tzdata |
Have fixed the tzdata error. Have mixed feeling here, this will ensure tzdata is the latest version. And I have never had an update break anything. But maybe if we just disable auto-updates:
This would make stuff more reproducible. And looking at the problems that our users have trying to set TZ correctly, this might be a good thing. |
Some reason the "Merge GHCR images" is failing. Not exactly sure what it is trying to do... |
Sorry about the failed CI, see: #3689 |
No problem. When this is fixed in master I will update this pull request. |
Fixed in the master, thanks for your patience |
9f6bfc3
to
8ad2098
Compare
|
This will add support for nix flakes. Which really helps with my development on nixos. This has two basic parts: 1. DEVELOPMENT After this you can use the following commands on computer with nix and a patched version of direnv: direnv allow devenv up And it will automatically start and instance of postgresql and mosquitto for development. And the environment variables are already configured for teslamate. So then can start teslamate with: npm install --prefix ./assets && npm run deploy --prefix ./assets iex -S mix phx.server This part is all working as designed. And pretty simple and straight forward. 2. NIX PACKAGE OF TESLA This is 99% complete, but some pain points I haven't addressed yet. Because I don't yet know of good solutions. * There are two checksums in flake.nix that needs to be updated whenever mix.lock or package-lock.json changes.
For reasons I don't understand, trying to use the default value for tzdata's data_dir does not work with the Docker container:
So I changed the default to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks for your efforts!
Imo we can merge, aren't we? |
Yes, I think I am good to merge now. |
This will add support for nix flakes. Which really helps with my development on nixos. This has two basic parts:
After this you can use the following commands on computer with nix and a patched version of direnv:
direnv allow
devenv up
And it will automatically start and instance of postgresql and mosquitto for development.
And the environment variables are already configured for teslamate.
So then can start teslamate with:
npm install --prefix ./assets && npm run deploy --prefix ./assets iex -S mix phx.server
This part is all working as designed. And pretty simple and straight forward.
This is 99% complete, but some pain points I haven't addressed yet. Because I don't yet know of good solutions.