treesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorpatrick-scho2025-11-29 13:31:39 +0100
committerpatrick-scho2025-11-29 13:31:39 +0100
commit12047d230075bac819e179eb8814c97fd18da8b4 (patch)
tree3a4adf31cbc9883a3540c6829a41e69bb7164212
parent79a9e5adac25223540ccb8d6bfa71ca4591caf9a (diff)
downloadps-gitweb-12047d230075bac819e179eb8814c97fd18da8b4.tar.gz
ps-gitweb-12047d230075bac819e179eb8814c97fd18da8b4.zip
flake.nix
-rw-r--r--flake.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..07d1cdd
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,66 @@
+{
+ description = "Custom Gitweb Package and FCGI Service Wrapper";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ };
+
+ outputs = { self, nixpkgs, ... }:
+ let
+ systems = [ "x86_64-linux" "aarch64-linux" ];
+ forAllSystems = nixpkgs.lib.genAttrs systems;
+ in
+ {
+ packages = forAllSystems (system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+
+ perlDeps = with pkgs.perlPackages; [
+ CGI
+ HTMLParser
+ CGIFast
+ FCGI
+ FCGIProcManager
+ HTMLTagCloud
+ ];
+ in
+ {
+ default = pkgs.stdenv.mkDerivation {
+ pname = "ps-gitweb";
+ version = "1.0.0";
+
+ # Assuming source is in the same directory
+ src = ./.;
+
+ nativeBuildInputs = [ pkgs.makeWrapper ];
+ buildInputs = [ pkgs.perl pkgs.gzip ] ++ perlDeps;
+
+ buildFlags = [ "gitweb" ];
+
+ # 2. The requested postInstall logic
+ postInstall = ''
+ mkdir -p $out/static
+ cp gitweb/gitweb.cgi $out/gitweb.cgi
+ cp gitweb/static/git* $out/static/
+
+ # Ensure the file exists (standard gitweb location)
+ # If your makefile installs elsewhere, adjust this check.
+ if [ -f "$out/gitweb/gitweb.cgi" ]; then
+
+ # Patch gzip path
+ sed -i -e "s|'compressor' => \['gzip'|'compressor' => ['${pkgs.gzip}/bin/gzip'|" \
+ $out/gitweb/gitweb.cgi
+
+ # Patch Perl Libs (Injecting dependencies into @INC)
+ for p in ${pkgs.lib.concatStringsSep " " perlDeps}; do
+ sed -i -e "/use CGI /i use lib \"$p/${pkgs.perl.libPrefix}\";" \
+ "$out/gitweb/gitweb.cgi"
+ done
+ else
+ echo "Warning: gitweb.cgi not found in $out/gitweb/"
+ fi
+ '';
+ };
+ });
+ };
+}