Skip to content
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

go-hass-agent: init at 11.1.2 #374215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3376,6 +3376,13 @@
github = "brianmcgillion";
githubId = 1044263;
};
briaoeuidhtns = {
name = "Brian Brunner";
email = "brian.brunner.bb+gh@gmail.com";
github = "briaoeuidhtns";
githubId = 7530156;
keys = [ { fingerprint = "5200 F1B2 26BF 2691 59DD F891 AC13 5E2E F7C1 7861"; } ];
};
britter = {
name = "Benedikt Ritter";
email = "beneritter@gmail.com";
Expand Down
115 changes: 115 additions & 0 deletions pkgs/by-name/go/go-hass-agent/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
lib,
fetchFromGitHub,
buildGoModule,
nix-update-script,
writeShellScriptBin,
pkg-config,
gcc,
glibc,
mage,
libglvnd,
xorg,
}:
buildGoModule rec {
pname = "go-hass-agent";
version = "11.1.2";

src = fetchFromGitHub {
owner = "joshuar";
repo = pname;
tag = "v11.1.2";
hash = "sha256-c2TldMY05Au4gwYiIDPi/gQuOHVnT+/0ycgGHKErZyA=";
};

vendorHash = "sha256-02sWRWWadZFMaLjJV181bAioNyuN7mG0ZzrkrTdUTqU=";

passthru.updateScript = nix-update-script { };

nativeBuildInputs =
let
fakeGit = writeShellScriptBin "git" ''
if [[ $@ = "describe --tags --always --dirty" ]]; then
echo "v${version}"
elif [[ $@ = "rev-parse --short HEAD" ]]; then
echo ""
elif [[ $@ = "log --date=iso8601-strict -1 --pretty=%ct" ]]; then
echo "0"
else
>&2 echo "Unknown command: $@"
exit 1
fi
'';
in
[
pkg-config
gcc
mage
fakeGit
];
buildInputs = [
libglvnd
glibc.static
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
xorg.libXi
xorg.libXxf86vm
];

CFLAGS = "-I${glibc.dev}/include";
LDFLAGS = "-L${glibc}/lib";

desktopItems = [ "assets/go-hass-agent.desktop" ];

buildPhase = ''
runHook preBuild

export HOME=$(mktemp -d)
mage -d build/magefiles -w . build:full

runHook postBuild
'';

checkPhase = ''
runHook preCheck

mage -d build/magefiles -w . tests:test

runHook postCheck
'';

installPhase = ''
runHook preInstall

install -DT dist/go-hass-agent-$(go env GOARCH) $out/bin/go-hass-agent

runHook postInstall
'';

meta = {
description = "Home Assistant native app for desktop/laptop devices";
mainProgram = "go-hass-agent";
longDescription = ''
Go Hass Agent is an application to expose sensors, controls, and events
from a device to Home Assistant. You can think of it as something similar
to the Home Assistant companion app for mobile devices, but for your
desktop, server, Raspberry Pi, Arduino, toaster, whatever. If it can run
Go and Linux, it can run Go Hass Agent!

Out of the box, Go Hass Agent will report lots of details about the system
it is running on. You can extend it with additional sensors and controls
by hooking it up to MQTT. You can extend it even further with your own
custom sensors and controls with scripts/programs.

You can then use these sensors, controls, or events in any automations and
dashboards, just like the companion app or any other “thing” you've added
into Home Assistant.
'';
license = lib.licenses.mit;
homepage = "https://github.com/joshuar/go-hass-agent";
changelog = "https://github.com/joshuar/go-hass-agent/blob/v${version}/CHANGELOG.md";
maintainers = [ lib.maintainers.briaoeuidhtns ];
platforms = lib.platforms.linux;
};
}