Skip to content

Commit 2b5cdbd

Browse files
authored
Add nix flake (#3485)
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.
1 parent 3a701c0 commit 2b5cdbd

8 files changed

Lines changed: 433 additions & 4 deletions

File tree

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake . --impure

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,12 @@ config/*.env
6161

6262
/priv/plts/*.plt
6363
/priv/plts/*.plt.hash
64+
65+
# Nix files
66+
/.direnv
67+
/.devenv
68+
/tzdata/
69+
/result
70+
71+
# Used during tests
72+
/tmp/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- ci: bump actions/delete-package-versions from 4 to 5 (#3713)
3232
- Replace tortoise library with tortoise311 (#3697 - @brianmay)
3333
- build(deps): bump follow-redirects from 1.15.4 to 1.15.6 in /website (#3743)
34+
- feat: experimental nix flake (#3485 - @brianmay)
3435

3536
#### Dashboards
3637

assets/package-lock.json

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/runtime.exs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,5 @@ end
169169
config :teslamate, :srtm_cache, System.get_env("SRTM_CACHE", ".srtm_cache")
170170

171171
config :teslamate, TeslaMate.Vault, key: Util.get_env("ENCRYPTION_KEY", test: "secret")
172+
173+
config :tzdata, :data_dir, System.get_env("TZDATA_DIR", "/tmp")

flake.lock

Lines changed: 253 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)