Skip to content

Commit

Permalink
Add nix flake
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brianmay committed Mar 19, 2024
1 parent 3a701c0 commit 3384dd8
Show file tree
Hide file tree
Showing 8 changed files with 433 additions and 4 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . --impure
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ config/*.env

/priv/plts/*.plt
/priv/plts/*.plt.hash

# Nix files
/.direnv
/.devenv
/tzdata/
/result

# Used during tests
/tmp/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- ci: bump actions/delete-package-versions from 4 to 5 (#3713)
- Replace tortoise library with tortoise311 (#3697 - @brianmay)
- build(deps): bump follow-redirects from 1.15.4 to 1.15.6 in /website (#3743)
- feat: experimental nix flake (#3485 - @brianmay)

#### Dashboards

Expand Down
14 changes: 11 additions & 3 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,5 @@ end
config :teslamate, :srtm_cache, System.get_env("SRTM_CACHE", ".srtm_cache")

config :teslamate, TeslaMate.Vault, key: Util.get_env("ENCRYPTION_KEY", test: "secret")

config :tzdata, :data_dir, System.get_env("TZDATA_DIR", "/tmp")
253 changes: 253 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3384dd8

Please sign in to comment.