Merge pull request #131020 from Artturin/uptimed-fix

uptimed nixos/uptimed: switch to /var/lib/ and fix perms
This commit is contained in:
Aaron Andersen 2021-08-01 15:58:36 -04:00 committed by GitHub
commit 4fad3a2b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View File

@ -607,6 +607,14 @@
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
<literal>services.uptimed</literal> now uses
<literal>/var/lib/uptimed</literal> as its stateDirectory
instead of <literal>/var/spool/uptimed</literal>. Make sure to
move all files to the new directory.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-notable-changes">

View File

@ -153,6 +153,8 @@ pt-services.clipcat.enable).
- `CoenraadS.bracket-pair-colorizer` -> `coenraads.bracket-pair-colorizer`
- `golang.Go` -> `golang.go`
- `services.uptimed` now uses `/var/lib/uptimed` as its stateDirectory instead of `/var/spool/uptimed`. Make sure to move all files to the new directory.
## Other Notable Changes {#sec-release-21.11-notable-changes}
- The setting [`services.openssh.logLevel`](options.html#opt-services.openssh.logLevel) `"VERBOSE"` `"INFO"`. This brings NixOS in line with upstream and other Linux distributions, and reduces log spam on servers due to bruteforcing botnets.

View File

@ -4,7 +4,7 @@ with lib;
let
cfg = config.services.uptimed;
stateDir = "/var/spool/uptimed";
stateDir = "/var/lib/uptimed";
in
{
options = {
@ -21,12 +21,16 @@ in
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.uptimed ];
users.users.uptimed = {
description = "Uptimed daemon user";
home = stateDir;
createHome = true;
uid = config.ids.uids.uptimed;
group = "uptimed";
};
users.groups.uptimed = {};
systemd.services.uptimed = {
unitConfig.Documentation = "man:uptimed(8) man:uprecords(1)";
@ -41,7 +45,7 @@ in
PrivateTmp = "yes";
PrivateNetwork = "yes";
NoNewPrivileges = "yes";
ReadWriteDirectories = stateDir;
StateDirectory = [ "uptimed" ];
InaccessibleDirectories = "/home";
ExecStart = "${pkgs.uptimed}/sbin/uptimed -f -p ${stateDir}/pid";
};

View File

@ -14,6 +14,11 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook ];
patches = [ ./no-var-spool-install.patch ];
postPatch = ''
substituteInPlace libuptimed/urec.h \
--replace /var/spool /var/lib
'';
meta = with lib; {
description = "Uptime record daemon";
longDescription = ''