mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
Update to latest devenv in nix flake (#3760)
Latest version - after rewrite in Rust - just released yesterday is much nicer and has fewer bugs. For example, it now uses process-compose which is full screen interface for showing running processes. Blog post: https://devenv.sh/blog/2024/03/20/devenv-10-rewrite-in-rust/
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
inputs = {
|
||||
nixpkgs = { url = "github:NixOS/nixpkgs/nixos-unstable"; };
|
||||
flake-utils = { url = "github:numtide/flake-utils"; };
|
||||
# See https://github.com/cachix/devenv/issues/756
|
||||
devenv.url = "github:cachix/devenv/v0.6.3";
|
||||
devenv.url = "github:cachix/devenv";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, flake-utils, devenv }:
|
||||
@@ -84,6 +83,7 @@
|
||||
|
||||
postgres_port = 7000;
|
||||
mosquitto_port = 7001;
|
||||
process_compose_port = 7002;
|
||||
|
||||
psql = pkgs.writeShellScriptBin "teslamate_psql" ''
|
||||
exec "${pkgs.postgresql}/bin/psql" --host "$DATABASE_HOST" --user "$DATABASE_USER" --port "$DATABASE_PORT" "$DATABASE_NAME" "$@"
|
||||
@@ -92,11 +92,9 @@
|
||||
exec "${pkgs.mosquitto}/bin/mosquitto_sub" -h "$MQTT_HOST" -p "$MQTT_PORT" -u "$MQTT_USERNAME" -P "$MQTT_PASSWORD" "$@"
|
||||
'';
|
||||
|
||||
in with pkgs; {
|
||||
packages.default = pkg;
|
||||
devShells.default = devenv.lib.mkShell {
|
||||
devShell = devenv.lib.mkShell {
|
||||
inherit inputs pkgs;
|
||||
modules = [{
|
||||
modules = with pkgs; [{
|
||||
packages = [
|
||||
elixir
|
||||
elixir_ls
|
||||
@@ -116,8 +114,6 @@
|
||||
CoreServices
|
||||
]);
|
||||
enterShell = ''
|
||||
# kludge for https://github.com/cachix/devenv/issues/862
|
||||
# export PKG_CONFIG_PATH_FOR_TARGET="$PKG_CONFIG_PATH"
|
||||
export LOCALES="${cldr}/priv/cldr";
|
||||
export PORT="4000"
|
||||
export ENCRYPTION_KEY="your_secure_encryption_key_here"
|
||||
@@ -131,10 +127,17 @@
|
||||
export RELEASE_COOKIE="1234567890123456789"
|
||||
export TZDATA_DIR="$PWD/tzdata"
|
||||
'';
|
||||
enterTest = ''
|
||||
mix test
|
||||
'';
|
||||
processes.mqtt = {
|
||||
exec =
|
||||
"${pkgs.mosquitto}/bin/mosquitto -p ${toString mosquitto_port}";
|
||||
};
|
||||
process.process-compose = {
|
||||
port = process_compose_port;
|
||||
tui = true;
|
||||
};
|
||||
services.postgres = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_15;
|
||||
@@ -148,6 +151,13 @@
|
||||
'';
|
||||
};
|
||||
}];
|
||||
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
devenv-up = devShell.config.procfileScript;
|
||||
default = pkg;
|
||||
};
|
||||
devShells.default = devShell;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user