feat: fixed flake
This commit is contained in:
1 parent
29ed46aa7f
commit
bb13614d1e
1 file changed
+16
-15
@@ -47,11 +47,11 @@
|
|||||||
|
|
||||||
nixosModules.default = { config, lib, pkgs, ... }:
|
nixosModules.default = { config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.phenix-website;
|
cfg = config.services.all-dressed-programming.phenix-website;
|
||||||
phenix = self.packages.${pkgs.system}.website;
|
phenix = self.packages.${pkgs.system}.website;
|
||||||
pythonEnv = pkgs.python3.withPackages (ps: [ ps.requests ]);
|
pythonEnv = pkgs.python3.withPackages (ps: [ ps.requests ]);
|
||||||
in {
|
in {
|
||||||
options.services.phenix-website = {
|
options.services.all-dressed-programming.phenix-website = {
|
||||||
enable = lib.mkEnableOption "Balle Phenix website";
|
enable = lib.mkEnableOption "Balle Phenix website";
|
||||||
domain = lib.mkOption {
|
domain = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -65,6 +65,10 @@
|
|||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
default = "/var/lib/phenix";
|
default = "/var/lib/phenix";
|
||||||
};
|
};
|
||||||
|
databaseUrl = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
sessionKey = lib.mkOption {
|
sessionKey = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "";
|
default = "";
|
||||||
@@ -87,11 +91,19 @@
|
|||||||
Group = "phenix";
|
Group = "phenix";
|
||||||
};
|
};
|
||||||
|
|
||||||
environment = {
|
environment =
|
||||||
|
{
|
||||||
ASPNETCORE_URLS = "http://0.0.0.0:${toString cfg.port}";
|
ASPNETCORE_URLS = "http://0.0.0.0:${toString cfg.port}";
|
||||||
ASPNETCORE_ENVIRONMENT = "Production";
|
ASPNETCORE_ENVIRONMENT = "Production";
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (cfg.databaseUrl == "") {
|
||||||
ConnectionStrings__Default = "Data Source=${cfg.dataDir}/phenix.db";
|
ConnectionStrings__Default = "Data Source=${cfg.dataDir}/phenix.db";
|
||||||
} // lib.optionalAttrs (cfg.sessionKey != "") {
|
}
|
||||||
|
// lib.optionalAttrs (cfg.databaseUrl != "") {
|
||||||
|
DatabaseProvider = "Postgres";
|
||||||
|
ConnectionStrings__Default = cfg.databaseUrl;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (cfg.sessionKey != "") {
|
||||||
SessionKey = cfg.sessionKey;
|
SessionKey = cfg.sessionKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -109,17 +121,6 @@
|
|||||||
|
|
||||||
users.groups.phenix = {};
|
users.groups.phenix = {};
|
||||||
|
|
||||||
services.nginx = lib.mkIf (cfg.domain != "") {
|
|
||||||
enable = true;
|
|
||||||
virtualHosts.${cfg.domain} = {
|
|
||||||
forceSSL = true;
|
|
||||||
enableACME = true;
|
|
||||||
locations."/" = {
|
|
||||||
proxyPass = "http://127.0.0.1:${toString cfg.port}";
|
|
||||||
proxyWebsockets = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user