diff options
author | Michael Weiss <dev.primeos@gmail.com> | 2018-09-08 16:45:58 +0200 |
---|---|---|
committer | Michael Weiss <dev.primeos@gmail.com> | 2018-09-08 17:01:35 +0200 |
commit | 53ef5441bb261bcb52b5ffe7cab77ba46114e7e9 (patch) | |
tree | 6bdafe5b5e7ca6623374709bde3e508b6a87d0ec | |
parent | eb0050ca458870deb17e0bedfdf1eeda3c67bf9e (diff) | |
download | nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.tar nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.tar.gz nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.tar.bz2 nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.tar.lz nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.tar.xz nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.tar.zst nixlib-53ef5441bb261bcb52b5ffe7cab77ba46114e7e9.zip |
nixos/sks: Make the webroot option optional
That way the built-in web server is usable by default but users can use $HOME/web directly (instead of having to use a symlink), if they want to customize the webpage.
-rw-r--r-- | nixos/modules/services/security/sks.nix | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/nixos/modules/services/security/sks.nix b/nixos/modules/services/security/sks.nix index e285b94b170a..9f0261038d5b 100644 --- a/nixos/modules/services/security/sks.nix +++ b/nixos/modules/services/security/sks.nix @@ -55,17 +55,18 @@ in { }; webroot = mkOption { - type = types.path; + type = types.nullOr types.path; default = "${sksPkg.webSamples}/OpenPKG"; defaultText = "\${pkgs.sks.webSamples}/OpenPKG"; description = '' - Source directory (will be symlinked) for the files the built-in - webserver should serve. SKS (''${pkgs.sks.webSamples}) provides the - following examples: "HTML5", "OpenPKG", and "XHTML+ES". The index - file can be named index.html, index.htm, index.xhtm, or index.xhtml. - Files with the extensions .css, .es, .js, .jpg, .jpeg, .png, or .gif - are supported. Subdirectories and filenames with anything other than - alphanumeric characters and the '.' character will be ignored. + Source directory (will be symlinked, if not null) for the files the + built-in webserver should serve. SKS (''${pkgs.sks.webSamples}) + provides the following examples: "HTML5", "OpenPKG", and "XHTML+ES". + The index file can be named index.html, index.htm, index.xhtm, or + index.xhtml. Files with the extensions .css, .es, .js, .jpg, .jpeg, + .png, or .gif are supported. Subdirectories and filenames with + anything other than alphanumeric characters and the '.' character + will be ignored. ''; }; }; @@ -95,7 +96,8 @@ in { after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; preStart = '' - ln -sfT "${cfg.webroot}" web + ${lib.optionalString (cfg.webroot != null) + "ln -sfT \"${cfg.webroot}\" web"} mkdir -p dump ${sksPkg}/bin/sks build dump/*.gpg -n 10 -cache 100 || true #*/ ${sksPkg}/bin/sks cleandb || true |