commit
6cba7d42f1
@ -0,0 +1,152 @@ |
||||
{ lib, pkgs, config, generators, ... }: |
||||
with lib; |
||||
let |
||||
cfg = config.services.grafana-agent; |
||||
settingsFormat = pkgs.formats.yaml { }; |
||||
configFile = settingsFormat.generate "grafana-agent.yaml" cfg.settings; |
||||
in |
||||
{ |
||||
meta = { |
||||
maintainers = with maintainers; [ zimbatm ]; |
||||
}; |
||||
|
||||
options.services.grafana-agent = { |
||||
enable = mkEnableOption "grafana-agent"; |
||||
|
||||
package = mkOption { |
||||
type = types.package; |
||||
default = pkgs.grafana-agent; |
||||
defaultText = "pkgs.grafana-agent"; |
||||
description = "The grafana-agent package to use."; |
||||
}; |
||||
|
||||
credentials = mkOption { |
||||
description = '' |
||||
Credentials to load at service startup. Keys that are UPPER_SNAKE will be loaded as env vars. Values are absolute paths to the credentials. |
||||
''; |
||||
type = types.attrsOf types.str; |
||||
default = { }; |
||||
|
||||
example = { |
||||
logs_remote_write_password = "/run/keys/grafana_agent_logs_remote_write_password"; |
||||
LOGS_REMOTE_WRITE_URL = "/run/keys/grafana_agent_logs_remote_write_url"; |
||||
LOGS_REMOTE_WRITE_USERNAME = "/run/keys/grafana_agent_logs_remote_write_username"; |
||||
metrics_remote_write_password = "/run/keys/grafana_agent_metrics_remote_write_password"; |
||||
METRICS_REMOTE_WRITE_URL = "/run/keys/grafana_agent_metrics_remote_write_url"; |
||||
METRICS_REMOTE_WRITE_USERNAME = "/run/keys/grafana_agent_metrics_remote_write_username"; |
||||
}; |
||||
}; |
||||
|
||||
settings = mkOption { |
||||
description = '' |
||||
Configuration for <package>grafana-agent</package>. |
||||
|
||||
See https://grafana.com/docs/agent/latest/configuration/ |
||||
''; |
||||
|
||||
type = types.submodule { |
||||
freeformType = settingsFormat.type; |
||||
}; |
||||
|
||||
default = { |
||||
server = { |
||||
# Don't bind on 0.0.0.0 |
||||
grpc_listen_address = "127.0.0.1"; |
||||
http_listen_address = "127.0.0.1"; |
||||
# Don't bind on the default port 80 |
||||
http_listen_port = 9090; |
||||
}; |
||||
prometheus = { |
||||
wal_directory = "\${STATE_DIRECTORY}"; |
||||
global.scrape_interval = "5s"; |
||||
}; |
||||
integrations = { |
||||
agent.enabled = true; |
||||
agent.scrape_integration = true; |
||||
node_exporter.enabled = true; |
||||
replace_instance_label = true; |
||||
}; |
||||
}; |
||||
|
||||
example = { |
||||
loki.configs = [{ |
||||
name = "default"; |
||||
scrape_configs = [ |
||||
{ |
||||
job_name = "journal"; |
||||
journal = { |
||||
max_age = "12h"; |
||||
labels.job = "systemd-journal"; |
||||
}; |
||||
relabel_configs = [ |
||||
{ |
||||
source_labels = [ "__journal__systemd_unit" ]; |
||||
target_label = "systemd_unit"; |
||||
} |
||||
{ |
||||
source_labels = [ "__journal__hostname" ]; |
||||
target_label = "nodename"; |
||||
} |
||||
{ |
||||
source_labels = [ "__journal_syslog_identifier" ]; |
||||
target_label = "syslog_identifier"; |
||||
} |
||||
]; |
||||
} |
||||
]; |
||||
positions.filename = "\${STATE_DIRECTORY}/loki_positions.yaml"; |
||||
clients = [{ |
||||
url = "\${LOGS_REMOTE_WRITE_URL}"; |
||||
basic_auth.username = "\${LOGS_REMOTE_WRITE_USERNAME}"; |
||||
basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/logs_remote_write_password"; |
||||
}]; |
||||
}]; |
||||
integrations = { |
||||
prometheus_remote_write = [{ |
||||
url = "\${METRICS_REMOTE_WRITE_URL}"; |
||||
basic_auth.username = "\${METRICS_REMOTE_WRITE_USERNAME}"; |
||||
basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/metrics_remote_write_password"; |
||||
}]; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
systemd.services.grafana-agent = { |
||||
wantedBy = [ "multi-user.target" ]; |
||||
script = '' |
||||
set -euo pipefail |
||||
shopt -u nullglob |
||||
|
||||
# Load all credentials into env if they are in UPPER_SNAKE form. |
||||
if [[ -n "''${CREDENTIALS_DIRECTORY:-}" ]]; then |
||||
for file in "$CREDENTIALS_DIRECTORY"/*; do |
||||
key=$(basename "$file") |
||||
if [[ $key =~ ^[A-Z0-9_]+$ ]]; then |
||||
echo "Environ $key" |
||||
export "$key=$(< "$file")" |
||||
fi |
||||
done |
||||
fi |
||||
|
||||
# We can't use Environment=HOSTNAME=%H, as it doesn't include the domain part. |
||||
export HOSTNAME=$(< /proc/sys/kernel/hostname) |
||||
|
||||
exec ${cfg.package}/bin/agent -config.expand-env -config.file ${configFile} |
||||
''; |
||||
serviceConfig = { |
||||
Restart = "always"; |
||||
DynamicUser = true; |
||||
RestartSec = 2; |
||||
SupplementaryGroups = [ |
||||
# allow to read the systemd journal for loki log forwarding |
||||
"systemd-journal" |
||||
]; |
||||
StateDirectory = "grafana-agent"; |
||||
LoadCredential = lib.mapAttrsToList (key: value: "${key}:${value}") cfg.credentials; |
||||
Type = "simple"; |
||||
}; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1,32 @@ |
||||
import ./make-test-python.nix ({ lib, pkgs, ... }: |
||||
|
||||
let |
||||
nodes = { |
||||
machine = { |
||||
services.grafana-agent = { |
||||
enable = true; |
||||
}; |
||||
}; |
||||
}; |
||||
in |
||||
{ |
||||
name = "grafana-agent"; |
||||
|
||||
meta = with lib.maintainers; { |
||||
maintainers = [ zimbatm ]; |
||||
}; |
||||
|
||||
inherit nodes; |
||||
|
||||
testScript = '' |
||||
start_all() |
||||
|
||||
with subtest("Grafana-agent is running"): |
||||
machine.wait_for_unit("grafana-agent.service") |
||||
machine.wait_for_open_port(9090) |
||||
machine.succeed( |
||||
"curl -sSfN http://127.0.0.1:9090/-/healthy" |
||||
) |
||||
machine.shutdown() |
||||
''; |
||||
}) |
@ -1,11 +1,11 @@ |
||||
{ |
||||
"packageVersion": "100.0.2-1", |
||||
"packageVersion": "101.0.1-1", |
||||
"source": { |
||||
"rev": "100.0.2-1", |
||||
"sha256": "1hss4kvy4n4wxwlbb0pk7f02qra1dk8xgc6v6xqg252i7453vg9d" |
||||
"rev": "101.0.1-1", |
||||
"sha256": "1b4zrfi5ig2aywsrfblxznds894ib8gx66yjm8n4hxmpsinmqfp9" |
||||
}, |
||||
"firefox": { |
||||
"version": "100.0.2", |
||||
"sha512": "6d9922e35e496fa63833ba03d1466e075287e40e50854ddc4f4a2036d9c7ca1f35c03bc6f708a3c469e0ec3b389b3346ac754bb84df0fecb86955fc21c05e00f" |
||||
"version": "101.0.1", |
||||
"sha512": "435a7f6013582933e75c41e554a45beda30b5affd7d3ed7d2876026609ba7f17b2c20b507d9d0c9ce2379e335ec09b021257ba30ac55fabf02dca54b03ea70b4" |
||||
} |
||||
} |
||||
|
@ -1,31 +0,0 @@ |
||||
{ lib, stdenv, fetchurl, qt4, cmake }: |
||||
|
||||
let |
||||
baseName = "libdbusmenu-qt"; |
||||
v = "0.9.2"; |
||||
homepage = "https://launchpad.net/${baseName}"; |
||||
name = "${baseName}-${v}"; |
||||
in |
||||
|
||||
stdenv.mkDerivation { |
||||
inherit name; |
||||
|
||||
src = fetchurl { |
||||
url = "${homepage}/trunk/${v}/+download/${name}.tar.bz2"; |
||||
sha256 = "1v0ri5g9xw2z64ik0kx0ra01v8rpjn2kxprrxppkls1wvav1qv5f"; |
||||
}; |
||||
|
||||
buildInputs = [ qt4 ]; |
||||
nativeBuildInputs = [ cmake ]; |
||||
|
||||
cmakeFlags = [ "-DWITH_DOC=OFF" ]; |
||||
|
||||
dontWrapQtApps = true; |
||||
|
||||
meta = with lib; { |
||||
description = "Provides a Qt implementation of the DBusMenu spec"; |
||||
inherit homepage; |
||||
inherit (qt4.meta) platforms; |
||||
license = licenses.lgpl2; |
||||
}; |
||||
} |
@ -1,51 +0,0 @@ |
||||
{ lib, stdenv, fetchurl, qt4 }: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
pname = "qtscriptgenerator"; |
||||
version = "0.1.0"; |
||||
|
||||
src = fetchurl { |
||||
url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/qtscriptgenerator/qtscriptgenerator-src-${version}.tar.gz"; |
||||
sha256 = "0h8zjh38n2wfz7jld0jz6a09y66dbsd2jhm4f2024qfgcmxcabj6"; |
||||
}; |
||||
buildInputs = [ qt4 ]; |
||||
|
||||
patches = [ ./qtscriptgenerator.gcc-4.4.patch ./qt-4.8.patch ]; |
||||
|
||||
postPatch = '' |
||||
# remove phonon stuff which causes errors (thanks to Gentoo bug reports) |
||||
sed -i "/typesystem_phonon.xml/d" generator/generator.qrc |
||||
sed -i "/qtscript_phonon/d" qtbindings/qtbindings.pro |
||||
''; |
||||
|
||||
configurePhase = '' |
||||
( cd generator; qmake ) |
||||
( cd qtbindings; qmake ) |
||||
''; |
||||
|
||||
buildPhase = '' |
||||
makeFlags="SHELL=$SHELL ''${enableParallelBuilding:+-j$NIX_BUILD_CORES -l$NIX_BUILD_CORES}" |
||||
make $makeFlags -C generator |
||||
|
||||
# Set QTDIR, see https://code.google.com/archive/p/qtscriptgenerator/issues/38 |
||||
( cd generator; QTDIR=${qt4} ./generator ) |
||||
make $makeFlags -C qtbindings |
||||
''; |
||||
|
||||
installPhase = '' |
||||
mkdir -p $out/lib/qt4/plugins/script |
||||
cp -av plugins/script/* $out/lib/qt4/plugins/script |
||||
''; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
hardeningDisable = [ "format" ]; |
||||
|
||||
meta = { |
||||
broken = (stdenv.isLinux && stdenv.isAarch64); |
||||
description = "QtScript bindings generator"; |
||||
homepage = "https://code.qt.io/cgit/qt-labs/qtscriptgenerator.git/"; |
||||
inherit (qt4.meta) platforms; |
||||
license = lib.licenses.lgpl21; |
||||
}; |
||||
} |
@ -1,23 +0,0 @@ |
||||
Origin: http://src.fedoraproject.org/gitweb/?p=qtscriptgenerator.git;a=blob_plain;f=qtscriptgenerator-src-0.1.0-no_QFileOpenEvent.patch;h=f397b5ab13bcfc268e6d7b7ba4c6bc66ae38b5c0;hb=HEAD
|
||||
diff -up qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml.no_QFileOpenEvent qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml
|
||||
--- qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml.no_QFileOpenEvent 2011-12-22 11:34:52.615149619 -0600
|
||||
+++ qtscriptgenerator-src-0.1.0/generator/typesystem_gui-common.xml 2011-12-22 11:35:31.808659632 -0600
|
||||
@@ -2233,7 +2233,6 @@
|
||||
|
||||
|
||||
</object-type>
|
||||
- <object-type name="QFileOpenEvent" polymorphic-id-expression="%1->type() == QEvent::FileOpen"/>
|
||||
<object-type name="QFocusEvent" polymorphic-id-expression="%1->type() == QEvent::FocusIn || %1->type() == QEvent::FocusOut">
|
||||
<modify-function signature="reason()const">
|
||||
<remove/>
|
||||
diff -up qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml.no_QFileOpenEvent qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml
|
||||
--- qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml.no_QFileOpenEvent 2009-02-20 05:42:24.000000000 -0600
|
||||
+++ qtscriptgenerator-src-0.1.0/generator/typesystem_gui.xml 2011-12-22 11:33:43.058019203 -0600
|
||||
@@ -2555,7 +2555,6 @@
|
||||
|
||||
|
||||
</object-type>
|
||||
- <object-type name="QFileOpenEvent" polymorphic-id-expression="%1->type() == QEvent::FileOpen"/>
|
||||
<object-type name="QFocusEvent" polymorphic-id-expression="%1->type() == QEvent::FocusIn || %1->type() == QEvent::FocusOut">
|
||||
<modify-function signature="reason()const">
|
||||
<remove/>
|
@ -1,11 +0,0 @@ |
||||
diff -uNr generator.orig/parser/rpp/pp.h generator/parser/rpp/pp.h
|
||||
--- qtscriptgenerator-src-0.1.0/generator.orig/parser/rpp/pp.h 2008-12-05 11:01:44.000000000 +0100
|
||||
+++ qtscriptgenerator-src-0.1.0/generator/parser/rpp/pp.h 2008-12-13 10:42:22.000000000 +0100
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <cctype>
|
||||
|
||||
#include <fcntl.h>
|
||||
+#include <cstdio>
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
# include <sys/mman.h>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@ |
||||
{ lib, libgpiod, buildPythonPackage, fetchurl }: |
||||
|
||||
buildPythonPackage rec { |
||||
pname = "rpi-gpio2"; |
||||
version = "0.3.0a3"; |
||||
|
||||
# PyPi source does not work for some reason |
||||
src = fetchurl { |
||||
url = "https://github.com/underground-software/RPi.GPIO2/archive/refs/tags/v${version}.tar.gz"; |
||||
sha256 = "sha256-AY1AD2Yu66eJUqB4OStZnUeEhmISLVRrTOAcmEHjuOM="; |
||||
}; |
||||
|
||||
propagatedBuildInputs = [ |
||||
libgpiod |
||||
]; |
||||
|
||||
# Disable checks because they need to run on the specific platform |
||||
doCheck = false; |
||||
|
||||
meta = with lib; { |
||||
homepage = "https://github.com/underground-software/RPi.GPIO2"; |
||||
description = '' |
||||
Compatibility layer between RPi.GPIO syntax and libgpiod semantics |
||||
''; |
||||
license = licenses.gpl3Plus; |
||||
maintainers = with maintainers; [ onny ]; |
||||
}; |
||||
} |
@ -0,0 +1,11 @@ |
||||
{ |
||||
"url": "https://github.com/ambroisie/tree-sitter-tiger", |
||||
"rev": "eb1d3714998977ae76ca7c6a102b10ee37efc2b5", |
||||
"date": "2022-06-13T13:43:12+02:00", |
||||
"path": "/nix/store/97jbgip2nh59zrxyhnqlmw14g25c7g89-tree-sitter-tiger", |
||||
"sha256": "1p1hn99lsmqlmqgv7i3yw2jsqbj5xrrnvs87wkir74y7li2h9g4i", |
||||
"fetchLFS": false, |
||||
"fetchSubmodules": false, |
||||
"deepClone": false, |
||||
"leaveDotGit": false |
||||
} |
@ -0,0 +1,50 @@ |
||||
{ lib, stdenvNoCC, fetchFromGitHub, makeWrapper, curl, jq, coreutils }: |
||||
|
||||
stdenvNoCC.mkDerivation { |
||||
pname = "discord-sh"; |
||||
version = "unstable-2022-05-19"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "ChaoticWeg"; |
||||
repo = "discord.sh"; |
||||
rev = "6aaea548f88eb48b7adeef824fbddac1c4749447"; |
||||
sha256 = "sha256-RoPhn/Ot4ID1nEbZEz1bd2iq8g7mU2e7kwNRvZOD/pc="; |
||||
}; |
||||
|
||||
# ignore Makefile by disabling buildPhase. Upstream Makefile tries to download |
||||
# binaries from the internet for linting |
||||
dontBuild = true; |
||||
|
||||
# discord.sh looks for the .webhook file in the source code directory, which |
||||
# isn't mutable on Nix |
||||
postPatch = '' |
||||
substituteInPlace discord.sh \ |
||||
--replace 'thisdir="$(cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" && pwd)"' 'thisdir="$(pwd)"' |
||||
''; |
||||
|
||||
nativeBuildInputs = [ makeWrapper ]; |
||||
|
||||
doInstallCheck = true; |
||||
|
||||
installCheckPhase = '' |
||||
runHook preCheck |
||||
$out/bin/discord.sh --help |
||||
runHook postCheck |
||||
''; |
||||
|
||||
installPhase = '' |
||||
runHook preInstall |
||||
install -Dm555 discord.sh $out/bin/discord.sh |
||||
wrapProgram $out/bin/discord.sh \ |
||||
--set PATH "${lib.makeBinPath [ curl jq coreutils ]}" |
||||
runHook postInstall |
||||
''; |
||||
|
||||
meta = with lib; { |
||||
description = "Write-only command-line Discord webhook integration written in 100% Bash script"; |
||||
homepage = "https://github.com/ChaoticWeg/discord.sh"; |
||||
license = licenses.gpl3; |
||||
platforms = platforms.unix; |
||||
maintainers = with maintainers; [ matthewcroughan ]; |
||||
}; |
||||
} |
Loading…
Reference in new issue