fan2go: 0.9.0 -> 0.10.0

This commit is contained in:
Matthew Toohey 2025-06-06 20:17:35 -04:00
parent d308aa9772
commit c88e955e02
2 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,18 @@
diff --git a/Makefile b/Makefile
index c92df71..724911a 100644
--- a/Makefile
+++ b/Makefile
@@ -10,11 +10,12 @@ DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= 0.10.0
test: ## Run all tests
- @go clean --testcache && go test -v ./...
+ @go clean --testcache && go test -ldflags -extldflags=-Wl,-z,lazy -v ./...
build: ## Builds the CLI
@go build ${GO_FLAGS} \
-ldflags "-w -s \
+ -extldflags=-Wl,-z,lazy \
-X ${NAME}/cmd/global.Version=${VERSION} \
-X ${PACKAGE}/cmd/global.Version=${VERSION} \
-X ${NAME}/cmd/global.Commit=${GIT_REV} \

View File

@ -1,25 +1,33 @@
{
buildGo123Module,
buildGoModule,
fetchFromGitHub,
lib,
lm_sensors,
}:
buildGo123Module rec {
buildGoModule rec {
pname = "fan2go";
version = "0.9.0";
version = "0.10.0";
src = fetchFromGitHub {
owner = "markusressel";
repo = "fan2go";
rev = version;
hash = "sha256-eSHeHBzDvzsDAck0zexwR8drasisvlQNTeowv92E2uc=";
tag = version;
hash = "sha256-mLypuOGjYrXFf3BGCDggEDk1+PVx2CgsxAjZQ7uiSW0=";
leaveDotGit = true;
postFetch = ''
cd $out
git rev-parse --short HEAD > $out/GIT_REV
find $out -name .git -print0 | xargs -0 rm -rf
'';
};
vendorHash = "sha256-ad0e/cxbcU/KfPDOdD46KdCcvns83dgGDAyLLQiGyiA=";
vendorHash = "sha256-IJJTolpOtstVov8MNel6EOJqv1oCkTOTiPyW42ElQjc=";
buildInputs = [ lm_sensors ];
patches = [ ./lazy-binding.patch ];
postConfigure = ''
substituteInPlace vendor/github.com/md14454/gosensors/gosensors.go \
--replace-fail '"/etc/sensors3.conf"' '"${lib.getLib lm_sensors}/etc/sensors3.conf"'
@ -30,6 +38,24 @@ buildGo123Module rec {
rm internal/fans/cmd_test.go
'';
buildPhase = ''
runHook preBuild
make build GIT_REV="$(cat GIT_REV)"
dir="$GOPATH/bin"
mkdir -p "$dir"
cp bin/fan2go "$dir"
runHook postBuild
'';
checkPhase = ''
runHook preCheck
make test
runHook postCheck
'';
meta = with lib; {
description = "Simple daemon providing dynamic fan speed control based on temperature sensors";
mainProgram = "fan2go";