358: nix-daemon: do not expose flake-inputs.prom anymore r=Mic92 a=Mic92



Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
bors[bot] 2023-01-02 08:59:42 +00:00 committed by GitHub
commit cbfa8750c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 29 deletions

View file

@ -61,6 +61,7 @@
inherit (inputs.nixpkgs.lib) nixosSystem;
common = [
{ _module.args.inputs = inputs; }
{ srvos.flake = inputs.self; }
inputs.sops-nix.nixosModules.sops
inputs.srvos.nixosModules.server

View file

@ -1,4 +1,4 @@
{ lib, pkgs, inputs, ... }:
{ pkgs, ... }:
let
asGB = size: toString (size * 1024 * 1024);
@ -36,33 +36,5 @@ in
Restart = "on-failure";
};
# inputs == flake inputs in configurations.nix
environment.etc =
let
inputsWithDate = lib.filterAttrs (_: input: input ? lastModified) inputs;
flakeAttrs = input: (lib.mapAttrsToList (n: v: ''${n}="${v}"'')
(lib.filterAttrs (_n: v: (builtins.typeOf v) == "string") input));
lastModified = name: input: ''
flake_input_last_modified{input="${name}",${lib.concatStringsSep "," (flakeAttrs input)}} ${toString input.lastModified}
'';
in
{
"flake-inputs.prom" = {
mode = "0555";
text = ''
# HELP flake_registry_last_modified Last modification date of flake input in unixtime
# TYPE flake_input_last_modified gauge
${lib.concatStringsSep "\n" (lib.mapAttrsToList lastModified inputsWithDate)}
'';
};
};
services.telegraf.extraConfig.inputs.file = [
{
data_format = "prometheus";
files = [ "/etc/flake-inputs.prom" ];
}
];
users.groups.trusted = { };
}