forked from meterriblecrew/packages
modules/snipe-it: remove PostgreSQL support
Since Laravel, the PHP framework used by Snipe-IT in general supports PostgreSQL and other database systems, there was a slight hope that it would just work™, even though Snipe-IT itself officially only supports MySQL. Turns out it doesn't. SQLite seems to work fine so far.master
parent
f8c0d8a036
commit
1538ca5859
|
@ -19,8 +19,6 @@ let
|
|||
fileinfo
|
||||
bcmath
|
||||
gd
|
||||
] ++ optionals usePgsql [
|
||||
pdo_pgsql
|
||||
] ++ optionals useMysql [
|
||||
pdo_mysql
|
||||
])
|
||||
|
@ -32,7 +30,6 @@ let
|
|||
group = cfg.group;
|
||||
|
||||
db = cfg.database;
|
||||
usePgsql = db.type == "pgsql";
|
||||
useMysql = db.type == "mysql";
|
||||
useSqlite = db.type == "sqlite";
|
||||
|
||||
|
@ -120,8 +117,8 @@ in {
|
|||
|
||||
database = {
|
||||
type = mkOption {
|
||||
type = types.enum [ "pgsql" "mysql" "sqlite" ];
|
||||
default = "pgsql";
|
||||
type = types.enum [ "mysql" "sqlite" ];
|
||||
default = "mysql";
|
||||
description = "Database engine to use.";
|
||||
};
|
||||
host = mkOption {
|
||||
|
@ -140,7 +137,7 @@ in {
|
|||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "snipe-it";
|
||||
description = "Name of the PostgreSQL or MySQL database.";
|
||||
description = "Name of the MySQL database.";
|
||||
};
|
||||
username = mkOption {
|
||||
type = types.str;
|
||||
|
@ -315,12 +312,6 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{ assertion = usePgsql -> db.port == 5432;
|
||||
message = "PostgreSQL is currently only supported with default port 5432.";
|
||||
}
|
||||
];
|
||||
|
||||
warnings =
|
||||
optional (!useMysql) ''
|
||||
Please note: Using another database than MySQL isn't officially supported.
|
||||
|
@ -328,15 +319,6 @@ in {
|
|||
|
||||
environment.systemPackages = [ artisan ];
|
||||
|
||||
services.postgresql = mkIf (usePgsql && db.host == "localhost") {
|
||||
enable = mkDefault true;
|
||||
ensureDatabases = [ db.name ];
|
||||
ensureUsers = [{
|
||||
name = db.username;
|
||||
ensurePermissions = { "DATABASE \"${db.name}\"" = "ALL PRIVILEGES"; };
|
||||
}];
|
||||
};
|
||||
|
||||
services.mysql = mkIf (useMysql && db.host == "localhost") {
|
||||
enable = mkDefault true;
|
||||
package = mkDefault pkgs.mariadb;
|
||||
|
@ -431,8 +413,7 @@ in {
|
|||
systemd.services.snipe-it-setup = {
|
||||
description = "Preparation tasks for Snipe-IT";
|
||||
before = [ "phpfpm-snipe-it.service" ];
|
||||
after = optional useMysql "mysql.service"
|
||||
++ optional usePgsql "postgresql.service";
|
||||
after = optional useMysql "mysql.service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
|
Loading…
Reference in New Issue