forked from tangled.org/core
Monorepo for Tangled

nix: modules: knot: add options for configuring motd

Signed-off-by: dusk <y.bera003.06@protonmail.com>

authored by ptr.pet and committed by Tangled b2f8250e c1b8fd83

Changed files
+33 -1
nix
modules
+32 -1
nix/modules/knot.nix
··· 58 }; 59 }; 60 61 server = { 62 listenAddr = mkOption { 63 type = types.str; ··· 104 cfg.package 105 ]; 106 107 - system.activationScripts.gitConfig = '' 108 mkdir -p "${cfg.repo.scanPath}" 109 chown -R ${cfg.gitUser}:${cfg.gitUser} "${cfg.repo.scanPath}" 110 ··· 116 [receive] 117 advertisePushOptions = true 118 EOF 119 chown -R ${cfg.gitUser}:${cfg.gitUser} "${cfg.stateDir}" 120 ''; 121
··· 58 }; 59 }; 60 61 + motd = mkOption { 62 + type = types.nullOr types.str; 63 + default = null; 64 + description = '' 65 + Message of the day 66 + 67 + The contents are shown as-is; eg. you will want to add a newline if 68 + setting a non-empty message since the knot won't do this for you. 69 + ''; 70 + }; 71 + 72 + motdFile = mkOption { 73 + type = types.nullOr types.path; 74 + default = null; 75 + description = '' 76 + File containing message of the day 77 + 78 + The contents are shown as-is; eg. you will want to add a newline if 79 + setting a non-empty message since the knot won't do this for you. 80 + ''; 81 + }; 82 + 83 server = { 84 listenAddr = mkOption { 85 type = types.str; ··· 126 cfg.package 127 ]; 128 129 + system.activationScripts.gitConfig = let 130 + setMotd = 131 + if cfg.motdFile != null && cfg.motd != null then 132 + throw "motdFile and motd cannot be both set" 133 + else '' 134 + ${optionalString (cfg.motdFile != null) "cat ${cfg.motdFile} > ${cfg.stateDir}/motd"} 135 + ${optionalString (cfg.motd != null) ''printf "${cfg.motd}" > ${cfg.stateDir}/motd''} 136 + ''; 137 + in '' 138 mkdir -p "${cfg.repo.scanPath}" 139 chown -R ${cfg.gitUser}:${cfg.gitUser} "${cfg.repo.scanPath}" 140 ··· 146 [receive] 147 advertisePushOptions = true 148 EOF 149 + ${setMotd} 150 chown -R ${cfg.gitUser}:${cfg.gitUser} "${cfg.stateDir}" 151 ''; 152
+1
nix/vm.nix
··· 48 ]; 49 services.tangled-knot = { 50 enable = true; 51 server = { 52 secretFile = "/var/lib/knot/secret"; 53 hostname = "localhost:6000";
··· 48 ]; 49 services.tangled-knot = { 50 enable = true; 51 + motd = "Welcome to the development knot!\n"; 52 server = { 53 secretFile = "/var/lib/knot/secret"; 54 hostname = "localhost:6000";