fix? flake

This commit is contained in:
Jill 2023-05-23 09:10:31 +03:00
parent efcab418f1
commit d2e051b09d
Signed by: oat
GPG Key ID: 33489AA58A955108
1 changed files with 56 additions and 50 deletions

View File

@ -9,7 +9,7 @@
}; };
outputs = { self, nixpkgs, flake-utils, crystal-flake }: outputs = { self, nixpkgs, flake-utils, crystal-flake }:
(with flake-utils.lib; eachSystem defaultSystems) (system: flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
inherit (crystal-flake.packages.${system}) crystal shards; inherit (crystal-flake.packages.${system}) crystal shards;
@ -47,8 +47,9 @@
shards shards
]; ];
}; };
}) // {
nixosModule = { config, lib, pkgs, ... }: nixosModules = {
crystal-gauntlet = { config, lib, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.crystal-gauntlet; cfg = config.services.crystal-gauntlet;
@ -67,7 +68,7 @@
}; };
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = self.packages.${system}.default; default = self.defaultPackage.${pkgs.system};
}; };
}; };
@ -75,6 +76,10 @@
systemd.services."crystal-gauntlet" = { systemd.services."crystal-gauntlet" = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment = {
LISTEN_ON = "http://127.0.0.1:${toString cfg.port}";
};
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${getExe cfg.package}"; ExecStart = "${getExe cfg.package}";
@ -88,13 +93,13 @@
}; };
}; };
services.nginx = mkIf cfg.domain { services.nginx = mkIf (cfg.domain != null) {
virtualHosts."${cfg.domain}" = { virtualHosts."${cfg.domain}" = {
enableACME = true; enableACME = true;
forceSSL = false; forceSSL = false;
addSSL = true; addSSL = true;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:${cfg.port}/"; proxyPass = "http://127.0.0.1:${toString cfg.port}/";
}; };
extraConfig = '' extraConfig = ''
client_max_body_size 500M; client_max_body_size 500M;
@ -103,5 +108,6 @@
}; };
}; };
}; };
}); };
};
} }