nixos: gitit service, change yesNo to bool and add toYesNo from bool

This commit is contained in:
Edward Tjörnhammar 2015-08-03 22:27:42 +02:00
parent 4dde32b4f2
commit 4802a277a4

View File

@ -8,6 +8,8 @@ let
homeDir = "/var/lib/gitit"; homeDir = "/var/lib/gitit";
toYesNo = b: if b then "yes" else "no";
gititShared = with cfg.haskellPackages; gitit + "/share/" + pkgs.stdenv.system + "-" + ghc.name + "/" + gitit.pname + "-" + gitit.version; gititShared = with cfg.haskellPackages; gitit + "/share/" + pkgs.stdenv.system + "-" + ghc.name + "/" + gitit.pname + "-" + gitit.version;
gititWithPkgs = hsPkgs: extras: hsPkgs.ghcWithPackages (self: with self; [ gitit ] ++ (extras self)); gititWithPkgs = hsPkgs: extras: hsPkgs.ghcWithPackages (self: with self; [ gitit ] ++ (extras self));
@ -18,7 +20,7 @@ let
#!${stdenv.shell} #!${stdenv.shell}
cd $HOME cd $HOME
export PATH="${makeSearchPath "bin" ( export PATH="${makeSearchPath "bin" (
[ git curl ] ++ (if cfg.pdfExport == "yes" then [texLiveFull] else []) [ git curl ] ++ (if cfg.pdfExport then [texLiveFull] else [])
)}:$PATH"; )}:$PATH";
export NIX_GHC="${env}/bin/ghc" export NIX_GHC="${env}/bin/ghc"
export NIX_GHCPKG="${env}/bin/ghc-pkg" export NIX_GHCPKG="${env}/bin/ghc-pkg"
@ -27,11 +29,7 @@ let
${env}/bin/gitit -f ${configFile} ${env}/bin/gitit -f ${configFile}
''; '';
gititOptions = let gititOptions = {
yesNo = types.enum [ "yes" "no" ];
in {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@ -202,8 +200,8 @@ let
}; };
showLhsBirdTracks = mkOption { showLhsBirdTracks = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = '' description = ''
Specifies whether to show Haskell code blocks in "bird style", with Specifies whether to show Haskell code blocks in "bird style", with
"> " at the beginning of each line. "> " at the beginning of each line.
@ -283,8 +281,8 @@ let
}; };
tableOfContents = mkOption { tableOfContents = mkOption {
type = yesNo; type = types.bool;
default = "yes"; default = true;
description = '' description = ''
Specifies whether to print a tables of contents (with links to Specifies whether to print a tables of contents (with links to
sections) on each wiki page. sections) on each wiki page.
@ -306,8 +304,8 @@ let
}; };
useCache = mkOption { useCache = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = '' description = ''
Specifies whether to cache rendered pages. Note that if use-feed is Specifies whether to cache rendered pages. Note that if use-feed is
selected, feeds will be cached regardless of the value of use-cache. selected, feeds will be cached regardless of the value of use-cache.
@ -338,14 +336,14 @@ let
}; };
debugMode = mkOption { debugMode = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = "Causes debug information to be logged while gitit is running."; description = "Causes debug information to be logged while gitit is running.";
}; };
compressResponses = mkOption { compressResponses = mkOption {
type = yesNo; type = types.bool;
default = "yes"; default = true;
description = "Specifies whether HTTP responses should be compressed."; description = "Specifies whether HTTP responses should be compressed.";
}; };
@ -363,10 +361,10 @@ let
}; };
useReCaptcha = mkOption { useReCaptcha = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = '' description = ''
If "yes", causes gitit to use the reCAPTCHA service If true, causes gitit to use the reCAPTCHA service
(http://recaptcha.net) to prevent bots from creating accounts. (http://recaptcha.net) to prevent bots from creating accounts.
''; '';
}; };
@ -471,8 +469,8 @@ let
}; };
useFeed = mkOption { useFeed = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = '' description = ''
Specifies whether an ATOM feed should be enabled (for the site and Specifies whether an ATOM feed should be enabled (for the site and
for individual pages). for individual pages).
@ -490,8 +488,8 @@ let
}; };
absoluteUrls = mkOption { absoluteUrls = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = '' description = ''
Make wikilinks absolute with respect to the base-url. So, for Make wikilinks absolute with respect to the base-url. So, for
example, in a wiki served at the base URL '/wiki', on a page example, in a wiki served at the base URL '/wiki', on a page
@ -514,8 +512,8 @@ let
}; };
pdfExport = mkOption { pdfExport = mkOption {
type = yesNo; type = types.bool;
default = "no"; default = false;
description = '' description = ''
If yes, PDF will appear in export options. PDF will be created using If yes, PDF will appear in export options. PDF will be created using
pdflatex, which must be installed and in the path. Note that PDF pdflatex, which must be installed and in the path. Note that PDF
@ -537,8 +535,8 @@ let
}; };
xssSanitize = mkOption { xssSanitize = mkOption {
type = yesNo; type = types.bool;
default = "yes"; default = true;
description = '' description = ''
If yes, all HTML (including that produced by pandoc) is filtered If yes, all HTML (including that produced by pandoc) is filtered
through xss-sanitize. Set to no only if you trust all of your users. through xss-sanitize. Set to no only if you trust all of your users.
@ -560,7 +558,7 @@ let
default-page-type: ${cfg.defaultPageType} default-page-type: ${cfg.defaultPageType}
math: ${cfg.math} math: ${cfg.math}
mathjax-script: ${cfg.mathJaxScript} mathjax-script: ${cfg.mathJaxScript}
show-lhs-bird-tracks: ${cfg.showLhsBirdTracks} show-lhs-bird-tracks: ${toYesNo cfg.showLhsBirdTracks}
templates-dir: ${cfg.templatesDir} templates-dir: ${cfg.templatesDir}
log-file: ${cfg.logFile} log-file: ${cfg.logFile}
log-level: ${cfg.logLevel} log-level: ${cfg.logLevel}
@ -568,16 +566,16 @@ let
no-delete: ${cfg.noDelete} no-delete: ${cfg.noDelete}
no-edit: ${cfg.noEdit} no-edit: ${cfg.noEdit}
default-summary: ${cfg.defaultSummary} default-summary: ${cfg.defaultSummary}
table-of-contents: ${cfg.tableOfContents} table-of-contents: ${toYesNo cfg.tableOfContents}
plugins: ${cfg.plugins} plugins: ${cfg.plugins}
use-cache: ${cfg.useCache} use-cache: ${toYesNo cfg.useCache}
cache-dir: ${cfg.cacheDir} cache-dir: ${cfg.cacheDir}
max-upload-size: ${cfg.maxUploadSize} max-upload-size: ${cfg.maxUploadSize}
max-page-size: ${cfg.maxPageSize} max-page-size: ${cfg.maxPageSize}
debug-mode: ${cfg.debugMode} debug-mode: ${toYesNo cfg.debugMode}
compress-responses: ${cfg.compressResponses} compress-responses: ${toYesNo cfg.compressResponses}
mime-types-file: ${cfg.mimeTypesFile} mime-types-file: ${cfg.mimeTypesFile}
use-recaptcha: ${cfg.useReCaptcha} use-recaptcha: ${toYesNo cfg.useReCaptcha}
recaptcha-private-key: ${toString cfg.reCaptchaPrivateKey} recaptcha-private-key: ${toString cfg.reCaptchaPrivateKey}
recaptcha-public-key: ${toString cfg.reCaptchaPublicKey} recaptcha-public-key: ${toString cfg.reCaptchaPublicKey}
access-question: ${cfg.accessQuestion} access-question: ${cfg.accessQuestion}
@ -586,14 +584,14 @@ let
rpx-key: ${toString cfg.rpxKey} rpx-key: ${toString cfg.rpxKey}
mail-command: ${cfg.mailCommand} mail-command: ${cfg.mailCommand}
reset-password-message: ${cfg.resetPasswordMessage} reset-password-message: ${cfg.resetPasswordMessage}
use-feed: ${cfg.useFeed} use-feed: ${toYesNo cfg.useFeed}
base-url: ${toString cfg.baseUrl} base-url: ${toString cfg.baseUrl}
absolute-urls: ${cfg.absoluteUrls} absolute-urls: ${toYesNo cfg.absoluteUrls}
feed-days: ${toString cfg.feedDays} feed-days: ${toString cfg.feedDays}
feed-refresh-time: ${toString cfg.feedRefreshTime} feed-refresh-time: ${toString cfg.feedRefreshTime}
pdf-export: ${cfg.pdfExport} pdf-export: ${toYesNo cfg.pdfExport}
pandoc-user-data: ${toString cfg.pandocUserData} pandoc-user-data: ${toString cfg.pandocUserData}
xss-sanitize: ${cfg.xssSanitize} xss-sanitize: ${toYesNo cfg.xssSanitize}
''; '';
in in