feat: add nix module

This commit is contained in:
Jet Pham 2026-03-09 18:26:50 -07:00
parent 9905bf8759
commit e25803a767
No known key found for this signature in database
2 changed files with 32 additions and 1 deletions

View file

@ -41,5 +41,7 @@
]; ];
}; };
} }
)); )) // {
nixosModules.default = import ./module.nix self;
};
} }

29
module.nix Normal file
View file

@ -0,0 +1,29 @@
self:
{ config, lib, ... }:
let
cfg = config.services.jetpham-website;
package = self.packages.x86_64-linux.default;
in
{
options.services.jetpham-website = {
enable = lib.mkEnableOption "Jet Pham's personal website";
domain = lib.mkOption {
type = lib.types.str;
default = "jetpham.com";
description = "Domain to serve the website on.";
};
};
config = lib.mkIf cfg.enable {
services.caddy.virtualHosts.${cfg.domain} = {
extraConfig = ''
header Cross-Origin-Opener-Policy "same-origin"
header Cross-Origin-Embedder-Policy "require-corp"
root * ${package}
file_server
'';
};
};
}