From 6c3865eae8dd5e3999a66fdd2ddb70a893e22e7d Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Tue, 30 Apr 2019 21:57:37 +0200 Subject: nix pkg --- module.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 module.nix (limited to 'module.nix') diff --git a/module.nix b/module.nix new file mode 100644 index 0000000..706799f --- /dev/null +++ b/module.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: +let + rustPlatform = pkgs.rustPlatform; + makeWrapper = pkgs.makeWrapper; + batteriewarner = rustPlatform.buildRustPackage rec { + name = "batteriewarner-${version}"; + version = "2017-09-15"; + src = ./.; + + doCheck = false; + + cargoSha256 = "sha256:0jacm96l1gw9nxwavqi1x4669cg6lzy9hr18zjpwlcyb3qkw9z7f"; + + buildInputs = [ makeWrapper ]; + + RUST_SRC_PATH = rustPlatform.rustcSrc; + + installPhase = '' + mkdir -p $out/bin + cp -p target/release/batteriewarner $out/bin/ + wrapProgram $out/bin/batteriewarner --set RUST_SRC_PATH "$RUST_SRC_PATH" + ''; + + meta = with lib; { + description = "Display low battery status using the power led of Thinkpads X-series"; + homepage = https://github.com/yvesf/batteriewarner; + platforms = platforms.all; + }; + }; +in +{ + config = { + systemd.services.batteriewarner = { + enable = true; + description = "Batteriewarner"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${batteriewarner}/bin/batteriewarner"; + }; + }; + }; +} + -- cgit v1.2.1