summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-10-13 05:00:23 +0200
committerJan Tojnar <jtojnar@gmail.com>2021-10-21 17:40:19 +0200
commit25450f2b29eff6c615eb662144c6c5541abb25b4 (patch)
tree7d1bc36cd52060ccc7f0ee012949271b80197eda
parent5f0194220f2402b06f7f79bba6351895facb5acb (diff)
downloadnixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.tar
nixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.tar.gz
nixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.tar.bz2
nixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.tar.lz
nixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.tar.xz
nixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.tar.zst
nixpkgs-25450f2b29eff6c615eb662144c6c5541abb25b4.zip
blackfire: 1.49.4 → 2.5.1
https://blackfire.io/docs/up-and-running/agent-upgrade
-rw-r--r--nixos/modules/services/development/blackfire.nix13
-rw-r--r--nixos/modules/services/development/blackfire.xml3
-rw-r--r--pkgs/development/tools/misc/blackfire/default.nix23
3 files changed, 24 insertions, 15 deletions
diff --git a/nixos/modules/services/development/blackfire.nix b/nixos/modules/services/development/blackfire.nix
index 6fd948cce38..8564aabc6a3 100644
--- a/nixos/modules/services/development/blackfire.nix
+++ b/nixos/modules/services/development/blackfire.nix
@@ -19,7 +19,7 @@ in {
       enable = lib.mkEnableOption "Blackfire profiler agent";
       settings = lib.mkOption {
         description = ''
-          See https://blackfire.io/docs/configuration/agent
+          See https://blackfire.io/docs/up-and-running/configuration/agent
         '';
         type = lib.types.submodule {
           freeformType = with lib.types; attrsOf str;
@@ -53,13 +53,8 @@ in {
 
     services.blackfire-agent.settings.socket = "unix:///run/${agentSock}";
 
-    systemd.services.blackfire-agent = {
-      description = "Blackfire agent";
-
-      serviceConfig = {
-        ExecStart = "${pkgs.blackfire}/bin/blackfire-agent";
-        RuntimeDirectory = "blackfire";
-      };
-    };
+    systemd.packages = [
+      pkgs.blackfire
+    ];
   };
 }
diff --git a/nixos/modules/services/development/blackfire.xml b/nixos/modules/services/development/blackfire.xml
index ad4af35788d..cecd249dda4 100644
--- a/nixos/modules/services/development/blackfire.xml
+++ b/nixos/modules/services/development/blackfire.xml
@@ -28,13 +28,14 @@ in {
     enable = true;
     settings = {
       # You will need to get credentials at https://blackfire.io/my/settings/credentials
-      # You can also use other options described in https://blackfire.io/docs/configuration/agent
+      # You can also use other options described in https://blackfire.io/docs/up-and-running/configuration/agent
       server-id = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
       server-token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
     };
   };
 
   # Make the agent run on start-up.
+  # (WantedBy= from the upstream unit not respected: https://github.com/NixOS/nixpkgs/issues/81138)
   # Alternately, you can start it manually with `systemctl start blackfire-agent`.
   systemd.services.blackfire-agent.wantedBy = [ "phpfpm-foo.service" ];
 }</programlisting>
diff --git a/pkgs/development/tools/misc/blackfire/default.nix b/pkgs/development/tools/misc/blackfire/default.nix
index c6c8ff2a8a8..6ba1ba06107 100644
--- a/pkgs/development/tools/misc/blackfire/default.nix
+++ b/pkgs/development/tools/misc/blackfire/default.nix
@@ -10,12 +10,12 @@
 }:
 
 stdenv.mkDerivation rec {
-  pname = "blackfire-agent";
-  version = "1.49.4";
+  pname = "blackfire";
+  version = "2.5.1";
 
   src = fetchurl {
-    url = "https://packages.blackfire.io/debian/pool/any/main/b/blackfire-php/blackfire-agent_${version}_amd64.deb";
-    sha256 = "t1S54z3xTMTUBWz0jCFX1A7GJdWWsP/lTa9MMjo8t1A=";
+    url = "https://packages.blackfire.io/debian/pool/any/main/b/blackfire/blackfire_${version}_amd64.deb";
+    sha256 = "wak7LE5j6OKIHqCsEGrxSq1FAFzehMetYj6c/Zkr9dk=";
   };
 
   nativeBuildInputs = [
@@ -32,13 +32,26 @@ stdenv.mkDerivation rec {
     mv $out/usr/* $out
     rmdir $out/usr
 
+    # Fix ExecStart path and replace deprecated directory creation method,
+    # use dynamic user.
+    substituteInPlace "$out/lib/systemd/system/blackfire-agent.service" \
+      --replace '/usr/' "$out/" \
+      --replace 'ExecStartPre=/bin/mkdir -p /var/run/blackfire' 'RuntimeDirectory=blackfire' \
+      --replace 'ExecStartPre=/bin/chown blackfire: /var/run/blackfire' "" \
+      --replace 'User=blackfire' 'DynamicUser=yes' \
+      --replace 'PermissionsStartOnly=true' ""
+
+    # Modernize socket path.
+    substituteInPlace "$out/etc/blackfire/agent" \
+      --replace '/var/run' '/run'
+
     runHook postInstall
   '';
 
   passthru = {
     updateScript = writeShellScript "update-${pname}" ''
       export PATH="${lib.makeBinPath [ curl jq common-updater-scripts ]}"
-      update-source-version "$UPDATE_NIX_ATTR_PATH" "$(curl https://blackfire.io/api/v1/releases | jq .agent --raw-output)"
+      update-source-version "$UPDATE_NIX_ATTR_PATH" "$(curl https://blackfire.io/api/v1/releases | jq .cli --raw-output)"
     '';
   };