feat: add nix module
This commit is contained in:
parent
9905bf8759
commit
e25803a767
2 changed files with 32 additions and 1 deletions
|
|
@ -41,5 +41,7 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
));
|
)) // {
|
||||||
|
nixosModules.default = import ./module.nix self;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
module.nix
Normal file
29
module.nix
Normal 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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue