mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.git
synced 2025-02-05 07:50:37 +00:00
docs(en): Better use of let statements
This commit is contained in:
parent
f92476ccc3
commit
64bd5f8cb2
|
@ -34,6 +34,12 @@ While custom SelfPrivacy modules give you great flexibility, using third-party m
|
|||
We recommend that you only use modules you have written yourself or forked and analyzed carefully.
|
||||
{{% /alert %}}
|
||||
|
||||
## Learning resources
|
||||
|
||||
This manual focuses on topics specific to SelfPrivacy modules and implies that you are already familiar with Nix, NixOS and Nix flakes. If you are new to Nix, here are some good starting points to learn about it:
|
||||
|
||||
- [Nix language basics](https://nix.dev/tutorials/nix-language.html)
|
||||
- [NixOS & Flakes Book](https://nixos-and-flakes.thiscute.world/preface)
|
||||
|
||||
## Directory structure
|
||||
|
||||
|
@ -225,7 +231,7 @@ in
|
|||
# It MUST use lib.mkIf with an enable option.
|
||||
# This makes sure your module only makes changes to the system
|
||||
# if the module is enabled.
|
||||
config = lib.mkIf config.selfprivacy.modules.service_id.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
# If your service stores data on disk, you have to mount a folder
|
||||
# for this. useBinds is always true on modern SelfPrivacy installations
|
||||
# but we keep this mkIf to keep migration flow possible.
|
||||
|
@ -245,7 +251,7 @@ in
|
|||
# You can use defined options here.
|
||||
services.service = {
|
||||
enable = true;
|
||||
domain = "${cfg.subdomain}.${config.selfprivacy.domain}";
|
||||
domain = "${cfg.subdomain}.${sp.domain}";
|
||||
config = {
|
||||
theme = cfg.defaultTheme;
|
||||
appName = cfg.appName;
|
||||
|
@ -266,8 +272,8 @@ in
|
|||
};
|
||||
};
|
||||
# You can define a reverse proxy for your service like this
|
||||
services.nginx.virtualHosts."${cfg.subdomain}.${config.selfprivacy.domain}" = {
|
||||
useACMEHost = config.selfprivacy.domain;
|
||||
services.nginx.virtualHosts."${cfg.subdomain}.${sp.domain}" = {
|
||||
useACMEHost = sp.domain;
|
||||
forceSSL = true;
|
||||
extraConfig = ''
|
||||
add_header Strict-Transport-Security $hsts_header;
|
||||
|
@ -904,9 +910,9 @@ You MUST use this value like this:
|
|||
```nix
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
domain = config.selfprivacy.domain;
|
||||
sp = config.selfprivacy;
|
||||
cfg = sp.modules.mumble;
|
||||
domain = sp.domain;
|
||||
in
|
||||
{
|
||||
options.selfprivacy.modules.mumble = {
|
||||
|
|
Loading…
Reference in a new issue