Commit 9443d83e authored by colin's avatar colin
Browse files

freshrss: patchShebangs instead of specifying interpreter at use site

this makes it easier for one to manually administer freshrss.
for example, i can import OPML from the CLI like:

```
$ nix build .#freshrss
$ freshrss FRESHRSS_DATA_PATH=/var/lib/freshrss ./result/cli/import-for-user.php --user admin --file my-opml.opml
```

whereas previously i would have needed to include
`environment.systemPackages = [ php ];` in my system for that to work.
parent b4facda8
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -238,17 +238,17 @@ in
            # do installation or reconfigure
            if test -f ${cfg.dataDir}/config.php; then
              # reconfigure with settings
              ${pkgs.php}/bin/php ./cli/reconfigure.php ${settingsFlags}
              ${pkgs.php}/bin/php ./cli/update-user.php --user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"
              ./cli/reconfigure.php ${settingsFlags}
              ./cli/update-user.php --user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"
            else
              # Copy the user data template directory
              cp -r ./data ${cfg.dataDir}

              # check correct folders in data folder
              ${pkgs.php}/bin/php ./cli/prepare.php
              ./cli/prepare.php
              # install with settings
              ${pkgs.php}/bin/php ./cli/do-install.php ${settingsFlags}
              ${pkgs.php}/bin/php ./cli/create-user.php --user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"
              ./cli/do-install.php ${settingsFlags}
              ./cli/create-user.php --user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"
            fi
          '';
        };
@@ -267,7 +267,7 @@ in
          Group = "freshrss";
          StateDirectory = "freshrss";
          WorkingDirectory = cfg.package;
          ExecStart = "${pkgs.php}/bin/php ./app/actualize_script.php";
          ExecStart = "./app/actualize_script.php";
        } // systemd-hardening;
      };
    };
+13 −1
Original line number Diff line number Diff line
{ stdenvNoCC, lib, fetchFromGitHub, nixosTests, pkgs }:
{ stdenvNoCC
, lib
, fetchFromGitHub
, nixosTests
, php
, pkgs
}:

stdenvNoCC.mkDerivation rec {
  pname = "FreshRSS";
@@ -13,6 +19,8 @@ stdenvNoCC.mkDerivation rec {

  passthru.tests = nixosTests.freshrss;

  buildInputs = [ php ];

  # There's nothing to build.
  dontBuild = true;

@@ -22,6 +30,10 @@ stdenvNoCC.mkDerivation rec {
      define('DATA_PATH', getenv('FRESHRSS_DATA_PATH'));
  '';

  postPatch = ''
    patchShebangs cli/*.php app/actualize_script.php
  '';

  installPhase = ''
    mkdir -p $out
    cp -vr * $out/