···66 "Systemd ${group} field `${name}' must be a valid MAC address.";
6768 assertNetdevMacAddress = name: group: attr:
69- optional (attr ? ${name} && (! isMacAddress attr.${name} || attr.${name} != "none"))
70 "Systemd ${group} field `${name}` must be a valid MAC address or the special value `none`.";
7172
···66 "Systemd ${group} field `${name}' must be a valid MAC address.";
6768 assertNetdevMacAddress = name: group: attr:
69+ optional (attr ? ${name} && (! isMacAddress attr.${name} && attr.${name} != "none"))
70 "Systemd ${group} field `${name}` must be a valid MAC address or the special value `none`.";
7172
+43-18
nixos/modules/services/web-apps/freshrss.nix
···7 poolName = "freshrss";
8in
9{
10- meta.maintainers = with maintainers; [ etu stunkymonkey ];
1112 options.services.freshrss = {
13 enable = mkEnableOption (mdDoc "FreshRSS feed reader");
···27 };
2829 passwordFile = mkOption {
30- type = types.path;
031 description = mdDoc "Password for the defaultUser for FreshRSS.";
32 example = "/run/secrets/freshrss";
33 };
···120 user = mkOption {
121 type = types.str;
122 default = "freshrss";
123- description = lib.mdDoc "User under which Freshrss runs.";
000000124 };
125 };
126···160 };
161 in
162 mkIf cfg.enable {
00000000163 # Set up a Nginx virtual host.
164 services.nginx = mkIf (cfg.virtualHost != null) {
165 enable = true;
···227 settingsFlags = concatStringsSep " \\\n "
228 (mapAttrsToList (k: v: "${k} ${toString v}") {
229 "--default_user" = ''"${cfg.defaultUser}"'';
230- "--auth_type" = ''"form"'';
231 "--base_url" = ''"${cfg.baseUrl}"'';
232 "--language" = ''"${cfg.language}"'';
233 "--db-type" = ''"${cfg.database.type}"'';
···255 FRESHRSS_DATA_PATH = cfg.dataDir;
256 };
257258- script = ''
259- # do installation or reconfigure
260- if test -f ${cfg.dataDir}/config.php; then
261- # reconfigure with settings
262- ./cli/reconfigure.php ${settingsFlags}
263- ./cli/update-user.php --user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"
264- else
265- # check correct folders in data folder
266- ./cli/prepare.php
267- # install with settings
268- ./cli/do-install.php ${settingsFlags}
269- ./cli/create-user.php --user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"
270- fi
271- '';
0000000000272 };
273274 systemd.services.freshrss-updater = {
···7 poolName = "freshrss";
8in
9{
10+ meta.maintainers = with maintainers; [ etu stunkymonkey mattchrist ];
1112 options.services.freshrss = {
13 enable = mkEnableOption (mdDoc "FreshRSS feed reader");
···27 };
2829 passwordFile = mkOption {
30+ type = types.nullOr types.path;
31+ default = null;
32 description = mdDoc "Password for the defaultUser for FreshRSS.";
33 example = "/run/secrets/freshrss";
34 };
···121 user = mkOption {
122 type = types.str;
123 default = "freshrss";
124+ description = lib.mdDoc "User under which FreshRSS runs.";
125+ };
126+127+ authType = mkOption {
128+ type = types.enum [ "form" "http_auth" "none" ];
129+ default = "form";
130+ description = mdDoc "Authentication type for FreshRSS.";
131 };
132 };
133···167 };
168 in
169 mkIf cfg.enable {
170+ assertions = mkIf (cfg.authType == "form") [
171+ {
172+ assertion = cfg.passwordFile != null;
173+ message = ''
174+ `passwordFile` must be supplied when using "form" authentication!
175+ '';
176+ }
177+ ];
178 # Set up a Nginx virtual host.
179 services.nginx = mkIf (cfg.virtualHost != null) {
180 enable = true;
···242 settingsFlags = concatStringsSep " \\\n "
243 (mapAttrsToList (k: v: "${k} ${toString v}") {
244 "--default_user" = ''"${cfg.defaultUser}"'';
245+ "--auth_type" = ''"${cfg.authType}"'';
246 "--base_url" = ''"${cfg.baseUrl}"'';
247 "--language" = ''"${cfg.language}"'';
248 "--db-type" = ''"${cfg.database.type}"'';
···270 FRESHRSS_DATA_PATH = cfg.dataDir;
271 };
272273+ script =
274+ let
275+ userScriptArgs = ''--user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"'';
276+ updateUserScript = optionalString (cfg.authType == "form") ''
277+ ./cli/update-user.php ${userScriptArgs}
278+ '';
279+ createUserScript = optionalString (cfg.authType == "form") ''
280+ ./cli/create-user.php ${userScriptArgs}
281+ '';
282+ in
283+ ''
284+ # do installation or reconfigure
285+ if test -f ${cfg.dataDir}/config.php; then
286+ # reconfigure with settings
287+ ./cli/reconfigure.php ${settingsFlags}
288+ ${updateUserScript}
289+ else
290+ # check correct folders in data folder
291+ ./cli/prepare.php
292+ # install with settings
293+ ./cli/do-install.php ${settingsFlags}
294+ ${createUserScript}
295+ fi
296+ '';
297 };
298299 systemd.services.freshrss-updater = {
···1718stdenv.mkDerivation rec {
19 # Don't forget to update go.d.plugin.nix as well
20- version = "1.40.1";
21 pname = "netdata";
2223 src = fetchFromGitHub {
24 owner = "netdata";
25 repo = "netdata";
26 rev = "v${version}";
27- sha256 = "sha256-4bYCsEeB0kEYtVFVXymFv7ELUo9RXoKbPjOlDKav8Rg=";
28 fetchSubmodules = true;
29 };
30···49 # required to prevent plugins from relying on /etc
50 # and /var
51 ./no-files-in-etc-and-var.patch
52- # The current IPC location is unsafe as it writes
53- # a fixed path in /tmp, which is world-writable.
54- # Therefore we put it into `/run/netdata`, which is owned
55- # by netdata only.
56- ./ipc-socket-in-run.patch
5758 # Avoid build-only inputs in closure leaked by configure command:
59 # https://github.com/NixOS/nixpkgs/issues/175693#issuecomment-1143344162
···1718stdenv.mkDerivation rec {
19 # Don't forget to update go.d.plugin.nix as well
20+ version = "1.41.0";
21 pname = "netdata";
2223 src = fetchFromGitHub {
24 owner = "netdata";
25 repo = "netdata";
26 rev = "v${version}";
27+ sha256 = "sha256-MZQ1ZTghH4bN7kCMqbyQlAGSgE70sYJxjiamTTH/6ds=";
28 fetchSubmodules = true;
29 };
30···49 # required to prevent plugins from relying on /etc
50 # and /var
51 ./no-files-in-etc-and-var.patch
000005253 # Avoid build-only inputs in closure leaked by configure command:
54 # https://github.com/NixOS/nixpkgs/issues/175693#issuecomment-1143344162
···1426 pybitmessage = throw "pybitmessage was removed from nixpkgs as it is stuck on python2"; # Added 2022-01-01
1427 pyext = throw "pyext was removed because it does not support python 3.11, is upstream unmaintained and was unused"; # Added 2022-11-21
1428 pygmentex = texlive.bin.pygmentex; # Added 2019-12-15
1429- pyload = throw "pyload has been removed from nixpkgs, as it was unmaintained"; # Added 2021-03-21
1430 pynagsystemd = throw "pynagsystemd was removed as it was unmaintained and incompatible with recent systemd versions. Instead use its fork check_systemd"; # Added 2020-10-24
1431 pyo3-pack = maturin;
1432 pypi2nix = throw "pypi2nix has been removed due to being unmaintained";
···1426 pybitmessage = throw "pybitmessage was removed from nixpkgs as it is stuck on python2"; # Added 2022-01-01
1427 pyext = throw "pyext was removed because it does not support python 3.11, is upstream unmaintained and was unused"; # Added 2022-11-21
1428 pygmentex = texlive.bin.pygmentex; # Added 2019-12-15
1429+ pyload = throw "pyload has been removed from nixpkgs. Use pyload-ng instead."; # Added 2021-03-21
1430 pynagsystemd = throw "pynagsystemd was removed as it was unmaintained and incompatible with recent systemd versions. Instead use its fork check_systemd"; # Added 2020-10-24
1431 pyo3-pack = maturin;
1432 pypi2nix = throw "pypi2nix has been removed due to being unmaintained";