Skip to content

Commit

Permalink
Merge master into haskell-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 23, 2022
2 parents 99b8c65 + bc01a2b commit 7d66e14
Show file tree
Hide file tree
Showing 125 changed files with 1,763 additions and 769 deletions.
6 changes: 6 additions & 0 deletions lib/types.nix
Expand Up @@ -55,6 +55,7 @@ let
concatMapStringsSep
concatStringsSep
escapeNixString
hasInfix
isCoercibleToString
;
inherit (lib.trivial)
Expand Down Expand Up @@ -360,6 +361,11 @@ rec {
deprecationMessage = "See https://github.com/NixOS/nixpkgs/pull/66346 for better alternative types.";
};

passwdEntry = entryType: addCheck entryType (str: !(hasInfix ":" str || hasInfix "\n" str)) // {
name = "passwdEntry ${entryType.name}";
description = "${entryType.description}, not containing newlines or colons";
};

attrs = mkOptionType {
name = "attrs";
description = "attribute set";
Expand Down
20 changes: 18 additions & 2 deletions maintainers/maintainer-list.nix
Expand Up @@ -845,6 +845,16 @@
githubId = 11699655;
name = "Stanislas Lange";
};
AngryAnt = {
name = "Emil Johansen";
email = "git@eej.dk";
matrix = "@angryant:envs.net";
github = "AngryAnt";
githubId = 102513;
keys = [{
fingerprint = "B7B7 582E 564E 789B FCB8 71AB 0C6D FE2F B234 534A";
}];
};
anhdle14 = {
name = "Le Anh Duc";
email = "anhdle14@icloud.com";
Expand Down Expand Up @@ -5412,10 +5422,10 @@
githubId = 40234257;
name = "ilkecan bozdogan";
};
ihatethefrench = {
not-my-segfault = {
email = "michal@tar.black";
matrix = "@michal:tar.black";
github = "ihatethefrench";
github = "not-my-segfault";
githubId = 30374463;
name = "Michal S.";
};
Expand Down Expand Up @@ -14720,4 +14730,10 @@
github = "dfithian";
githubId = 8409320;
};
nikstur = {
email = "nikstur@outlook.com";
name = "nikstur";
github = "nikstur";
githubId = 61635709;
};
}
16 changes: 5 additions & 11 deletions nixos/modules/config/users-groups.nix
Expand Up @@ -6,12 +6,6 @@ let
ids = config.ids;
cfg = config.users;

isPasswdCompatible = str: !(hasInfix ":" str || hasInfix "\n" str);
passwdEntry = type: lib.types.addCheck type isPasswdCompatible // {
name = "passwdEntry ${type.name}";
description = "${type.description}, not containing newlines or colons";
};

# Check whether a password hash will allow login.
allowsLogin = hash:
hash == "" # login without password
Expand Down Expand Up @@ -60,7 +54,7 @@ let
options = {

name = mkOption {
type = passwdEntry types.str;
type = types.passwdEntry types.str;
apply = x: assert (builtins.stringLength x < 32 || abort "Username '${x}' is longer than 31 characters which is not allowed!"); x;
description = ''
The name of the user account. If undefined, the name of the
Expand All @@ -69,7 +63,7 @@ let
};

description = mkOption {
type = passwdEntry types.str;
type = types.passwdEntry types.str;
default = "";
example = "Alice Q. User";
description = ''
Expand Down Expand Up @@ -134,7 +128,7 @@ let
};

home = mkOption {
type = passwdEntry types.path;
type = types.passwdEntry types.path;
default = "/var/empty";
description = "The user's home directory.";
};
Expand Down Expand Up @@ -169,7 +163,7 @@ let
};

shell = mkOption {
type = types.nullOr (types.either types.shellPackage (passwdEntry types.path));
type = types.nullOr (types.either types.shellPackage (types.passwdEntry types.path));
default = pkgs.shadow;
defaultText = literalExpression "pkgs.shadow";
example = literalExpression "pkgs.bashInteractive";
Expand Down Expand Up @@ -349,7 +343,7 @@ let
options = {

name = mkOption {
type = passwdEntry types.str;
type = types.passwdEntry types.str;
description = ''
The name of the group. If undefined, the name of the attribute set
will be used.
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/installer/tools/nixos-generate-config.pl
Expand Up @@ -85,7 +85,7 @@ sub debug {


# nixpkgs.system
my ($status, @systemLines) = runCommand("nix-instantiate --impure --eval --expr builtins.currentSystem");
my ($status, @systemLines) = runCommand("@nixInstantiate@ --impure --eval --expr builtins.currentSystem");
if ($status != 0 || join("", @systemLines) =~ /error/) {
die "Failed to retrieve current system type from nix.\n";
}
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/installer/tools/tools.nix
Expand Up @@ -34,6 +34,7 @@ let
name = "nixos-generate-config";
src = ./nixos-generate-config.pl;
perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
nixInstantiate = "${pkgs.nix}/bin/nix-instantiate";
detectvirt = "${config.systemd.package}/bin/systemd-detect-virt";
btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
inherit (config.system.nixos-generate-config) configuration desktopConfiguration;
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Expand Up @@ -1088,6 +1088,7 @@
./services/web-apps/nifi.nix
./services/web-apps/node-red.nix
./services/web-apps/phylactery.nix
./services/web-apps/onlyoffice.nix
./services/web-apps/pict-rs.nix
./services/web-apps/peertube.nix
./services/web-apps/plantuml-server.nix
Expand Down
1 change: 0 additions & 1 deletion nixos/modules/security/pam.nix
Expand Up @@ -611,7 +611,6 @@ let
session optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so
'' +
optionalString cfg.pamMount ''
session [success=1 default=ignore] ${pkgs.pam}/lib/security/pam_succeed_if.so service = systemd-user quiet
session optional ${pkgs.pam_mount}/lib/security/pam_mount.so disable_interactive
'' +
optionalString use_ldap ''
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/databases/openldap.nix
Expand Up @@ -245,7 +245,7 @@ in {
};
};

meta.maintainers = with lib.maintainers; [ mic92 kwohlfahrt ];
meta.maintainers = with lib.maintainers; [ kwohlfahrt ];

config = mkIf cfg.enable {
assertions = map (opt: {
Expand Down
35 changes: 30 additions & 5 deletions nixos/modules/services/mail/mailman.nix
Expand Up @@ -44,7 +44,13 @@ let
transport_file_type: hash
'';

mailmanCfg = lib.generators.toINI {} cfg.settings;
mailmanCfg = lib.generators.toINI {}
(recursiveUpdate cfg.settings
((optionalAttrs (cfg.restApiPassFile != null) {
webservice.admin_pass = "#NIXOS_MAILMAN_REST_API_PASS_SECRET#";
})));

mailmanCfgFile = pkgs.writeText "mailman-raw.cfg" mailmanCfg;

mailmanHyperkittyCfg = pkgs.writeText "mailman-hyperkitty.cfg" ''
[general]
Expand Down Expand Up @@ -247,6 +253,14 @@ in {
'';
};

restApiPassFile = mkOption {
default = null;
type = types.nullOr types.str;
description = ''
Path to the file containing the value for <literal>MAILMAN_REST_API_PASS</literal>.
'';
};

serve = {
enable = mkEnableOption "Automatic nginx and uwsgi setup for mailman-web";
};
Expand Down Expand Up @@ -363,8 +377,6 @@ in {
};
users.groups.mailman = {};

environment.etc."mailman.cfg".text = mailmanCfg;

environment.etc."mailman3/settings.py".text = ''
import os
Expand All @@ -383,6 +395,11 @@ in {
with open('/var/lib/mailman-web/settings_local.json') as f:
globals().update(json.load(f))
${optionalString (cfg.restApiPassFile != null) ''
with open('${cfg.restApiPassFile}') as f:
MAILMAN_REST_API_PASS = f.read().rstrip('\n')
''}
${optionalString (cfg.ldap.enable) ''
import ldap
from django_auth_ldap.config import LDAPSearch, ${cfg.ldap.groupSearch.type}
Expand Down Expand Up @@ -456,7 +473,7 @@ in {
after = [ "network.target" ]
++ lib.optional cfg.enablePostfix "postfix-setup.service"
++ lib.optional withPostgresql "postgresql.service";
restartTriggers = [ config.environment.etc."mailman.cfg".source ];
restartTriggers = [ mailmanCfgFile ];
requires = optional withPostgresql "postgresql.service";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Expand All @@ -480,6 +497,14 @@ in {
requires = optional withPostgresql "postgresql.service";
serviceConfig.Type = "oneshot";
script = ''
install -m0750 -o mailman -g mailman ${mailmanCfgFile} /etc/mailman.cfg
${optionalString (cfg.restApiPassFile != null) ''
${pkgs.replace-secret}/bin/replace-secret \
'#NIXOS_MAILMAN_REST_API_PASS_SECRET#' \
${cfg.restApiPassFile} \
/etc/mailman.cfg
''}
mailmanDir=/var/lib/mailman
mailmanWebDir=/var/lib/mailman-web
Expand Down Expand Up @@ -560,7 +585,7 @@ in {
mailman-daily = {
description = "Trigger daily Mailman events";
startAt = "daily";
restartTriggers = [ config.environment.etc."mailman.cfg".source ];
restartTriggers = [ mailmanCfgFile ];
serviceConfig = {
ExecStart = "${mailmanEnv}/bin/mailman digests --send";
User = "mailman";
Expand Down
57 changes: 43 additions & 14 deletions nixos/modules/services/web-apps/atlassian/confluence.nix
Expand Up @@ -8,21 +8,22 @@ let

pkg = cfg.package.override (optionalAttrs cfg.sso.enable {
enableSSO = cfg.sso.enable;
crowdProperties = ''
application.name ${cfg.sso.applicationName}
application.password ${cfg.sso.applicationPassword}
application.login.url ${cfg.sso.crowd}/console/
crowd.server.url ${cfg.sso.crowd}/services/
crowd.base.url ${cfg.sso.crowd}/
session.isauthenticated session.isauthenticated
session.tokenkey session.tokenkey
session.validationinterval ${toString cfg.sso.validationInterval}
session.lastvalidation session.lastvalidation
'';
});

crowdProperties = pkgs.writeText "crowd.properties" ''
application.name ${cfg.sso.applicationName}
application.password ${if cfg.sso.applicationPassword != null then cfg.sso.applicationPassword else "@NIXOS_CONFLUENCE_CROWD_SSO_PWD@"}
application.login.url ${cfg.sso.crowd}/console/
crowd.server.url ${cfg.sso.crowd}/services/
crowd.base.url ${cfg.sso.crowd}/
session.isauthenticated session.isauthenticated
session.tokenkey session.tokenkey
session.validationinterval ${toString cfg.sso.validationInterval}
session.lastvalidation session.lastvalidation
'';

in

{
Expand Down Expand Up @@ -107,10 +108,17 @@ in
};

applicationPassword = mkOption {
type = types.str;
type = types.nullOr types.str;
default = null;
description = "Application password of this Confluence instance in Crowd";
};

applicationPasswordFile = mkOption {
type = types.nullOr types.str;
default = null;
description = "Path to the application password for Crowd of Confluence.";
};

validationInterval = mkOption {
type = types.int;
default = 2;
Expand Down Expand Up @@ -147,6 +155,16 @@ in
group = cfg.group;
};

assertions = [
{ assertion = cfg.sso.enable -> ((cfg.sso.applicationPassword == null) != (cfg.sso.applicationPasswordFile));
message = "Please set either applicationPassword or applicationPasswordFile";
}
];

warnings = mkIf (cfg.sso.enable && cfg.sso.applicationPassword != null) [
"Using `services.confluence.sso.applicationPassword` is deprecated! Use `applicationPasswordFile` instead!"
];

users.groups.${cfg.group} = {};

systemd.tmpfiles.rules = [
Expand All @@ -173,6 +191,7 @@ in
CONF_USER = cfg.user;
JAVA_HOME = "${cfg.jrePackage}";
CATALINA_OPTS = concatStringsSep " " cfg.catalinaOptions;
JAVA_OPTS = mkIf cfg.sso.enable "-Dcrowd.properties=${cfg.home}/crowd.properties";
};

preStart = ''
Expand All @@ -183,6 +202,16 @@ in
-e 's,protocol="org.apache.coyote.http11.Http11NioProtocol",protocol="org.apache.coyote.http11.Http11NioProtocol" proxyName="${cfg.proxy.name}" proxyPort="${toString cfg.proxy.port}" scheme="${cfg.proxy.scheme}",' \
'') + ''
${pkg}/conf/server.xml.dist > ${cfg.home}/server.xml
${optionalString cfg.sso.enable ''
install -m660 ${crowdProperties} ${cfg.home}/crowd.properties
${optionalString (cfg.sso.applicationPasswordFile != null) ''
${pkgs.replace-secret}/bin/replace-secret \
'@NIXOS_CONFLUENCE_CROWD_SSO_PWD@' \
${cfg.sso.applicationPasswordFile} \
${cfg.home}/crowd.properties
''}
''}
'';

serviceConfig = {
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/web-apps/lemmy.nix
Expand Up @@ -164,7 +164,7 @@ in

wantedBy = [ "multi-user.target" ];

after = [ "pict-rs.service " ] ++ lib.optionals cfg.settings.database.createLocally [ "lemmy-postgresql.service" ];
after = [ "pict-rs.service" ] ++ lib.optionals cfg.settings.database.createLocally [ "lemmy-postgresql.service" ];

requires = lib.optionals cfg.settings.database.createLocally [ "lemmy-postgresql.service" ];

Expand Down

0 comments on commit 7d66e14

Please sign in to comment.