2 description = "Custom Gitweb Package and FCGI Service Wrapper";
5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
8 outputs = { self, nixpkgs, ... }:
10 systems = [ "x86_64-linux" "aarch64-linux" ];
11 forAllSystems = nixpkgs.lib.genAttrs systems;
14 packages = forAllSystems (system:
16 pkgs = nixpkgs.legacyPackages.${system};
18 perlDeps = with pkgs.perlPackages; [
28 default = pkgs.stdenv.mkDerivation {
32 # Assuming source is in the same directory
35 buildInputs = [ pkgs.perl pkgs.gzip ] ++ perlDeps;
37 buildFlags = [ "gitweb" ];
39 # 2. The requested postInstall logic
42 cp gitweb/gitweb.cgi $out/gitweb.cgi
43 cp gitweb/static/git* $out/static/
45 # Ensure the file exists (standard gitweb location)
46 # If your makefile installs elsewhere, adjust this check.
47 if [ -f "$out/gitweb.cgi" ]; then
50 sed -i -e "s|'compressor' => \['gzip'|'compressor' => ['${pkgs.gzip}/bin/gzip'|" \
53 # Patch Perl Libs (Injecting dependencies into @INC)
54 for p in ${pkgs.lib.concatStringsSep " " perlDeps}; do
55 sed -i -e "/use CGI /i use lib \"$p/${pkgs.perl.libPrefix}\";" \
59 echo "Warning: gitweb.cgi not found in $out/"