mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 10:23:29 +00:00
Merge pull request #312251 from thenhnn/filesender-packaging-simplesamlphp-module
nixos/simplesamlphp: init
This commit is contained in:
commit
4bb2fe0d38
@ -14496,6 +14496,12 @@
|
||||
githubId = 399535;
|
||||
name = "Niklas Hambüchen";
|
||||
};
|
||||
nhnn = {
|
||||
matrix = "@nhnn:nhnn.dev";
|
||||
github = "thenhnn";
|
||||
githubId = 162156666;
|
||||
name = "nhnn";
|
||||
};
|
||||
nhooyr = {
|
||||
email = "anmol@aubble.com";
|
||||
github = "nhooyr";
|
||||
|
@ -226,6 +226,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
|
||||
|
||||
- [keto](https://www.ory.sh/keto/), a permission & access control server, the first open source implementation of ["Zanzibar: Google's Consistent, Global Authorization System"](https://research.google/pubs/zanzibar-googles-consistent-global-authorization-system/).
|
||||
|
||||
- [SimpleSAMLphp](https://simplesamlphp.org/), an application written in native PHP that deals with authentication (SQL, .htpasswd, YubiKey, LDAP, PAPI, Radius). Available as [services.simplesamlphp](#opt-services.simplesamlphp).
|
||||
|
||||
## Backward Incompatibilities {#sec-release-24.05-incompatibilities}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
@ -1426,6 +1426,7 @@
|
||||
./services/web-apps/selfoss.nix
|
||||
./services/web-apps/shiori.nix
|
||||
./services/web-apps/silverbullet.nix
|
||||
./services/web-apps/simplesamlphp.nix
|
||||
./services/web-apps/slskd.nix
|
||||
./services/web-apps/snipe-it.nix
|
||||
./services/web-apps/sogo.nix
|
||||
|
128
nixos/modules/services/web-apps/simplesamlphp.nix
Normal file
128
nixos/modules/services/web-apps/simplesamlphp.nix
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.simplesamlphp;
|
||||
|
||||
format = pkgs.formats.php { finalVariable = "config"; };
|
||||
|
||||
generateConfig =
|
||||
opts:
|
||||
pkgs.runCommand "simplesamlphp-config" { } ''
|
||||
mkdir $out
|
||||
cp ${format.generate "config.php" opts.settings} $out/config.php
|
||||
cp ${format.generate "authsources.php" opts.authSources} $out/authsources.php
|
||||
'';
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ nhnn ];
|
||||
};
|
||||
|
||||
options.services.simplesamlphp =
|
||||
with lib;
|
||||
mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule (
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
package = mkPackageOption pkgs "simplesamlphp" { };
|
||||
configureNginx = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Configure nginx as a reverse proxy for SimpleSAMLphp.";
|
||||
};
|
||||
phpfpmPool = mkOption {
|
||||
type = types.str;
|
||||
description = "The PHP-FPM pool that serves SimpleSAMLphp instance.";
|
||||
};
|
||||
localDomain = mkOption {
|
||||
type = types.str;
|
||||
description = "The domain serving your SimpleSAMLphp instance. This option modifies only /saml route.";
|
||||
};
|
||||
settings = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = format.type;
|
||||
options = {
|
||||
baseurlpath = mkOption {
|
||||
type = types.str;
|
||||
example = "https://filesender.example.com/saml/";
|
||||
description = "URL where SimpleSAMLphp can be reached.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration options used by SimpleSAMLphp.
|
||||
See [](https://simplesamlphp.org/docs/stable/simplesamlphp-install)
|
||||
for available options.
|
||||
'';
|
||||
};
|
||||
|
||||
authSources = mkOption {
|
||||
type = format.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Auth sources options used by SimpleSAMLphp.
|
||||
'';
|
||||
};
|
||||
|
||||
libDir = mkOption {
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
Path to the SimpleSAMLphp library directory.
|
||||
'';
|
||||
};
|
||||
configDir = mkOption {
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
Path to the SimpleSAMLphp config directory.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
libDir = "${config.package}/share/php/simplesamlphp/";
|
||||
configDir = "${generateConfig config}";
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = { };
|
||||
description = "Instances of SimpleSAMLphp. This module is designed to work with already existing PHP-FPM pool and NGINX virtualHost.";
|
||||
};
|
||||
|
||||
config = {
|
||||
services.phpfpm.pools = lib.mapAttrs' (
|
||||
phpfpmName: opts:
|
||||
lib.nameValuePair opts.phpfpmPool { phpEnv.SIMPLESAMLPHP_CONFIG_DIR = "${generateConfig opts}"; }
|
||||
) cfg;
|
||||
|
||||
services.nginx.virtualHosts = lib.mapAttrs' (
|
||||
phpfpmName: opts:
|
||||
lib.nameValuePair opts.localDomain (
|
||||
lib.mkIf opts.configureNginx {
|
||||
locations."^~ /saml/" = {
|
||||
alias = "${opts.package}/share/php/simplesamlphp/www/";
|
||||
extraConfig = ''
|
||||
location ~ ^(?<prefix>/saml)(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ {
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.${phpfpmName}.socket};
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$phpfile;
|
||||
fastcgi_param SCRIPT_NAME /saml$phpfile;
|
||||
fastcgi_param PATH_INFO $pathinfo if_not_empty;
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
) cfg;
|
||||
};
|
||||
}
|
25
pkgs/by-name/si/simplesamlphp/package.nix
Normal file
25
pkgs/by-name/si/simplesamlphp/package.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
php,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
}:
|
||||
php.buildComposerProject (finalAttrs: {
|
||||
pname = "simplesamlphp";
|
||||
version = "1.19.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "simplesamlphp";
|
||||
repo = "simplesamlphp";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-Qmy9fuZq8MBqvYV6/u3Dg92pHHicuUhdNeB22u4hwwA=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-FMFD0AXmD7Rq4d9+aNtGVk11YuOt40FWEqxvf+gBjmI=";
|
||||
|
||||
meta = {
|
||||
description = "SimpleSAMLphp is an application written in native PHP that deals with authentication (SQL, .htpasswd, YubiKey, LDAP, PAPI, Radius).";
|
||||
homepage = "https://simplesamlphp.org";
|
||||
license = lib.licenses.lgpl21;
|
||||
maintainers = with lib.maintainers; [ nhnn ];
|
||||
};
|
||||
})
|
Loading…
Reference in New Issue
Block a user