summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf+git@xapek.org>2019-04-30 21:57:37 +0200
committerYves Fischer <yvesf+git@xapek.org>2019-04-30 21:59:21 +0200
commit6c3865eae8dd5e3999a66fdd2ddb70a893e22e7d (patch)
tree81553b4e0b303cc38c9586a101f3ab9f5fae6353
parent7c4e5e97cfca92e193dc79b3241dc24e7f9e7279 (diff)
downloadbatteriewarner-6c3865eae8dd5e3999a66fdd2ddb70a893e22e7d.tar.gz
batteriewarner-6c3865eae8dd5e3999a66fdd2ddb70a893e22e7d.zip
nix pkg
-rw-r--r--.gitignore3
-rw-r--r--Cargo.lock4
-rw-r--r--module.nix43
3 files changed, 48 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index d72a31c..55161e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,9 +2,8 @@
**/*.rs.bk
.idea
*iml
-Cargo.lock
debian/.debhelper
debian/batteriewarner.*debhelper*
debian/batteriewarner.substvars
-debian/batteriewarner/ \ No newline at end of file
+debian/batteriewarner/
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..167134e
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,4 @@
+[[package]]
+name = "batteriewarner"
+version = "0.1.0"
+
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";
+ };
+ };
+ };
+}
+