diff options
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/default.nix | 2 | ||||
| -rw-r--r-- | nix/module.nix | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/nix/default.nix b/nix/default.nix index b626a80..8776839 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,6 +1,6 @@ {mkYarnPackage, ...}: mkYarnPackage rec { - name = "getchoo-website"; + pname = "getchoo-website"; src = builtins.path { path = ../.; diff --git a/nix/module.nix b/nix/module.nix new file mode 100644 index 0000000..decb686 --- /dev/null +++ b/nix/module.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.services.getchoo-website; + inherit (lib) mkEnableOption mkIf mkOption types; +in { + options.services.getchoo-website = { + enable = mkEnableOption "enable getchoo-website"; + + hostName = mkOption { + type = types.str; + description = "hostname for nginx virtualHost"; + }; + + location = mkOption { + type = types.str; + default = "/"; + description = "location to serve on virtualHost"; + }; + }; + + config.services.nginx = mkIf cfg.enable { + enable = true; + virtualHosts.${cfg.hostName} = { + locations.${cfg.location} = { + root = "${pkgs.getchoo-website}/libexec/getchoo-website/deps/getchoo-website/dist/"; + index = "index.html"; + tryFiles = "$uri =404"; + }; + }; + }; +} |
