-
Notifications
You must be signed in to change notification settings - Fork 882
feat: Create NixOS module #3998
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
Conversation
✅ Deploy Preview for teslamate ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
brianmay
left a comment
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.
In general, looks good to me.
flake.nix
Outdated
| imports = [ self.nixosModules.default ]; | ||
| services.teslamate = { | ||
| enable = true; | ||
| secrestFile = builtins.toFile "teslamate.env" '' |
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.
Possible typo in secretsFile here.
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.
Oops yeah. Those force pushes earlier were fixing that, I guess I missed this one lol
|
I love the work on the NixOS side. What I wonder is how to do backup and restore with this implementation? This is the only reason why I have not yet migrated my TeslaMate instance to my NixOS server. |
|
Backup/restore is just:
I have not used postgresql on nixos, so I am not really familiar with upgrading databases, etc. I think I saw a webpage with instructions somewhere. The potential gotcha is configuring secrets. You don't want to include secrets in plain text format in the nix repo, or at least this is frowned upon. I personally use agenix for these. |
|
At present I just install teslamate on my nixos system with a docker image, but I think using this flake will be simpler. |
Sometimes the most obvious is the hardest to see :-)
Yeah, that's what I do as well, https://github.com/JakobLichterfeld/nix-config
Same for me, using agenix for secrets and git-crypt as well |
JakobLichterfeld
left a comment
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.
TY!
Overview
Adds a semi-opinionated NixOS module to ease deploying TeslaMate on NixOS.
Trade-offs
systemd.services.teslamate.environmentRELEASE_COOKIEmust be passed in via thesecretFile. Values used in the NixOS config are globally readable so secrets should be read from disk at runtime. We could use either a hard-coded RELEASE_COOKIE value or generate something based on hashes, but given it is technically a secret, I chose to just require the end user to provide it.Testing
nix flake check --impure(--impurerequire due to devenv) will run a simple telsamate configuration in a VM and assert that a server starts up on port 4000