Merge pull request #89235 from evils/tuptime

This commit is contained in:
Jörg Thalheim 2020-06-20 05:18:27 +01:00 committed by GitHub
commit 7c945cb333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 12 deletions

View File

@ -32,7 +32,10 @@ in {
environment.systemPackages = [ pkgs.tuptime ]; environment.systemPackages = [ pkgs.tuptime ];
users.users.tuptime.description = "tuptime database owner"; users = {
groups._tuptime.members = [ "_tuptime" ];
users._tuptime.description = "tuptime database owner";
};
systemd = { systemd = {
services = { services = {
@ -45,7 +48,7 @@ in {
serviceConfig = { serviceConfig = {
StateDirectory = "tuptime"; StateDirectory = "tuptime";
Type = "oneshot"; Type = "oneshot";
User = "tuptime"; User = "_tuptime";
RemainAfterExit = true; RemainAfterExit = true;
ExecStart = "${pkgs.tuptime}/bin/tuptime -x"; ExecStart = "${pkgs.tuptime}/bin/tuptime -x";
ExecStop = "${pkgs.tuptime}/bin/tuptime -xg"; ExecStop = "${pkgs.tuptime}/bin/tuptime -xg";
@ -57,7 +60,7 @@ in {
serviceConfig = { serviceConfig = {
StateDirectory = "tuptime"; StateDirectory = "tuptime";
Type = "oneshot"; Type = "oneshot";
User = "tuptime"; User = "_tuptime";
ExecStart = "${pkgs.tuptime}/bin/tuptime -x"; ExecStart = "${pkgs.tuptime}/bin/tuptime -x";
}; };
}; };

View File

@ -1,28 +1,37 @@
{ stdenv, fetchFromGitHub, python3 }: { stdenv, fetchFromGitHub
, makeWrapper, installShellFiles
, python3, sqlite }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "tuptime"; pname = "tuptime";
version = "4.1.0"; version = "5.0.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "rfrail3"; owner = "rfrail3";
repo = "tuptime"; repo = "tuptime";
rev = version; rev = version;
sha256 = "0p5v1jp6bl0hjv04q3gh11q6dx9z0x61h6svcbvwp5ni0h1bkz1a"; sha256 = "0izps85p8pxidfrzp7l4hp221fx3dcgapapsix1zavq6jrsl2qyh";
}; };
nativeBuildInputs = [ makeWrapper installShellFiles ];
buildInputs = [ python3 ]; buildInputs = [ python3 ];
outputs = [ "out" "man" ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
install -m 755 src/tuptime $out/bin/ install -m 755 $src/src/tuptime $out/bin/
mkdir -p $out/share/man/man1 installManPage $src/src/man/tuptime.1
cp src/man/tuptime.1 $out/share/man/man1/
# upstream only ships this, there are more scripts there... install -Dm 0755 $src/misc/scripts/db-tuptime-migrate-4.0-to-5.0.sh \
mkdir -p $out/usr/share/doc/tuptime/contrib $out/share/tuptime/db-tuptime-migrate-4.0-to-5.0.sh
cp misc/scripts/uptimed-to-tuptime.py $out/usr/share/doc/tuptime/contrib/ '';
preFixup = ''
wrapProgram $out/share/tuptime/db-tuptime-migrate-4.0-to-5.0.sh \
--prefix PATH : "${stdenv.lib.makeBinPath [ sqlite ]}"
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {