diff options
Diffstat (limited to 'nix/module.nix')
| -rw-r--r-- | nix/module.nix | 35 |
1 files changed, 35 insertions, 0 deletions
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"; + }; + }; + }; +} |
