krebs git: refactor

This commit is contained in:
jeschli 2018-08-01 13:55:10 +02:00
parent d487c1b5c2
commit dbbf237393

View File

@ -8,6 +8,21 @@
with import <stockholm/lib>; with import <stockholm/lib>;
let let
defaultBool = o: mkOption {
type = types.bool;
default = option;
};
defaultUint = o: mkOption {
type = types.uint;
default = o;
};
defaultAbsolutpath = o: mkOption {
type = types.absolute-pathname;
default = o;
};
cfg = config.krebs.git; cfg = config.krebs.git;
out = { out = {
@ -121,42 +136,15 @@ let
cgit-settings = types.submodule { cgit-settings = types.submodule {
# A setting's value of `null` means cgit's default should be used. # A setting's value of `null` means cgit's default should be used.
options = { options = {
cache-root = mkOption { cache-root = defaultAbsolutpath("/tmp/cgit");
type = types.absolute-pathname; cache-size = defaultUint(1000);
default = "/tmp/cgit"; css = defaultAbsolutpath("/static/cgit.css");
}; enable-commit-graph = defaultBool(true);
cache-size = mkOption { enable-index-links = defaultBool(true);
type = types.uint; enable-index-owner = defaultBool(false);
default = 1000; enable-log-filecount = defaultBool(true);
}; enable-log-linecount = defaultBool(true);
css = mkOption { enable-remote-branches = defaultBool(true);
type = types.absolute-pathname;
default = "/static/cgit.css";
};
enable-commit-graph = mkOption {
type = types.bool;
default = true;
};
enable-index-links = mkOption {
type = types.bool;
default = true;
};
enable-index-owner = mkOption {
type = types.bool;
default = false;
};
enable-log-filecount = mkOption {
type = types.bool;
default = true;
};
enable-log-linecount = mkOption {
type = types.bool;
default = true;
};
enable-remote-branches = mkOption {
type = types.bool;
default = true;
};
logo = mkOption { logo = mkOption {
type = types.absolute-pathname; type = types.absolute-pathname;
default = "/static/cgit.png"; default = "/static/cgit.png";