1
0
Fork 0
myphps/nixos/default.nix

43 lines
925 B
Nix
Raw Normal View History

2025-04-13 17:32:07 +02:00
self: {
2025-04-13 17:13:51 +02:00
lib,
config,
2025-04-13 17:32:07 +02:00
pkgs,
2025-04-13 17:13:51 +02:00
...
}: let
2025-04-13 17:32:07 +02:00
phps = let
packages = self.packages.${pkgs.system};
2025-07-01 21:31:22 +02:00
filter = name: _: (builtins.match "^php[[:digit:]]*$" name) != null;
2025-04-13 17:32:07 +02:00
in
lib.filterAttrs filter packages;
2025-07-01 21:32:50 +02:00
cfg = config.services.myphps;
2025-04-13 17:13:51 +02:00
inherit (lib) types;
in {
2025-04-13 17:18:18 +02:00
options.services.myphps = {
enable = lib.mkEnableOption "myphps";
2025-04-13 17:13:51 +02:00
phps = lib.mkOption {
description = ''
PHPs to use.
'';
default = phps;
type = types.attrsOf types.package;
};
prefix = lib.mkOption {
description = ''
The prefix for every PHP installation.
'';
2025-04-17 22:12:55 +02:00
default = "/run/phps";
2025-04-13 17:13:51 +02:00
type = types.str;
};
};
config = {
2025-05-04 16:44:01 +02:00
systemd.tmpfiles.settings = lib.listToAttrs (lib.mapAttrsToList (name: drv: {
name = "myphps-${name}";
value = {
"${cfg.prefix}/${name}"."L+".argument = drv.outPath;
};
2025-04-13 17:13:51 +02:00
})
2025-05-04 16:44:01 +02:00
phps);
2025-04-13 17:13:51 +02:00
};
}