-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add modbus-exporter and inch-exporter
In the end inch-exporter is more powerful in transforming the modbus information from the inch carcharger.
- Loading branch information
1 parent
bd22753
commit 454a848
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ config, pkgs, lib, ... }: | ||
let | ||
cfg = config.services.inch-exporter; | ||
in | ||
with lib; | ||
|
||
{ | ||
options.services.inch-exporter = { | ||
enable = mkEnableOption "inch-exporter"; | ||
|
||
listenAddress = mkOption { | ||
default = "127.0.0.1:9111"; | ||
type = types.str; | ||
}; | ||
|
||
inchUrl = mkOption { | ||
type = types.str; | ||
}; | ||
|
||
}; | ||
|
||
config = mkIf cfg.enable { | ||
systemd.services.inch-exporter = { | ||
wantedBy = [ "multi-user.target" ]; | ||
serviceConfig = { | ||
Type = "simple"; | ||
DynamicUser = true; | ||
EnvironmentFile = "-/etc/sysconfig/inch-exporter"; | ||
ExecStart = "${pkgs.inch-exporter}/bin/inch-exporter -listen-address ${cfg.listenAddress} -inch-url ${cfg.inchUrl}"; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ lib, buildGoModule, fetchFromGitHub }: | ||
|
||
buildGoModule rec { | ||
pname = "inch-exporter"; | ||
version = "0.1.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "simonswine"; | ||
repo = "inch-exporter"; | ||
rev = "v${version}"; | ||
hash = "sha256-1Xl8ukEKnZuzKsvhRfvO1b3B4knSb31znUsOk1CjkXM="; | ||
}; | ||
|
||
vendorHash = "sha256-ws321AvIOMFyxt7L+l5RcHw38G+84aquSvB+3GSM4pE="; | ||
|
||
subPackages = [ "." ]; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/simonswine/inch-exporter"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ simonswine ]; | ||
platforms = platforms.unix; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ lib, buildGoModule, fetchFromGitHub }: | ||
|
||
buildGoModule rec { | ||
pname = "modbus-exporter"; | ||
version = "0.4.1"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "RichiH"; | ||
repo = "modbus_exporter"; | ||
rev = "v${version}"; | ||
hash = "sha256-ZkES+CDthYZrNZ7wVO0oRx6pBMX23AyUOhU+OBTD42g="; | ||
}; | ||
|
||
vendorHash = "sha256-RfpJLoYPR5Ura3GvLIAePg+fuiaiXig6XaSNCPhZ/Vg="; | ||
|
||
subPackages = [ "." ]; | ||
|
||
postInstall = '' | ||
mv $out/bin/modbus_exporter $out/bin/modbus-exporter | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/simonswine/modbus-exporter"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ simonswine ]; | ||
platforms = platforms.unix; | ||
}; | ||
} | ||
|