packages: init simplesamlphp

This commit is contained in:
Oystein Kristoffer Tveit 2024-03-29 01:40:43 +01:00
parent b0f8bd7bfa
commit b185ac3e9d
2 changed files with 38 additions and 0 deletions

View File

@ -125,6 +125,8 @@
# TODO: remove this once nixos 24.05 gets released # TODO: remove this once nixos 24.05 gets released
####################### #######################
heimdal = pkgs.callPackage ./packages/heimdal { }; heimdal = pkgs.callPackage ./packages/heimdal { };
simplesamlphp = pkgs.callPackage ./packages/simplesamlphp { };
} // nixlib.genAttrs allMachines } // nixlib.genAttrs allMachines
(machine: self.nixosConfigurations.${machine}.config.system.build.toplevel); (machine: self.nixosConfigurations.${machine}.config.system.build.toplevel);
}; };

View File

@ -0,0 +1,36 @@
{ php
, writeText
, fetchFromGitHub
, configFile ? "config/config.php.dist"
, authsourcesFile ? "config/authsources.php.dist"
, saml20-idp-remoteFile ? writeText "saml20-idp-remote.php" "<?php ?>"
}:
php.buildComposerProject rec {
pname = "simplesamlphp";
version = "2.2.1";
src = fetchFromGitHub {
owner = "simplesamlphp";
repo = "simplesamlphp";
rev = "v${version}";
hash = "sha256-jo7xma60M4VZgeDgyFumvJp1Sm+RP4XaugDkttQVB+k=";
};
composerStrictValidation = false;
vendorHash = "sha256-n6lJ/Fb6xI124PkKJMbJBDiuISlukWQcHl043uHoBb4=";
# TODO: metadata could be fetched automagically with these:
# - https://simplesamlphp.org/docs/contrib_modules/metarefresh/simplesamlphp-automated_metadata.html
# - https://idp.pvv.ntnu.no/simplesaml/saml2/idp/metadata.php
postPatch = ''
install -Dm444 "${configFile}" "config/config.php"
install -Dm444 "${authsourcesFile}" "config/authsources.php"
install -Dm444 "${saml20-idp-remoteFile}" "metadata/saml20-idp-remote.php"
'';
postInstall = ''
ln -sr $out/share/php/simplesamlphp/vendor/simplesamlphp/simplesamlphp-assets-base $out/share/php/simplesamlphp/public/assets/base
'';
}