From dfd2d058bcdbc6b5ede5c2ea804b654eb830b293 Mon Sep 17 00:00:00 2001 From: John Titor <50095635+JohnRTitor@users.noreply.github.com> Date: Sun, 3 Nov 2024 12:58:37 +0530 Subject: [PATCH] configure adminer with the adminer package --- home-manager/web-server-html/default.nix | 28 +++--------- .../default.nix | 4 +- .../index.php | 44 +++++++++++++++++++ 3 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 pkgs/adminer-pematon-with-adminer-theme/index.php diff --git a/home-manager/web-server-html/default.nix b/home-manager/web-server-html/default.nix index 1d6b1b3a..a1368d7a 100644 --- a/home-manager/web-server-html/default.nix +++ b/home-manager/web-server-html/default.nix @@ -3,7 +3,7 @@ # THIS ONLY PLACES THE CONFIG FILES, DOES NOT INSTALL NGINX # For that see ../../dev-environment/nginx.nix # Import of thie module is controlled by bool: servicesSettings.nginx -{pkgs, ...}: +{pkgs, self, ...}: let # Updated adminer adminer-new = pkgs.fetchurl { @@ -29,29 +29,13 @@ in { # To use adminer, just type localhost/dbms/adminer.php in your browser # This configuration automatically places the php file in the correct location - "Website-Instances/adminer/adminer.php".source = adminer-new; - # Adminer theme - "Website-Instances/adminer/index.php" = { - source = ./adminer/index.php; - }; - "Website-Instances/adminer/css" = { - source = "${adminer-theme}/lib/css"; - recursive = true; - }; - "Website-Instances/adminer/fonts" = { - source = "${adminer-theme}/lib/fonts"; + # Adminer pematon (new version) with adminer theme + # After any changes we need to restart the services + # systemctl restart phpfpm-mypool.service nginx.service + "Website-Instances/adminer" = { + source = self.packages.${pkgs.system}.adminer-pematon-with-adminer-theme; recursive = true; }; - "Website-Instances/adminer/images" = { - source = "${adminer-theme}/lib/images"; - recursive = true; - }; - "Website-Instances/adminer/plugins/AdminerTheme.php" = { - source = "${adminer-theme}/lib/plugins/AdminerTheme.php"; - }; - "Website-Instances/adminer/plugins/plugin.php" = { - source = adminer-new-plugin-php; - }; }; } diff --git a/pkgs/adminer-pematon-with-adminer-theme/default.nix b/pkgs/adminer-pematon-with-adminer-theme/default.nix index f25a00dc..1fadd10f 100644 --- a/pkgs/adminer-pematon-with-adminer-theme/default.nix +++ b/pkgs/adminer-pematon-with-adminer-theme/default.nix @@ -16,7 +16,7 @@ adminer-pematon.overrideAttrs (finalAttrs: oldAttrs: { # substituteInPlace won't work here as it can't interprete \t \n postInstall = (oldAttrs.postInstall or "") + '' cp -r ${finalAttrs.adminerTheme}/lib/* $out/ - - sed -i '/return new \\AdminerPlugin($plugins);/i \\t $plugins[] = new AdminerTheme();' $out/index.php + rm $out/index.php + cp ${./index.php} $out/index.php ''; }) \ No newline at end of file diff --git a/pkgs/adminer-pematon-with-adminer-theme/index.php b/pkgs/adminer-pematon-with-adminer-theme/index.php new file mode 100644 index 00000000..6861afc0 --- /dev/null +++ b/pkgs/adminer-pematon-with-adminer-theme/index.php @@ -0,0 +1,44 @@ + "default-orange"]), + $plugins[] = new \AdminerTheme("default-green"); + + return new \AdminerPlugin($plugins); + } +} + +namespace { + function adminer_object() { + return \nixos\adminer_object(); + } + + require(__DIR__ . '/adminer.php'); +} \ No newline at end of file