mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge staging-next into staging
This commit is contained in:
commit
3a4a3e98a8
72 changed files with 5858 additions and 3435 deletions
|
@ -1,7 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.postfix;
|
||||
|
@ -17,32 +14,32 @@ let
|
|||
haveLocalRecipients = cfg.localRecipients != null;
|
||||
|
||||
clientAccess =
|
||||
optional (cfg.dnsBlacklistOverrides != "")
|
||||
lib.optional (cfg.dnsBlacklistOverrides != "")
|
||||
"check_client_access hash:/etc/postfix/client_access";
|
||||
|
||||
dnsBl =
|
||||
optionals (cfg.dnsBlacklists != [])
|
||||
lib.optionals (cfg.dnsBlacklists != [])
|
||||
(map (s: "reject_rbl_client " + s) cfg.dnsBlacklists);
|
||||
|
||||
clientRestrictions = concatStringsSep ", " (clientAccess ++ dnsBl);
|
||||
clientRestrictions = lib.concatStringsSep ", " (clientAccess ++ dnsBl);
|
||||
|
||||
mainCf = let
|
||||
escape = replaceStrings ["$"] ["$$"];
|
||||
mkList = items: "\n " + concatStringsSep ",\n " items;
|
||||
escape = lib.replaceStrings ["$"] ["$$"];
|
||||
mkList = items: "\n " + lib.concatStringsSep ",\n " items;
|
||||
mkVal = value:
|
||||
if isList value then mkList value
|
||||
if lib.isList value then mkList value
|
||||
else " " + (if value == true then "yes"
|
||||
else if value == false then "no"
|
||||
else toString value);
|
||||
mkEntry = name: value: "${escape name} =${mkVal value}";
|
||||
in
|
||||
concatStringsSep "\n" (mapAttrsToList mkEntry cfg.config)
|
||||
lib.concatStringsSep "\n" (lib.mapAttrsToList mkEntry cfg.config)
|
||||
+ "\n" + cfg.extraConfig;
|
||||
|
||||
masterCfOptions = { options, config, name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = name;
|
||||
example = "smtp";
|
||||
description = ''
|
||||
|
@ -50,15 +47,15 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
type = types.enum [ "inet" "unix" "unix-dgram" "fifo" "pass" ];
|
||||
type = lib.mkOption {
|
||||
type = lib.types.enum [ "inet" "unix" "unix-dgram" "fifo" "pass" ];
|
||||
default = "unix";
|
||||
example = "inet";
|
||||
description = "The type of the service";
|
||||
};
|
||||
|
||||
private = mkOption {
|
||||
type = types.bool;
|
||||
private = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
example = false;
|
||||
description = ''
|
||||
Whether the service's sockets and storage directory is restricted to
|
||||
|
@ -67,14 +64,14 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
privileged = mkOption {
|
||||
type = types.bool;
|
||||
privileged = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
example = true;
|
||||
description = "";
|
||||
};
|
||||
|
||||
chroot = mkOption {
|
||||
type = types.bool;
|
||||
chroot = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether the service is chrooted to have only access to the
|
||||
|
@ -83,8 +80,8 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
wakeup = mkOption {
|
||||
type = types.int;
|
||||
wakeup = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
example = 60;
|
||||
description = ''
|
||||
Automatically wake up the service after the specified number of
|
||||
|
@ -93,8 +90,8 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
wakeupUnusedComponent = mkOption {
|
||||
type = types.bool;
|
||||
wakeupUnusedComponent = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
example = false;
|
||||
description = ''
|
||||
If set to `false` the component will only be woken
|
||||
|
@ -104,8 +101,8 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
maxproc = mkOption {
|
||||
type = types.int;
|
||||
maxproc = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
example = 1;
|
||||
description = ''
|
||||
The maximum number of processes to spawn for this service. If the
|
||||
|
@ -115,8 +112,8 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
command = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = name;
|
||||
example = "smtpd";
|
||||
description = ''
|
||||
|
@ -125,8 +122,8 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = types.listOf types.str;
|
||||
args = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
example = [ "-o" "smtp_helo_timeout=5" ];
|
||||
description = ''
|
||||
|
@ -136,8 +133,8 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
rawEntry = mkOption {
|
||||
type = types.listOf types.str;
|
||||
rawEntry = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
internal = true;
|
||||
description = ''
|
||||
|
@ -148,7 +145,7 @@ let
|
|||
|
||||
config.rawEntry = let
|
||||
mkBool = bool: if bool then "y" else "n";
|
||||
mkArg = arg: "${optionalString (hasPrefix "-" arg) "\n "}${arg}";
|
||||
mkArg = arg: "${lib.optionalString (lib.hasPrefix "-" arg) "\n "}${arg}";
|
||||
|
||||
maybeOption = fun: option:
|
||||
if options.${option}.isDefined then fun config.${option} else "-";
|
||||
|
@ -158,7 +155,7 @@ let
|
|||
wakeupDefined = options.wakeup.isDefined;
|
||||
wakeupUCDefined = options.wakeupUnusedComponent.isDefined;
|
||||
finalValue = toString config.wakeup
|
||||
+ optionalString (wakeupUCDefined && !config.wakeupUnusedComponent) "?";
|
||||
+ lib.optionalString (wakeupUCDefined && !config.wakeupUnusedComponent) "?";
|
||||
in if wakeupDefined then finalValue else "-";
|
||||
|
||||
in [
|
||||
|
@ -169,7 +166,7 @@ let
|
|||
(maybeOption mkBool "chroot")
|
||||
wakeup
|
||||
(maybeOption toString "maxproc")
|
||||
(config.command + " " + concatMapStringsSep " " mkArg config.args)
|
||||
(config.command + " " + lib.concatMapStringsSep " " mkArg config.args)
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -184,47 +181,47 @@ let
|
|||
"# " "" "(yes)" "(yes)" "(no)" "(never)" "(100)" "" ""
|
||||
];
|
||||
|
||||
masterCf = mapAttrsToList (const (getAttr "rawEntry")) cfg.masterConfig;
|
||||
masterCf = lib.mapAttrsToList (lib.const (lib.getAttr "rawEntry")) cfg.masterConfig;
|
||||
|
||||
# A list of the maximum width of the columns across all lines and labels
|
||||
maxWidths = let
|
||||
foldLine = line: acc: let
|
||||
columnLengths = map stringLength line;
|
||||
in zipListsWith max acc columnLengths;
|
||||
columnLengths = map lib.stringLength line;
|
||||
in lib.zipListsWith lib.max acc columnLengths;
|
||||
# We need to handle the last column specially here, because it's
|
||||
# open-ended (command + args).
|
||||
lines = [ labels labelDefaults ] ++ (map (l: init l ++ [""]) masterCf);
|
||||
in foldr foldLine (genList (const 0) (length labels)) lines;
|
||||
lines = [ labels labelDefaults ] ++ (map (l: lib.init l ++ [""]) masterCf);
|
||||
in lib.foldr foldLine (lib.genList (lib.const 0) (lib.length labels)) lines;
|
||||
|
||||
# Pad a string with spaces from the right (opposite of fixedWidthString).
|
||||
pad = width: str: let
|
||||
padWidth = width - stringLength str;
|
||||
padding = concatStrings (genList (const " ") padWidth);
|
||||
in str + optionalString (padWidth > 0) padding;
|
||||
padWidth = width - lib.stringLength str;
|
||||
padding = lib.concatStrings (lib.genList (lib.const " ") padWidth);
|
||||
in str + lib.optionalString (padWidth > 0) padding;
|
||||
|
||||
# It's + 2 here, because that's the amount of spacing between columns.
|
||||
fullWidth = foldr (width: acc: acc + width + 2) 0 maxWidths;
|
||||
fullWidth = lib.foldr (width: acc: acc + width + 2) 0 maxWidths;
|
||||
|
||||
formatLine = line: concatStringsSep " " (zipListsWith pad maxWidths line);
|
||||
formatLine = line: lib.concatStringsSep " " (lib.zipListsWith pad maxWidths line);
|
||||
|
||||
formattedLabels = let
|
||||
sep = "# " + concatStrings (genList (const "=") (fullWidth + 5));
|
||||
sep = "# " + lib.concatStrings (lib.genList (lib.const "=") (fullWidth + 5));
|
||||
lines = [ sep (formatLine labels) (formatLine labelDefaults) sep ];
|
||||
in concatStringsSep "\n" lines;
|
||||
in lib.concatStringsSep "\n" lines;
|
||||
|
||||
in formattedLabels + "\n" + concatMapStringsSep "\n" formatLine masterCf + "\n" + cfg.extraMasterConf;
|
||||
in formattedLabels + "\n" + lib.concatMapStringsSep "\n" formatLine masterCf + "\n" + cfg.extraMasterConf;
|
||||
|
||||
headerCheckOptions = { ... }:
|
||||
{
|
||||
options = {
|
||||
pattern = mkOption {
|
||||
type = types.str;
|
||||
pattern = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/^.*/";
|
||||
example = "/^X-Mailer:/";
|
||||
description = "A regexp pattern matching the header";
|
||||
};
|
||||
action = mkOption {
|
||||
type = types.str;
|
||||
action = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "DUNNO";
|
||||
example = "BCC mail@example.com";
|
||||
description = "The action to be executed when the pattern is matched";
|
||||
|
@ -232,13 +229,13 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
headerChecks = concatStringsSep "\n" (map (x: "${x.pattern} ${x.action}") cfg.headerChecks) + cfg.extraHeaderChecks;
|
||||
headerChecks = lib.concatStringsSep "\n" (map (x: "${x.pattern} ${x.action}") cfg.headerChecks) + cfg.extraHeaderChecks;
|
||||
|
||||
aliases = let separator = optionalString (cfg.aliasMapType == "hash") ":"; in
|
||||
optionalString (cfg.postmasterAlias != "") ''
|
||||
aliases = let separator = lib.optionalString (cfg.aliasMapType == "hash") ":"; in
|
||||
lib.optionalString (cfg.postmasterAlias != "") ''
|
||||
postmaster${separator} ${cfg.postmasterAlias}
|
||||
''
|
||||
+ optionalString (cfg.rootAlias != "") ''
|
||||
+ lib.optionalString (cfg.rootAlias != "") ''
|
||||
root${separator} ${cfg.rootAlias}
|
||||
''
|
||||
+ cfg.extraAliases
|
||||
|
@ -247,7 +244,7 @@ let
|
|||
aliasesFile = pkgs.writeText "postfix-aliases" aliases;
|
||||
canonicalFile = pkgs.writeText "postfix-canonical" cfg.canonical;
|
||||
virtualFile = pkgs.writeText "postfix-virtual" cfg.virtual;
|
||||
localRecipientMapFile = pkgs.writeText "postfix-local-recipient-map" (concatMapStrings (x: x + " ACCEPT\n") cfg.localRecipients);
|
||||
localRecipientMapFile = pkgs.writeText "postfix-local-recipient-map" (lib.concatMapStrings (x: x + " ACCEPT\n") cfg.localRecipients);
|
||||
checkClientAccessFile = pkgs.writeText "postfix-check-client-access" cfg.dnsBlacklistOverrides;
|
||||
mainCfFile = pkgs.writeText "postfix-main.cf" mainCf;
|
||||
masterCfFile = pkgs.writeText "postfix-master.cf" masterCfContent;
|
||||
|
@ -264,26 +261,26 @@ in
|
|||
|
||||
services.postfix = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to run the Postfix mail server.";
|
||||
};
|
||||
|
||||
enableSmtp = mkOption {
|
||||
type = types.bool;
|
||||
enableSmtp = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable smtp in master.cf.";
|
||||
};
|
||||
|
||||
enableSubmission = mkOption {
|
||||
type = types.bool;
|
||||
enableSubmission = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable smtp submission.";
|
||||
};
|
||||
|
||||
enableSubmissions = mkOption {
|
||||
type = types.bool;
|
||||
enableSubmissions = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable smtp submission via smtps.
|
||||
|
@ -293,8 +290,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
submissionOptions = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
submissionOptions = lib.mkOption {
|
||||
type = with lib.types; attrsOf str;
|
||||
default = {
|
||||
smtpd_tls_security_level = "encrypt";
|
||||
smtpd_sasl_auth_enable = "yes";
|
||||
|
@ -311,8 +308,8 @@ in
|
|||
description = "Options for the submission config in master.cf";
|
||||
};
|
||||
|
||||
submissionsOptions = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
submissionsOptions = lib.mkOption {
|
||||
type = with lib.types; attrsOf str;
|
||||
default = {
|
||||
smtpd_sasl_auth_enable = "yes";
|
||||
smtpd_client_restrictions = "permit_sasl_authenticated,reject";
|
||||
|
@ -334,26 +331,26 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
setSendmail = mkOption {
|
||||
type = types.bool;
|
||||
setSendmail = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to set the system sendmail to postfix's.";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "postfix";
|
||||
description = "What to call the Postfix user (must be used only for postfix).";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "postfix";
|
||||
description = "What to call the Postfix group (must be used only for postfix).";
|
||||
};
|
||||
|
||||
setgidGroup = mkOption {
|
||||
type = types.str;
|
||||
setgidGroup = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "postdrop";
|
||||
description = ''
|
||||
How to call postfix setgid group (for postdrop). Should
|
||||
|
@ -361,8 +358,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
networks = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
networks = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
default = null;
|
||||
example = ["192.168.0.1/24"];
|
||||
description = ''
|
||||
|
@ -372,8 +369,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
networksStyle = mkOption {
|
||||
type = types.str;
|
||||
networksStyle = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Name of standard way of trusted network specification to use,
|
||||
|
@ -382,8 +379,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
hostname = mkOption {
|
||||
type = types.str;
|
||||
hostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Hostname to use. Leave blank to use just the hostname of machine.
|
||||
|
@ -391,24 +388,24 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
domain = mkOption {
|
||||
type = types.str;
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Domain to use. Leave blank to use hostname minus first component.
|
||||
'';
|
||||
};
|
||||
|
||||
origin = mkOption {
|
||||
type = types.str;
|
||||
origin = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Origin to use in outgoing e-mail. Leave blank to use hostname.
|
||||
'';
|
||||
};
|
||||
|
||||
destination = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
destination = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
default = null;
|
||||
example = ["localhost"];
|
||||
description = ''
|
||||
|
@ -417,8 +414,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
relayDomains = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
relayDomains = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
default = null;
|
||||
example = ["localdomain"];
|
||||
description = ''
|
||||
|
@ -426,32 +423,32 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
relayHost = mkOption {
|
||||
type = types.str;
|
||||
relayHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Mail relay for outbound mail.
|
||||
'';
|
||||
};
|
||||
|
||||
relayPort = mkOption {
|
||||
type = types.int;
|
||||
relayPort = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 25;
|
||||
description = ''
|
||||
SMTP port for relay mail relay.
|
||||
'';
|
||||
};
|
||||
|
||||
lookupMX = mkOption {
|
||||
type = types.bool;
|
||||
lookupMX = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether relay specified is just domain whose MX must be used.
|
||||
'';
|
||||
};
|
||||
|
||||
postmasterAlias = mkOption {
|
||||
type = types.str;
|
||||
postmasterAlias = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "root";
|
||||
description = ''
|
||||
Who should receive postmaster e-mail. Multiple values can be added by
|
||||
|
@ -459,8 +456,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
rootAlias = mkOption {
|
||||
type = types.str;
|
||||
rootAlias = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Who should receive root e-mail. Blank for no redirection.
|
||||
|
@ -468,23 +465,23 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
extraAliases = mkOption {
|
||||
type = types.lines;
|
||||
extraAliases = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional entries to put verbatim into aliases file, cf. man-page aliases(8).
|
||||
'';
|
||||
};
|
||||
|
||||
aliasMapType = mkOption {
|
||||
type = with types; enum [ "hash" "regexp" "pcre" ];
|
||||
aliasMapType = lib.mkOption {
|
||||
type = with lib.types; enum [ "hash" "regexp" "pcre" ];
|
||||
default = "hash";
|
||||
example = "regexp";
|
||||
description = "The format the alias map should have. Use regexp if you want to use regular expressions.";
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
type = with types; attrsOf (oneOf [ bool int str (listOf str) ]);
|
||||
config = lib.mkOption {
|
||||
type = with lib.types; attrsOf (oneOf [ bool int str (listOf str) ]);
|
||||
description = ''
|
||||
The main.cf configuration file as key value set.
|
||||
'';
|
||||
|
@ -494,37 +491,37 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
extraConfig = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra lines to be added verbatim to the main.cf configuration file.
|
||||
'';
|
||||
};
|
||||
|
||||
tlsTrustedAuthorities = mkOption {
|
||||
type = types.str;
|
||||
tlsTrustedAuthorities = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
defaultText = literalExpression ''"''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"'';
|
||||
defaultText = lib.literalExpression ''"''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"'';
|
||||
description = ''
|
||||
File containing trusted certification authorities (CA) to verify certificates of mailservers contacted for mail delivery. This basically sets smtp_tls_CAfile and enables opportunistic tls. Defaults to NixOS trusted certification authorities.
|
||||
'';
|
||||
};
|
||||
|
||||
sslCert = mkOption {
|
||||
type = types.str;
|
||||
sslCert = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "SSL certificate to use.";
|
||||
};
|
||||
|
||||
sslKey = mkOption {
|
||||
type = types.str;
|
||||
sslKey = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "SSL key to use.";
|
||||
};
|
||||
|
||||
recipientDelimiter = mkOption {
|
||||
type = types.str;
|
||||
recipientDelimiter = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "+";
|
||||
description = ''
|
||||
|
@ -532,32 +529,32 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
canonical = mkOption {
|
||||
type = types.lines;
|
||||
canonical = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Entries for the {manpage}`canonical(5)` table.
|
||||
'';
|
||||
};
|
||||
|
||||
virtual = mkOption {
|
||||
type = types.lines;
|
||||
virtual = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Entries for the virtual alias map, cf. man-page virtual(5).
|
||||
'';
|
||||
};
|
||||
|
||||
virtualMapType = mkOption {
|
||||
type = types.enum ["hash" "regexp" "pcre"];
|
||||
virtualMapType = lib.mkOption {
|
||||
type = lib.types.enum ["hash" "regexp" "pcre"];
|
||||
default = "hash";
|
||||
description = ''
|
||||
What type of virtual alias map file to use. Use `"regexp"` for regular expressions.
|
||||
'';
|
||||
};
|
||||
|
||||
localRecipients = mkOption {
|
||||
type = with types; nullOr (listOf str);
|
||||
localRecipients = lib.mkOption {
|
||||
type = with lib.types; nullOr (listOf str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of accepted local users. Specify a bare username, an
|
||||
|
@ -569,28 +566,28 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
transport = mkOption {
|
||||
transport = lib.mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
type = lib.types.lines;
|
||||
description = ''
|
||||
Entries for the transport map, cf. man-page transport(8).
|
||||
'';
|
||||
};
|
||||
|
||||
dnsBlacklists = mkOption {
|
||||
dnsBlacklists = lib.mkOption {
|
||||
default = [];
|
||||
type = with types; listOf str;
|
||||
type = with lib.types; listOf str;
|
||||
description = "dns blacklist servers to use with smtpd_client_restrictions";
|
||||
};
|
||||
|
||||
dnsBlacklistOverrides = mkOption {
|
||||
dnsBlacklistOverrides = lib.mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
type = lib.types.lines;
|
||||
description = "contents of check_client_access for overriding dnsBlacklists";
|
||||
};
|
||||
|
||||
masterConfig = mkOption {
|
||||
type = types.attrsOf (types.submodule masterCfOptions);
|
||||
masterConfig = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule masterCfOptions);
|
||||
default = {};
|
||||
example =
|
||||
{ submission = {
|
||||
|
@ -605,48 +602,48 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
extraMasterConf = mkOption {
|
||||
type = types.lines;
|
||||
extraMasterConf = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
example = "submission inet n - n - - smtpd";
|
||||
description = "Extra lines to append to the generated master.cf file.";
|
||||
};
|
||||
|
||||
enableHeaderChecks = mkOption {
|
||||
type = types.bool;
|
||||
enableHeaderChecks = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether to enable postfix header checks";
|
||||
};
|
||||
|
||||
headerChecks = mkOption {
|
||||
type = types.listOf (types.submodule headerCheckOptions);
|
||||
headerChecks = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.submodule headerCheckOptions);
|
||||
default = [];
|
||||
example = [ { pattern = "/^X-Spam-Flag:/"; action = "REDIRECT spam@example.com"; } ];
|
||||
description = "Postfix header checks.";
|
||||
};
|
||||
|
||||
extraHeaderChecks = mkOption {
|
||||
type = types.lines;
|
||||
extraHeaderChecks = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
example = "/^X-Spam-Flag:/ REDIRECT spam@example.com";
|
||||
description = "Extra lines to /etc/postfix/header_checks file.";
|
||||
};
|
||||
|
||||
aliasFiles = mkOption {
|
||||
type = types.attrsOf types.path;
|
||||
aliasFiles = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.path;
|
||||
default = {};
|
||||
description = "Aliases' tables to be compiled and placed into /var/lib/postfix/conf.";
|
||||
};
|
||||
|
||||
mapFiles = mkOption {
|
||||
type = types.attrsOf types.path;
|
||||
mapFiles = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.path;
|
||||
default = {};
|
||||
description = "Maps to be compiled and placed into /var/lib/postfix/conf.";
|
||||
};
|
||||
|
||||
useSrs = mkOption {
|
||||
type = types.bool;
|
||||
useSrs = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable sender rewriting scheme";
|
||||
};
|
||||
|
@ -658,7 +655,7 @@ in
|
|||
|
||||
###### implementation
|
||||
|
||||
config = mkIf config.services.postfix.enable (mkMerge [
|
||||
config = lib.mkIf config.services.postfix.enable (lib.mkMerge [
|
||||
{
|
||||
|
||||
environment = {
|
||||
|
@ -670,7 +667,7 @@ in
|
|||
|
||||
services.pfix-srsd.enable = config.services.postfix.useSrs;
|
||||
|
||||
services.mail.sendmailSetuidWrapper = mkIf config.services.postfix.setSendmail {
|
||||
services.mail.sendmailSetuidWrapper = lib.mkIf config.services.postfix.setSendmail {
|
||||
program = "sendmail";
|
||||
source = "${pkgs.postfix}/bin/sendmail";
|
||||
owner = "root";
|
||||
|
@ -706,7 +703,7 @@ in
|
|||
setgid = true;
|
||||
};
|
||||
|
||||
users.users = optionalAttrs (user == "postfix")
|
||||
users.users = lib.optionalAttrs (user == "postfix")
|
||||
{ postfix = {
|
||||
description = "Postfix mail server user";
|
||||
uid = config.ids.uids.postfix;
|
||||
|
@ -715,10 +712,10 @@ in
|
|||
};
|
||||
|
||||
users.groups =
|
||||
optionalAttrs (group == "postfix")
|
||||
lib.optionalAttrs (group == "postfix")
|
||||
{ ${group}.gid = config.ids.gids.postfix;
|
||||
}
|
||||
// optionalAttrs (setgidGroup == "postdrop")
|
||||
// lib.optionalAttrs (setgidGroup == "postdrop")
|
||||
{ ${setgidGroup}.gid = config.ids.gids.postdrop;
|
||||
};
|
||||
|
||||
|
@ -745,11 +742,11 @@ in
|
|||
ln -sf ${mainCfFile} /var/lib/postfix/conf/main.cf
|
||||
ln -sf ${masterCfFile} /var/lib/postfix/conf/master.cf
|
||||
|
||||
${concatStringsSep "\n" (mapAttrsToList (to: from: ''
|
||||
${lib.concatStringsSep "\n" (lib.mapAttrsToList (to: from: ''
|
||||
ln -sf ${from} /var/lib/postfix/conf/${to}
|
||||
${pkgs.postfix}/bin/postalias -o -p /var/lib/postfix/conf/${to}
|
||||
'') cfg.aliasFiles)}
|
||||
${concatStringsSep "\n" (mapAttrsToList (to: from: ''
|
||||
${lib.concatStringsSep "\n" (lib.mapAttrsToList (to: from: ''
|
||||
ln -sf ${from} /var/lib/postfix/conf/${to}
|
||||
${pkgs.postfix}/bin/postmap /var/lib/postfix/conf/${to}
|
||||
'') cfg.mapFiles)}
|
||||
|
@ -795,7 +792,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
services.postfix.config = (mapAttrs (_: v: mkDefault v) {
|
||||
services.postfix.config = (lib.mapAttrs (_: v: lib.mkDefault v) {
|
||||
compatibility_level = pkgs.postfix.version;
|
||||
mail_owner = cfg.user;
|
||||
default_privs = "nobody";
|
||||
|
@ -819,39 +816,39 @@ in
|
|||
mail_spool_directory = "/var/spool/mail/";
|
||||
setgid_group = cfg.setgidGroup;
|
||||
})
|
||||
// optionalAttrs (cfg.relayHost != "") { relayhost = if cfg.lookupMX
|
||||
// lib.optionalAttrs (cfg.relayHost != "") { relayhost = if cfg.lookupMX
|
||||
then "${cfg.relayHost}:${toString cfg.relayPort}"
|
||||
else "[${cfg.relayHost}]:${toString cfg.relayPort}"; }
|
||||
// optionalAttrs (!config.networking.enableIPv6) { inet_protocols = mkDefault "ipv4"; }
|
||||
// optionalAttrs (cfg.networks != null) { mynetworks = cfg.networks; }
|
||||
// optionalAttrs (cfg.networksStyle != "") { mynetworks_style = cfg.networksStyle; }
|
||||
// optionalAttrs (cfg.hostname != "") { myhostname = cfg.hostname; }
|
||||
// optionalAttrs (cfg.domain != "") { mydomain = cfg.domain; }
|
||||
// optionalAttrs (cfg.origin != "") { myorigin = cfg.origin; }
|
||||
// optionalAttrs (cfg.destination != null) { mydestination = cfg.destination; }
|
||||
// optionalAttrs (cfg.relayDomains != null) { relay_domains = cfg.relayDomains; }
|
||||
// optionalAttrs (cfg.recipientDelimiter != "") { recipient_delimiter = cfg.recipientDelimiter; }
|
||||
// optionalAttrs haveAliases { alias_maps = [ "${cfg.aliasMapType}:/etc/postfix/aliases" ]; }
|
||||
// optionalAttrs haveTransport { transport_maps = [ "hash:/etc/postfix/transport" ]; }
|
||||
// optionalAttrs haveVirtual { virtual_alias_maps = [ "${cfg.virtualMapType}:/etc/postfix/virtual" ]; }
|
||||
// optionalAttrs haveLocalRecipients { local_recipient_maps = [ "hash:/etc/postfix/local_recipients" ] ++ optional haveAliases "$alias_maps"; }
|
||||
// optionalAttrs (cfg.dnsBlacklists != []) { smtpd_client_restrictions = clientRestrictions; }
|
||||
// optionalAttrs cfg.useSrs {
|
||||
// lib.optionalAttrs (!config.networking.enableIPv6) { inet_protocols = lib.mkDefault "ipv4"; }
|
||||
// lib.optionalAttrs (cfg.networks != null) { mynetworks = cfg.networks; }
|
||||
// lib.optionalAttrs (cfg.networksStyle != "") { mynetworks_style = cfg.networksStyle; }
|
||||
// lib.optionalAttrs (cfg.hostname != "") { myhostname = cfg.hostname; }
|
||||
// lib.optionalAttrs (cfg.domain != "") { mydomain = cfg.domain; }
|
||||
// lib.optionalAttrs (cfg.origin != "") { myorigin = cfg.origin; }
|
||||
// lib.optionalAttrs (cfg.destination != null) { mydestination = cfg.destination; }
|
||||
// lib.optionalAttrs (cfg.relayDomains != null) { relay_domains = cfg.relayDomains; }
|
||||
// lib.optionalAttrs (cfg.recipientDelimiter != "") { recipient_delimiter = cfg.recipientDelimiter; }
|
||||
// lib.optionalAttrs haveAliases { alias_maps = [ "${cfg.aliasMapType}:/etc/postfix/aliases" ]; }
|
||||
// lib.optionalAttrs haveTransport { transport_maps = [ "hash:/etc/postfix/transport" ]; }
|
||||
// lib.optionalAttrs haveVirtual { virtual_alias_maps = [ "${cfg.virtualMapType}:/etc/postfix/virtual" ]; }
|
||||
// lib.optionalAttrs haveLocalRecipients { local_recipient_maps = [ "hash:/etc/postfix/local_recipients" ] ++ lib.optional haveAliases "$alias_maps"; }
|
||||
// lib.optionalAttrs (cfg.dnsBlacklists != []) { smtpd_client_restrictions = clientRestrictions; }
|
||||
// lib.optionalAttrs cfg.useSrs {
|
||||
sender_canonical_maps = [ "tcp:127.0.0.1:10001" ];
|
||||
sender_canonical_classes = [ "envelope_sender" ];
|
||||
recipient_canonical_maps = [ "tcp:127.0.0.1:10002" ];
|
||||
recipient_canonical_classes = [ "envelope_recipient" ];
|
||||
}
|
||||
// optionalAttrs cfg.enableHeaderChecks { header_checks = [ "regexp:/etc/postfix/header_checks" ]; }
|
||||
// optionalAttrs (cfg.tlsTrustedAuthorities != "") {
|
||||
// lib.optionalAttrs cfg.enableHeaderChecks { header_checks = [ "regexp:/etc/postfix/header_checks" ]; }
|
||||
// lib.optionalAttrs (cfg.tlsTrustedAuthorities != "") {
|
||||
smtp_tls_CAfile = cfg.tlsTrustedAuthorities;
|
||||
smtp_tls_security_level = mkDefault "may";
|
||||
smtp_tls_security_level = lib.mkDefault "may";
|
||||
}
|
||||
// optionalAttrs (cfg.sslCert != "") {
|
||||
// lib.optionalAttrs (cfg.sslCert != "") {
|
||||
smtp_tls_cert_file = cfg.sslCert;
|
||||
smtp_tls_key_file = cfg.sslKey;
|
||||
|
||||
smtp_tls_security_level = mkDefault "may";
|
||||
smtp_tls_security_level = lib.mkDefault "may";
|
||||
|
||||
smtpd_tls_cert_file = cfg.sslCert;
|
||||
smtpd_tls_key_file = cfg.sslKey;
|
||||
|
@ -931,16 +928,16 @@ in
|
|||
scache = {
|
||||
maxproc = 1;
|
||||
};
|
||||
} // optionalAttrs cfg.enableSubmission {
|
||||
} // lib.optionalAttrs cfg.enableSubmission {
|
||||
submission = {
|
||||
type = "inet";
|
||||
private = false;
|
||||
command = "smtpd";
|
||||
args = let
|
||||
mkKeyVal = opt: val: [ "-o" (opt + "=" + val) ];
|
||||
in concatLists (mapAttrsToList mkKeyVal cfg.submissionOptions);
|
||||
in lib.concatLists (lib.mapAttrsToList mkKeyVal cfg.submissionOptions);
|
||||
};
|
||||
} // optionalAttrs cfg.enableSmtp {
|
||||
} // lib.optionalAttrs cfg.enableSmtp {
|
||||
smtp_inet = {
|
||||
name = "smtp";
|
||||
type = "inet";
|
||||
|
@ -952,7 +949,7 @@ in
|
|||
command = "smtp";
|
||||
args = [ "-o" "smtp_fallback_relay=" ];
|
||||
};
|
||||
} // optionalAttrs cfg.enableSubmissions {
|
||||
} // lib.optionalAttrs cfg.enableSubmissions {
|
||||
submissions = {
|
||||
type = "inet";
|
||||
private = false;
|
||||
|
@ -964,43 +961,43 @@ in
|
|||
cfg.submissionsOptions.smtpd_tls_security_level == "may";
|
||||
submissionsOptions = cfg.submissionsOptions // {
|
||||
smtpd_tls_wrappermode = "yes";
|
||||
} // optionalAttrs adjustSmtpTlsSecurityLevel {
|
||||
} // lib.optionalAttrs adjustSmtpTlsSecurityLevel {
|
||||
smtpd_tls_security_level = "encrypt";
|
||||
};
|
||||
in concatLists (mapAttrsToList mkKeyVal submissionsOptions);
|
||||
in lib.concatLists (lib.mapAttrsToList mkKeyVal submissionsOptions);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf haveAliases {
|
||||
(lib.mkIf haveAliases {
|
||||
services.postfix.aliasFiles.aliases = aliasesFile;
|
||||
})
|
||||
(mkIf haveCanonical {
|
||||
(lib.mkIf haveCanonical {
|
||||
services.postfix.mapFiles.canonical = canonicalFile;
|
||||
})
|
||||
(mkIf haveTransport {
|
||||
(lib.mkIf haveTransport {
|
||||
services.postfix.mapFiles.transport = transportFile;
|
||||
})
|
||||
(mkIf haveVirtual {
|
||||
(lib.mkIf haveVirtual {
|
||||
services.postfix.mapFiles.virtual = virtualFile;
|
||||
})
|
||||
(mkIf haveLocalRecipients {
|
||||
(lib.mkIf haveLocalRecipients {
|
||||
services.postfix.mapFiles.local_recipients = localRecipientMapFile;
|
||||
})
|
||||
(mkIf cfg.enableHeaderChecks {
|
||||
(lib.mkIf cfg.enableHeaderChecks {
|
||||
services.postfix.mapFiles.header_checks = headerChecksFile;
|
||||
})
|
||||
(mkIf (cfg.dnsBlacklists != []) {
|
||||
(lib.mkIf (cfg.dnsBlacklists != []) {
|
||||
services.postfix.mapFiles.client_access = checkClientAccessFile;
|
||||
})
|
||||
]);
|
||||
|
||||
imports = [
|
||||
(mkRemovedOptionModule [ "services" "postfix" "sslCACert" ]
|
||||
(lib.mkRemovedOptionModule [ "services" "postfix" "sslCACert" ]
|
||||
"services.postfix.sslCACert was replaced by services.postfix.tlsTrustedAuthorities. In case you intend that your server should validate requested client certificates use services.postfix.extraConfig.")
|
||||
|
||||
(mkChangedOptionModule [ "services" "postfix" "useDane" ]
|
||||
(lib.mkChangedOptionModule [ "services" "postfix" "useDane" ]
|
||||
[ "services" "postfix" "config" "smtp_tls_security_level" ]
|
||||
(config: mkIf config.services.postfix.useDane "dane"))
|
||||
(config: lib.mkIf config.services.postfix.useDane "dane"))
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.sympa;
|
||||
dataDir = "/var/lib/sympa";
|
||||
user = "sympa";
|
||||
group = "sympa";
|
||||
pkg = pkgs.sympa;
|
||||
fqdns = attrNames cfg.domains;
|
||||
fqdns = lib.attrNames cfg.domains;
|
||||
usingNginx = cfg.web.enable && cfg.web.server == "nginx";
|
||||
mysqlLocal = cfg.database.createLocally && cfg.database.type == "MySQL";
|
||||
pgsqlLocal = cfg.database.createLocally && cfg.database.type == "PostgreSQL";
|
||||
|
@ -42,15 +39,15 @@ let
|
|||
} // commonServiceConfig;
|
||||
|
||||
configVal = value:
|
||||
if isBool value then
|
||||
if lib.isBool value then
|
||||
if value then "on" else "off"
|
||||
else toString value;
|
||||
configGenerator = c: concatStrings (flip mapAttrsToList c (key: val: "${key}\t${configVal val}\n"));
|
||||
configGenerator = c: lib.concatStrings (lib.flip lib.mapAttrsToList c (key: val: "${key}\t${configVal val}\n"));
|
||||
|
||||
mainConfig = pkgs.writeText "sympa.conf" (configGenerator cfg.settings);
|
||||
robotConfig = fqdn: domain: pkgs.writeText "${fqdn}-robot.conf" (configGenerator domain.settings);
|
||||
|
||||
transport = pkgs.writeText "transport.sympa" (concatStringsSep "\n" (flip map fqdns (domain: ''
|
||||
transport = pkgs.writeText "transport.sympa" (lib.concatStringsSep "\n" (lib.flip map fqdns (domain: ''
|
||||
${domain} error:User unknown in recipient table
|
||||
sympa@${domain} sympa:sympa@${domain}
|
||||
listmaster@${domain} sympa:listmaster@${domain}
|
||||
|
@ -58,7 +55,7 @@ let
|
|||
abuse-feedback-report@${domain} sympabounce:sympa@${domain}
|
||||
'')));
|
||||
|
||||
virtual = pkgs.writeText "virtual.sympa" (concatStringsSep "\n" (flip map fqdns (domain: ''
|
||||
virtual = pkgs.writeText "virtual.sympa" (lib.concatStringsSep "\n" (lib.flip map fqdns (domain: ''
|
||||
sympa-request@${domain} postmaster@localhost
|
||||
sympa-owner@${domain} postmaster@localhost
|
||||
'')));
|
||||
|
@ -73,16 +70,16 @@ let
|
|||
[% list.name %][% return_path_suffix %]@[% list.domain %] sympabounce:[% list.name %]@[% list.domain %]
|
||||
'';
|
||||
|
||||
enabledFiles = filterAttrs (n: v: v.enable) cfg.settingsFile;
|
||||
enabledFiles = lib.filterAttrs (n: v: v.enable) cfg.settingsFile;
|
||||
in
|
||||
{
|
||||
|
||||
###### interface
|
||||
options.services.sympa = with types; {
|
||||
options.services.sympa = with lib.types; {
|
||||
|
||||
enable = mkEnableOption "Sympa mailing list manager";
|
||||
enable = lib.mkEnableOption "Sympa mailing list manager";
|
||||
|
||||
lang = mkOption {
|
||||
lang = lib.mkOption {
|
||||
type = str;
|
||||
default = "en_US";
|
||||
example = "cs";
|
||||
|
@ -93,7 +90,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
listMasters = mkOption {
|
||||
listMasters = lib.mkOption {
|
||||
type = listOf str;
|
||||
example = [ "postmaster@sympa.example.org" ];
|
||||
description = ''
|
||||
|
@ -102,7 +99,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
mainDomain = mkOption {
|
||||
mainDomain = lib.mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "lists.example.org";
|
||||
|
@ -112,10 +109,10 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
domains = mkOption {
|
||||
domains = lib.mkOption {
|
||||
type = attrsOf (submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
webHost = mkOption {
|
||||
webHost = lib.mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "archive.example.org";
|
||||
|
@ -124,13 +121,13 @@ in
|
|||
DNS record of type A (or AAAA or CNAME) has to exist with this value.
|
||||
'';
|
||||
};
|
||||
webLocation = mkOption {
|
||||
webLocation = lib.mkOption {
|
||||
type = str;
|
||||
default = "/";
|
||||
example = "/sympa";
|
||||
description = "URL path part of the web interface.";
|
||||
};
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
type = attrsOf (oneOf [ str int bool ]);
|
||||
default = {};
|
||||
example = {
|
||||
|
@ -144,8 +141,8 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config.settings = mkIf (cfg.web.enable && config.webHost != null) {
|
||||
wwsympa_url = mkDefault "https://${config.webHost}${strings.removeSuffix "/" config.webLocation}";
|
||||
config.settings = lib.mkIf (cfg.web.enable && config.webHost != null) {
|
||||
wwsympa_url = lib.mkDefault "https://${config.webHost}${lib.removeSuffix "/" config.webLocation}";
|
||||
};
|
||||
}));
|
||||
|
||||
|
@ -153,7 +150,7 @@ in
|
|||
Email domains handled by this instance. There have
|
||||
to be MX records for keys of this attribute set.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
"lists.example.org" = {
|
||||
webHost = "lists.example.org";
|
||||
|
@ -168,14 +165,14 @@ in
|
|||
};
|
||||
|
||||
database = {
|
||||
type = mkOption {
|
||||
type = lib.mkOption {
|
||||
type = enum [ "SQLite" "PostgreSQL" "MySQL" ];
|
||||
default = "SQLite";
|
||||
example = "MySQL";
|
||||
description = "Database engine to use.";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
host = lib.mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
|
@ -191,29 +188,29 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
port = lib.mkOption {
|
||||
type = nullOr port;
|
||||
default = null;
|
||||
description = "Database port. Use `null` for default port.";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
name = lib.mkOption {
|
||||
type = str;
|
||||
default = if cfg.database.type == "SQLite" then "${dataDir}/sympa.sqlite" else "sympa";
|
||||
defaultText = literalExpression ''if database.type == "SQLite" then "${dataDir}/sympa.sqlite" else "sympa"'';
|
||||
defaultText = lib.literalExpression ''if database.type == "SQLite" then "${dataDir}/sympa.sqlite" else "sympa"'';
|
||||
description = ''
|
||||
Database name. When using SQLite this must be an absolute
|
||||
path to the database file.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
user = lib.mkOption {
|
||||
type = nullOr str;
|
||||
default = user;
|
||||
description = "Database user. The system user name is used as a default.";
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
passwordFile = lib.mkOption {
|
||||
type = nullOr path;
|
||||
default = null;
|
||||
example = "/run/keys/sympa-dbpassword";
|
||||
|
@ -222,7 +219,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
createLocally = mkOption {
|
||||
createLocally = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to create a local database automatically.";
|
||||
|
@ -230,13 +227,13 @@ in
|
|||
};
|
||||
|
||||
web = {
|
||||
enable = mkOption {
|
||||
enable = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to enable Sympa web interface.";
|
||||
};
|
||||
|
||||
server = mkOption {
|
||||
server = lib.mkOption {
|
||||
type = enum [ "nginx" "none" ];
|
||||
default = "nginx";
|
||||
description = ''
|
||||
|
@ -246,7 +243,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
https = mkOption {
|
||||
https = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
|
@ -255,7 +252,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
fcgiProcs = mkOption {
|
||||
fcgiProcs = lib.mkOption {
|
||||
type = ints.positive;
|
||||
default = 2;
|
||||
description = "Number of FastCGI processes to fork.";
|
||||
|
@ -263,7 +260,7 @@ in
|
|||
};
|
||||
|
||||
mta = {
|
||||
type = mkOption {
|
||||
type = lib.mkOption {
|
||||
type = enum [ "postfix" "none" ];
|
||||
default = "postfix";
|
||||
description = ''
|
||||
|
@ -276,10 +273,10 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
type = attrsOf (oneOf [ str int bool ]);
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
default_home = "lists";
|
||||
viewlogs_page_size = 50;
|
||||
|
@ -292,29 +289,29 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
settingsFile = mkOption {
|
||||
settingsFile = lib.mkOption {
|
||||
type = attrsOf (submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
enable = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether this file should be generated. This option allows specific files to be disabled.";
|
||||
};
|
||||
text = mkOption {
|
||||
text = lib.mkOption {
|
||||
default = null;
|
||||
type = nullOr lines;
|
||||
description = "Text of the file.";
|
||||
};
|
||||
source = mkOption {
|
||||
source = lib.mkOption {
|
||||
type = path;
|
||||
description = "Path of the source file.";
|
||||
};
|
||||
};
|
||||
|
||||
config.source = mkIf (config.text != null) (mkDefault (pkgs.writeText "sympa-${baseNameOf name}" config.text));
|
||||
config.source = lib.mkIf (config.text != null) (lib.mkDefault (pkgs.writeText "sympa-${baseNameOf name}" config.text));
|
||||
}));
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
"list_data/lists.example.org/help" = {
|
||||
text = "subject This list provides help to users";
|
||||
|
@ -327,11 +324,11 @@ in
|
|||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
services.sympa.settings = (mapAttrs (_: v: mkDefault v) {
|
||||
domain = if cfg.mainDomain != null then cfg.mainDomain else head fqdns;
|
||||
listmaster = concatStringsSep "," cfg.listMasters;
|
||||
services.sympa.settings = (lib.mapAttrs (_: v: lib.mkDefault v) {
|
||||
domain = if cfg.mainDomain != null then cfg.mainDomain else lib.head fqdns;
|
||||
listmaster = lib.concatStringsSep "," cfg.listMasters;
|
||||
lang = cfg.lang;
|
||||
|
||||
home = "${dataDir}/list_data";
|
||||
|
@ -344,24 +341,24 @@ in
|
|||
db_name = cfg.database.name;
|
||||
db_user = cfg.database.name;
|
||||
}
|
||||
// (optionalAttrs (cfg.database.host != null) {
|
||||
// (lib.optionalAttrs (cfg.database.host != null) {
|
||||
db_host = cfg.database.host;
|
||||
})
|
||||
// (optionalAttrs mysqlLocal {
|
||||
// (lib.optionalAttrs mysqlLocal {
|
||||
db_host = "localhost"; # use unix domain socket
|
||||
})
|
||||
// (optionalAttrs pgsqlLocal {
|
||||
// (lib.optionalAttrs pgsqlLocal {
|
||||
db_host = "/run/postgresql"; # use unix domain socket
|
||||
})
|
||||
// (optionalAttrs (cfg.database.port != null) {
|
||||
// (lib.optionalAttrs (cfg.database.port != null) {
|
||||
db_port = cfg.database.port;
|
||||
})
|
||||
// (optionalAttrs (cfg.mta.type == "postfix") {
|
||||
// (lib.optionalAttrs (cfg.mta.type == "postfix") {
|
||||
sendmail_aliases = "${dataDir}/sympa_transport";
|
||||
aliases_program = "${pkgs.postfix}/bin/postmap";
|
||||
aliases_db_type = "hash";
|
||||
})
|
||||
// (optionalAttrs cfg.web.enable {
|
||||
// (lib.optionalAttrs cfg.web.enable {
|
||||
static_content_path = "${dataDir}/static_content";
|
||||
css_path = "${dataDir}/static_content/css";
|
||||
pictures_path = "${dataDir}/static_content/pictures";
|
||||
|
@ -369,12 +366,12 @@ in
|
|||
}));
|
||||
|
||||
services.sympa.settingsFile = {
|
||||
"virtual.sympa" = mkDefault { source = virtual; };
|
||||
"transport.sympa" = mkDefault { source = transport; };
|
||||
"etc/list_aliases.tt2" = mkDefault { source = listAliases; };
|
||||
"virtual.sympa" = lib.mkDefault { source = virtual; };
|
||||
"transport.sympa" = lib.mkDefault { source = transport; };
|
||||
"etc/list_aliases.tt2" = lib.mkDefault { source = listAliases; };
|
||||
}
|
||||
// (flip mapAttrs' cfg.domains (fqdn: domain:
|
||||
nameValuePair "etc/${fqdn}/robot.conf" (mkDefault { source = robotConfig fqdn domain; })));
|
||||
// (lib.flip lib.mapAttrs' cfg.domains (fqdn: domain:
|
||||
lib.nameValuePair "etc/${fqdn}/robot.conf" (lib.mkDefault { source = robotConfig fqdn domain; })));
|
||||
|
||||
environment = {
|
||||
systemPackages = [ pkg ];
|
||||
|
@ -416,14 +413,14 @@ in
|
|||
|
||||
"d /run/sympa 0755 ${user} ${group} - -"
|
||||
]
|
||||
++ (flip concatMap fqdns (fqdn: [
|
||||
++ (lib.flip lib.concatMap fqdns (fqdn: [
|
||||
"d ${dataDir}/etc/${fqdn} 0700 ${user} ${group} - -"
|
||||
"d ${dataDir}/list_data/${fqdn} 0700 ${user} ${group} - -"
|
||||
]))
|
||||
#++ (flip mapAttrsToList enabledFiles (k: v:
|
||||
#++ (lib.flip lib.mapAttrsToList enabledFiles (k: v:
|
||||
# "L+ ${dataDir}/${k} - - - - ${v.source}"
|
||||
#))
|
||||
++ (concatLists (flip mapAttrsToList enabledFiles (k: v: [
|
||||
++ (lib.concatLists (lib.flip lib.mapAttrsToList enabledFiles (k: v: [
|
||||
# sympa doesn't handle symlinks well (e.g. fails to create locks)
|
||||
# force-copy instead
|
||||
"R ${dataDir}/${k} - - - - -"
|
||||
|
@ -443,13 +440,13 @@ in
|
|||
umask 0077
|
||||
|
||||
cp -f ${mainConfig} ${dataDir}/etc/sympa.conf
|
||||
${optionalString (cfg.database.passwordFile != null) ''
|
||||
${lib.optionalString (cfg.database.passwordFile != null) ''
|
||||
chmod u+w ${dataDir}/etc/sympa.conf
|
||||
echo -n "db_passwd " >> ${dataDir}/etc/sympa.conf
|
||||
cat ${cfg.database.passwordFile} >> ${dataDir}/etc/sympa.conf
|
||||
''}
|
||||
|
||||
${optionalString (cfg.mta.type == "postfix") ''
|
||||
${lib.optionalString (cfg.mta.type == "postfix") ''
|
||||
${pkgs.postfix}/bin/postmap hash:${dataDir}/virtual.sympa
|
||||
${pkgs.postfix}/bin/postmap hash:${dataDir}/transport.sympa
|
||||
''}
|
||||
|
@ -478,7 +475,7 @@ in
|
|||
serviceConfig = sympaServiceConfig "task_manager";
|
||||
};
|
||||
|
||||
systemd.services.wwsympa = mkIf usingNginx {
|
||||
systemd.services.wwsympa = lib.mkIf usingNginx {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "sympa.service" ];
|
||||
serviceConfig = {
|
||||
|
@ -499,14 +496,14 @@ in
|
|||
} // commonServiceConfig;
|
||||
};
|
||||
|
||||
services.nginx.enable = mkIf usingNginx true;
|
||||
services.nginx.virtualHosts = mkIf usingNginx (let
|
||||
vHosts = unique (remove null (mapAttrsToList (_k: v: v.webHost) cfg.domains));
|
||||
hostLocations = host: map (v: v.webLocation) (filter (v: v.webHost == host) (attrValues cfg.domains));
|
||||
httpsOpts = optionalAttrs cfg.web.https { forceSSL = mkDefault true; enableACME = mkDefault true; };
|
||||
services.nginx.enable = lib.mkIf usingNginx true;
|
||||
services.nginx.virtualHosts = lib.mkIf usingNginx (let
|
||||
vHosts = lib.unique (lib.remove null (lib.mapAttrsToList (_k: v: v.webHost) cfg.domains));
|
||||
hostLocations = host: map (v: v.webLocation) (lib.filter (v: v.webHost == host) (lib.attrValues cfg.domains));
|
||||
httpsOpts = lib.optionalAttrs cfg.web.https { forceSSL = lib.mkDefault true; enableACME = lib.mkDefault true; };
|
||||
in
|
||||
genAttrs vHosts (host: {
|
||||
locations = genAttrs (hostLocations host) (loc: {
|
||||
lib.genAttrs vHosts (host: {
|
||||
locations = lib.genAttrs (hostLocations host) (loc: {
|
||||
extraConfig = ''
|
||||
include ${config.services.nginx.package}/conf/fastcgi_params;
|
||||
|
||||
|
@ -517,7 +514,7 @@ in
|
|||
};
|
||||
} // httpsOpts));
|
||||
|
||||
services.postfix = mkIf (cfg.mta.type == "postfix") {
|
||||
services.postfix = lib.mkIf (cfg.mta.type == "postfix") {
|
||||
enable = true;
|
||||
recipientDelimiter = "+";
|
||||
config = {
|
||||
|
@ -561,9 +558,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
services.mysql = optionalAttrs mysqlLocal {
|
||||
services.mysql = lib.optionalAttrs mysqlLocal {
|
||||
enable = true;
|
||||
package = mkDefault pkgs.mariadb;
|
||||
package = lib.mkDefault pkgs.mariadb;
|
||||
ensureDatabases = [ cfg.database.name ];
|
||||
ensureUsers = [
|
||||
{ name = cfg.database.user;
|
||||
|
@ -572,7 +569,7 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
services.postgresql = optionalAttrs pgsqlLocal {
|
||||
services.postgresql = lib.optionalAttrs pgsqlLocal {
|
||||
enable = true;
|
||||
ensureDatabases = [ cfg.database.name ];
|
||||
ensureUsers = [
|
||||
|
@ -584,5 +581,5 @@ in
|
|||
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ mmilata sorki ];
|
||||
meta.maintainers = with lib.maintainers; [ mmilata sorki ];
|
||||
}
|
||||
|
|
|
@ -1,32 +1,29 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.autorandr;
|
||||
hookType = types.lines;
|
||||
hookType = lib.types.lines;
|
||||
|
||||
matrixOf = n: m: elemType:
|
||||
mkOptionType rec {
|
||||
lib.mkOptionType rec {
|
||||
name = "matrixOf";
|
||||
description =
|
||||
"${toString n}×${toString m} matrix of ${elemType.description}s";
|
||||
check = xss:
|
||||
let listOfSize = l: xs: isList xs && length xs == l;
|
||||
let listOfSize = l: xs: lib.isList xs && lib.length xs == l;
|
||||
in listOfSize n xss
|
||||
&& all (xs: listOfSize m xs && all elemType.check xs) xss;
|
||||
merge = mergeOneOption;
|
||||
&& lib.all (xs: listOfSize m xs && lib.all elemType.check xs) xss;
|
||||
merge = lib.mergeOneOption;
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "*" "*" ]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = mod: matrixOf n m (elemType.substSubModules mod);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
functor = (lib.defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
profileModule = types.submodule {
|
||||
profileModule = lib.types.submodule {
|
||||
options = {
|
||||
fingerprint = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
fingerprint = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
description = ''
|
||||
Output name to EDID mapping.
|
||||
Use `autorandr --fingerprint` to get current setup values.
|
||||
|
@ -34,13 +31,13 @@ let
|
|||
default = { };
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
type = types.attrsOf configModule;
|
||||
config = lib.mkOption {
|
||||
type = lib.types.attrsOf configModule;
|
||||
description = "Per output profile configuration.";
|
||||
default = { };
|
||||
};
|
||||
|
||||
hooks = mkOption {
|
||||
hooks = lib.mkOption {
|
||||
type = hooksModule;
|
||||
description = "Profile hook scripts.";
|
||||
default = { };
|
||||
|
@ -48,66 +45,66 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
configModule = types.submodule {
|
||||
configModule = lib.types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Whether to enable the output.";
|
||||
default = true;
|
||||
};
|
||||
|
||||
crtc = mkOption {
|
||||
type = types.nullOr types.ints.unsigned;
|
||||
crtc = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.ints.unsigned;
|
||||
description = "Output video display controller.";
|
||||
default = null;
|
||||
example = 0;
|
||||
};
|
||||
|
||||
primary = mkOption {
|
||||
type = types.bool;
|
||||
primary = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Whether output should be marked as primary";
|
||||
default = false;
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = types.str;
|
||||
position = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Output position";
|
||||
default = "";
|
||||
example = "5760x0";
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
type = types.str;
|
||||
mode = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Output resolution.";
|
||||
default = "";
|
||||
example = "3840x2160";
|
||||
};
|
||||
|
||||
rate = mkOption {
|
||||
type = types.str;
|
||||
rate = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Output framerate.";
|
||||
default = "";
|
||||
example = "60.00";
|
||||
};
|
||||
|
||||
gamma = mkOption {
|
||||
type = types.str;
|
||||
gamma = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Output gamma configuration.";
|
||||
default = "";
|
||||
example = "1.0:0.909:0.833";
|
||||
};
|
||||
|
||||
rotate = mkOption {
|
||||
type = types.nullOr (types.enum [ "normal" "left" "right" "inverted" ]);
|
||||
rotate = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum [ "normal" "left" "right" "inverted" ]);
|
||||
description = "Output rotate configuration.";
|
||||
default = null;
|
||||
example = "left";
|
||||
};
|
||||
|
||||
transform = mkOption {
|
||||
type = types.nullOr (matrixOf 3 3 types.float);
|
||||
transform = lib.mkOption {
|
||||
type = lib.types.nullOr (matrixOf 3 3 lib.types.float);
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
[
|
||||
[ 0.6 0.0 0.0 ]
|
||||
[ 0.0 0.6 0.0 ]
|
||||
|
@ -121,30 +118,30 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
dpi = mkOption {
|
||||
type = types.nullOr types.ints.positive;
|
||||
dpi = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.ints.positive;
|
||||
description = "Output DPI configuration.";
|
||||
default = null;
|
||||
example = 96;
|
||||
};
|
||||
|
||||
scale = mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
scale = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.submodule {
|
||||
options = {
|
||||
method = mkOption {
|
||||
type = types.enum [ "factor" "pixel" ];
|
||||
method = lib.mkOption {
|
||||
type = lib.types.enum [ "factor" "pixel" ];
|
||||
description = "Output scaling method.";
|
||||
default = "factor";
|
||||
example = "pixel";
|
||||
};
|
||||
|
||||
x = mkOption {
|
||||
type = types.either types.float types.ints.positive;
|
||||
x = lib.mkOption {
|
||||
type = lib.types.either lib.types.float lib.types.ints.positive;
|
||||
description = "Horizontal scaling factor/pixels.";
|
||||
};
|
||||
|
||||
y = mkOption {
|
||||
type = types.either types.float types.ints.positive;
|
||||
y = lib.mkOption {
|
||||
type = lib.types.either lib.types.float lib.types.ints.positive;
|
||||
description = "Vertical scaling factor/pixels.";
|
||||
};
|
||||
};
|
||||
|
@ -164,7 +161,7 @@ let
|
|||
exclusive.
|
||||
'';
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
x = 1.25;
|
||||
y = 1.25;
|
||||
|
@ -174,22 +171,22 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
hooksModule = types.submodule {
|
||||
hooksModule = lib.types.submodule {
|
||||
options = {
|
||||
postswitch = mkOption {
|
||||
type = types.attrsOf hookType;
|
||||
postswitch = lib.mkOption {
|
||||
type = lib.types.attrsOf hookType;
|
||||
description = "Postswitch hook executed after mode switch.";
|
||||
default = { };
|
||||
};
|
||||
|
||||
preswitch = mkOption {
|
||||
type = types.attrsOf hookType;
|
||||
preswitch = lib.mkOption {
|
||||
type = lib.types.attrsOf hookType;
|
||||
description = "Preswitch hook executed before mode switch.";
|
||||
default = { };
|
||||
};
|
||||
|
||||
predetect = mkOption {
|
||||
type = types.attrsOf hookType;
|
||||
predetect = lib.mkOption {
|
||||
type = lib.types.attrsOf hookType;
|
||||
description = ''
|
||||
Predetect hook executed before autorandr attempts to run xrandr.
|
||||
'';
|
||||
|
@ -199,37 +196,37 @@ let
|
|||
};
|
||||
|
||||
hookToFile = folder: name: hook:
|
||||
nameValuePair "xdg/autorandr/${folder}/${name}" {
|
||||
lib.nameValuePair "xdg/autorandr/${folder}/${name}" {
|
||||
source = "${pkgs.writeShellScriptBin "hook" hook}/bin/hook";
|
||||
};
|
||||
profileToFiles = name: profile:
|
||||
with profile;
|
||||
mkMerge ([
|
||||
lib.mkMerge ([
|
||||
{
|
||||
"xdg/autorandr/${name}/setup".text = concatStringsSep "\n"
|
||||
(mapAttrsToList fingerprintToString fingerprint);
|
||||
"xdg/autorandr/${name}/setup".text = lib.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList fingerprintToString fingerprint);
|
||||
"xdg/autorandr/${name}/config".text =
|
||||
concatStringsSep "\n" (mapAttrsToList configToString profile.config);
|
||||
lib.concatStringsSep "\n" (lib.mapAttrsToList configToString profile.config);
|
||||
}
|
||||
(mapAttrs' (hookToFile "${name}/postswitch.d") hooks.postswitch)
|
||||
(mapAttrs' (hookToFile "${name}/preswitch.d") hooks.preswitch)
|
||||
(mapAttrs' (hookToFile "${name}/predetect.d") hooks.predetect)
|
||||
(lib.mapAttrs' (hookToFile "${name}/postswitch.d") hooks.postswitch)
|
||||
(lib.mapAttrs' (hookToFile "${name}/preswitch.d") hooks.preswitch)
|
||||
(lib.mapAttrs' (hookToFile "${name}/predetect.d") hooks.predetect)
|
||||
]);
|
||||
fingerprintToString = name: edid: "${name} ${edid}";
|
||||
configToString = name: config:
|
||||
if config.enable then
|
||||
concatStringsSep "\n" ([ "output ${name}" ]
|
||||
++ optional (config.position != "") "pos ${config.position}"
|
||||
++ optional (config.crtc != null) "crtc ${toString config.crtc}"
|
||||
++ optional config.primary "primary"
|
||||
++ optional (config.dpi != null) "dpi ${toString config.dpi}"
|
||||
++ optional (config.gamma != "") "gamma ${config.gamma}"
|
||||
++ optional (config.mode != "") "mode ${config.mode}"
|
||||
++ optional (config.rate != "") "rate ${config.rate}"
|
||||
++ optional (config.rotate != null) "rotate ${config.rotate}"
|
||||
++ optional (config.transform != null) ("transform "
|
||||
+ concatMapStringsSep "," toString (flatten config.transform))
|
||||
++ optional (config.scale != null)
|
||||
lib.concatStringsSep "\n" ([ "output ${name}" ]
|
||||
++ lib.optional (config.position != "") "pos ${config.position}"
|
||||
++ lib.optional (config.crtc != null) "crtc ${toString config.crtc}"
|
||||
++ lib.optional config.primary "primary"
|
||||
++ lib.optional (config.dpi != null) "dpi ${toString config.dpi}"
|
||||
++ lib.optional (config.gamma != "") "gamma ${config.gamma}"
|
||||
++ lib.optional (config.mode != "") "mode ${config.mode}"
|
||||
++ lib.optional (config.rate != "") "rate ${config.rate}"
|
||||
++ lib.optional (config.rotate != null) "rotate ${config.rotate}"
|
||||
++ lib.optional (config.transform != null) ("transform "
|
||||
+ lib.concatMapStringsSep "," toString (lib.flatten config.transform))
|
||||
++ lib.optional (config.scale != null)
|
||||
((if config.scale.method == "factor" then "scale" else "scale-from")
|
||||
+ " ${toString config.scale.x}x${toString config.scale.y}"))
|
||||
else ''
|
||||
|
@ -242,11 +239,11 @@ in {
|
|||
options = {
|
||||
|
||||
services.autorandr = {
|
||||
enable = mkEnableOption "handling of hotplug and sleep events by autorandr";
|
||||
enable = lib.mkEnableOption "handling of hotplug and sleep events by autorandr";
|
||||
|
||||
defaultTarget = mkOption {
|
||||
defaultTarget = lib.mkOption {
|
||||
default = "default";
|
||||
type = types.str;
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Fallback if no monitor layout can be detected. See the docs
|
||||
(https://github.com/phillipberndt/autorandr/blob/v1.0/README.md#how-to-use)
|
||||
|
@ -254,23 +251,23 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
ignoreLid = mkOption {
|
||||
ignoreLid = lib.mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
type = lib.types.bool;
|
||||
description = "Treat outputs as connected even if their lids are closed";
|
||||
};
|
||||
|
||||
matchEdid = mkOption {
|
||||
matchEdid = lib.mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
type = lib.types.bool;
|
||||
description = "Match displays based on edid instead of name";
|
||||
};
|
||||
|
||||
hooks = mkOption {
|
||||
hooks = lib.mkOption {
|
||||
type = hooksModule;
|
||||
description = "Global hook scripts";
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
postswitch = {
|
||||
"notify-i3" = "''${pkgs.i3}/bin/i3-msg restart";
|
||||
|
@ -296,11 +293,11 @@ in {
|
|||
}
|
||||
'';
|
||||
};
|
||||
profiles = mkOption {
|
||||
type = types.attrsOf profileModule;
|
||||
profiles = lib.mkOption {
|
||||
type = lib.types.attrsOf profileModule;
|
||||
description = "Autorandr profiles specification.";
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
"work" = {
|
||||
fingerprint = {
|
||||
|
@ -330,17 +327,17 @@ in {
|
|||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
services.udev.packages = [ pkgs.autorandr ];
|
||||
|
||||
environment = {
|
||||
systemPackages = [ pkgs.autorandr ];
|
||||
etc = mkMerge ([
|
||||
(mapAttrs' (hookToFile "postswitch.d") cfg.hooks.postswitch)
|
||||
(mapAttrs' (hookToFile "preswitch.d") cfg.hooks.preswitch)
|
||||
(mapAttrs' (hookToFile "predetect.d") cfg.hooks.predetect)
|
||||
(mkMerge (mapAttrsToList profileToFiles cfg.profiles))
|
||||
etc = lib.mkMerge ([
|
||||
(lib.mapAttrs' (hookToFile "postswitch.d") cfg.hooks.postswitch)
|
||||
(lib.mapAttrs' (hookToFile "preswitch.d") cfg.hooks.preswitch)
|
||||
(lib.mapAttrs' (hookToFile "predetect.d") cfg.hooks.predetect)
|
||||
(lib.mkMerge (lib.mapAttrsToList profileToFiles cfg.profiles))
|
||||
]);
|
||||
};
|
||||
|
||||
|
@ -357,8 +354,8 @@ in {
|
|||
--batch \
|
||||
--change \
|
||||
--default ${cfg.defaultTarget} \
|
||||
${optionalString cfg.ignoreLid "--ignore-lid"} \
|
||||
${optionalString cfg.matchEdid "--match-edid"}
|
||||
${lib.optionalString cfg.ignoreLid "--ignore-lid"} \
|
||||
${lib.optionalString cfg.matchEdid "--match-edid"}
|
||||
'';
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = false;
|
||||
|
@ -368,5 +365,5 @@ in {
|
|||
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ alexnortung ];
|
||||
meta.maintainers = with lib.maintainers; [ alexnortung ];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.gammu-smsd;
|
||||
|
||||
|
@ -10,7 +8,7 @@ let
|
|||
Connection = ${cfg.device.connection}
|
||||
SynchronizeTime = ${if cfg.device.synchronizeTime then "yes" else "no"}
|
||||
LogFormat = ${cfg.log.format}
|
||||
${optionalString (cfg.device.pin != null) "PIN = ${cfg.device.pin}"}
|
||||
${lib.optionalString (cfg.device.pin != null) "PIN = ${cfg.device.pin}"}
|
||||
${cfg.extraConfig.gammu}
|
||||
|
||||
|
||||
|
@ -18,25 +16,25 @@ let
|
|||
LogFile = ${cfg.log.file}
|
||||
Service = ${cfg.backend.service}
|
||||
|
||||
${optionalString (cfg.backend.service == "files") ''
|
||||
${lib.optionalString (cfg.backend.service == "files") ''
|
||||
InboxPath = ${cfg.backend.files.inboxPath}
|
||||
OutboxPath = ${cfg.backend.files.outboxPath}
|
||||
SentSMSPath = ${cfg.backend.files.sentSMSPath}
|
||||
ErrorSMSPath = ${cfg.backend.files.errorSMSPath}
|
||||
''}
|
||||
|
||||
${optionalString (cfg.backend.service == "sql" && cfg.backend.sql.driver == "sqlite") ''
|
||||
${lib.optionalString (cfg.backend.service == "sql" && cfg.backend.sql.driver == "sqlite") ''
|
||||
Driver = ${cfg.backend.sql.driver}
|
||||
DBDir = ${cfg.backend.sql.database}
|
||||
''}
|
||||
|
||||
${optionalString (cfg.backend.service == "sql" && cfg.backend.sql.driver == "native_pgsql") (
|
||||
${lib.optionalString (cfg.backend.service == "sql" && cfg.backend.sql.driver == "native_pgsql") (
|
||||
with cfg.backend; ''
|
||||
Driver = ${sql.driver}
|
||||
${optionalString (sql.database!= null) "Database = ${sql.database}"}
|
||||
${optionalString (sql.host != null) "Host = ${sql.host}"}
|
||||
${optionalString (sql.user != null) "User = ${sql.user}"}
|
||||
${optionalString (sql.password != null) "Password = ${sql.password}"}
|
||||
${lib.optionalString (sql.database!= null) "Database = ${sql.database}"}
|
||||
${lib.optionalString (sql.host != null) "Host = ${sql.host}"}
|
||||
${lib.optionalString (sql.user != null) "User = ${sql.user}"}
|
||||
${lib.optionalString (sql.password != null) "Password = ${sql.password}"}
|
||||
'')}
|
||||
|
||||
${cfg.extraConfig.smsd}
|
||||
|
@ -53,42 +51,42 @@ in {
|
|||
options = {
|
||||
services.gammu-smsd = {
|
||||
|
||||
enable = mkEnableOption "gammu-smsd daemon";
|
||||
enable = lib.mkEnableOption "gammu-smsd daemon";
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "smsd";
|
||||
description = "User that has access to the device";
|
||||
};
|
||||
|
||||
device = {
|
||||
path = mkOption {
|
||||
type = types.path;
|
||||
path = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Device node or address of the phone";
|
||||
example = "/dev/ttyUSB2";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "root";
|
||||
description = "Owner group of the device";
|
||||
example = "dialout";
|
||||
};
|
||||
|
||||
connection = mkOption {
|
||||
type = types.str;
|
||||
connection = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "at";
|
||||
description = "Protocol which will be used to talk to the phone";
|
||||
};
|
||||
|
||||
synchronizeTime = mkOption {
|
||||
type = types.bool;
|
||||
synchronizeTime = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to set time from computer to the phone during starting connection";
|
||||
};
|
||||
|
||||
pin = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
pin = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "PIN code for the simcard";
|
||||
};
|
||||
|
@ -96,14 +94,14 @@ in {
|
|||
|
||||
|
||||
log = {
|
||||
file = mkOption {
|
||||
type = types.str;
|
||||
file = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "syslog";
|
||||
description = "Path to file where information about communication will be stored";
|
||||
};
|
||||
|
||||
format = mkOption {
|
||||
type = types.enum [ "nothing" "text" "textall" "textalldate" "errors" "errorsdate" "binary" ];
|
||||
format = lib.mkOption {
|
||||
type = lib.types.enum [ "nothing" "text" "textall" "textalldate" "errors" "errorsdate" "binary" ];
|
||||
default = "errors";
|
||||
description = "Determines what will be logged to the LogFile";
|
||||
};
|
||||
|
@ -111,15 +109,15 @@ in {
|
|||
|
||||
|
||||
extraConfig = {
|
||||
gammu = mkOption {
|
||||
type = types.lines;
|
||||
gammu = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = "Extra config lines to be added into [gammu] section";
|
||||
};
|
||||
|
||||
|
||||
smsd = mkOption {
|
||||
type = types.lines;
|
||||
smsd = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = "Extra config lines to be added into [smsd] section";
|
||||
};
|
||||
|
@ -127,70 +125,70 @@ in {
|
|||
|
||||
|
||||
backend = {
|
||||
service = mkOption {
|
||||
type = types.enum [ "null" "files" "sql" ];
|
||||
service = lib.mkOption {
|
||||
type = lib.types.enum [ "null" "files" "sql" ];
|
||||
default = "null";
|
||||
description = "Service to use to store sms data.";
|
||||
};
|
||||
|
||||
files = {
|
||||
inboxPath = mkOption {
|
||||
type = types.path;
|
||||
inboxPath = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/spool/sms/inbox/";
|
||||
description = "Where the received SMSes are stored";
|
||||
};
|
||||
|
||||
outboxPath = mkOption {
|
||||
type = types.path;
|
||||
outboxPath = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/spool/sms/outbox/";
|
||||
description = "Where SMSes to be sent should be placed";
|
||||
};
|
||||
|
||||
sentSMSPath = mkOption {
|
||||
type = types.path;
|
||||
sentSMSPath = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/spool/sms/sent/";
|
||||
description = "Where the transmitted SMSes are placed";
|
||||
};
|
||||
|
||||
errorSMSPath = mkOption {
|
||||
type = types.path;
|
||||
errorSMSPath = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/spool/sms/error/";
|
||||
description = "Where SMSes with error in transmission is placed";
|
||||
};
|
||||
};
|
||||
|
||||
sql = {
|
||||
driver = mkOption {
|
||||
type = types.enum [ "native_mysql" "native_pgsql" "odbc" "dbi" ];
|
||||
driver = lib.mkOption {
|
||||
type = lib.types.enum [ "native_mysql" "native_pgsql" "odbc" "dbi" ];
|
||||
description = "DB driver to use";
|
||||
};
|
||||
|
||||
sqlDialect = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
sqlDialect = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "SQL dialect to use (odbc driver only)";
|
||||
};
|
||||
|
||||
database = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
database = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Database name to store sms data";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "localhost";
|
||||
description = "Database server address";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
user = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "User name used for connection to the database";
|
||||
};
|
||||
|
||||
password = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
password = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "User password used for connection to the database";
|
||||
};
|
||||
|
@ -199,7 +197,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.${cfg.user} = {
|
||||
description = "gammu-smsd user";
|
||||
isSystemUser = true;
|
||||
|
@ -207,7 +205,7 @@ in {
|
|||
};
|
||||
|
||||
environment.systemPackages = with cfg.backend; [ gammuPackage ]
|
||||
++ optionals (service == "sql" && sql.driver == "sqlite") [ pkgs.sqlite ];
|
||||
++ lib.optionals (service == "sql" && sql.driver == "sqlite") [ pkgs.sqlite ];
|
||||
|
||||
systemd.services.gammu-smsd = {
|
||||
description = "gammu-smsd daemon";
|
||||
|
@ -215,29 +213,29 @@ in {
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
wants = with cfg.backend; [ ]
|
||||
++ optionals (service == "sql" && sql.driver == "native_pgsql") [ "postgresql.service" ];
|
||||
++ lib.optionals (service == "sql" && sql.driver == "native_pgsql") [ "postgresql.service" ];
|
||||
|
||||
preStart = with cfg.backend;
|
||||
|
||||
optionalString (service == "files") (with files; ''
|
||||
lib.optionalString (service == "files") (with files; ''
|
||||
mkdir -m 755 -p ${inboxPath} ${outboxPath} ${sentSMSPath} ${errorSMSPath}
|
||||
chown ${cfg.user} -R ${inboxPath}
|
||||
chown ${cfg.user} -R ${outboxPath}
|
||||
chown ${cfg.user} -R ${sentSMSPath}
|
||||
chown ${cfg.user} -R ${errorSMSPath}
|
||||
'')
|
||||
+ optionalString (service == "sql" && sql.driver == "sqlite") ''
|
||||
+ lib.optionalString (service == "sql" && sql.driver == "sqlite") ''
|
||||
cat "${gammuPackage}/${initDBDir}/sqlite.sql" \
|
||||
| ${pkgs.sqlite.bin}/bin/sqlite3 ${sql.database}
|
||||
''
|
||||
+ (let execPsql = extraArgs: concatStringsSep " " [
|
||||
(optionalString (sql.password != null) "PGPASSWORD=${sql.password}")
|
||||
+ (let execPsql = extraArgs: lib.concatStringsSep " " [
|
||||
(lib.optionalString (sql.password != null) "PGPASSWORD=${sql.password}")
|
||||
"${config.services.postgresql.package}/bin/psql"
|
||||
(optionalString (sql.host != null) "-h ${sql.host}")
|
||||
(optionalString (sql.user != null) "-U ${sql.user}")
|
||||
(lib.optionalString (sql.host != null) "-h ${sql.host}")
|
||||
(lib.optionalString (sql.user != null) "-U ${sql.user}")
|
||||
"$extraArgs"
|
||||
"${sql.database}"
|
||||
]; in optionalString (service == "sql" && sql.driver == "native_pgsql") ''
|
||||
]; in lib.optionalString (service == "sql" && sql.driver == "native_pgsql") ''
|
||||
echo '\i '"${gammuPackage}/${initDBDir}/pgsql.sql" | ${execPsql ""}
|
||||
'');
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
{ config, lib, options, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
gid = config.ids.gids.mediatomb;
|
||||
|
@ -13,19 +10,19 @@ let
|
|||
# configuration on media directory
|
||||
mediaDirectory = {
|
||||
options = {
|
||||
path = mkOption {
|
||||
type = types.str;
|
||||
path = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
Absolute directory path to the media directory to index.
|
||||
'';
|
||||
};
|
||||
recursive = mkOption {
|
||||
type = types.bool;
|
||||
recursive = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether the indexation must take place recursively or not.";
|
||||
};
|
||||
hidden-files = mkOption {
|
||||
type = types.bool;
|
||||
hidden-files = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to index the hidden files or not.";
|
||||
};
|
||||
|
@ -66,7 +63,7 @@ let
|
|||
</transcoding>
|
||||
'';
|
||||
|
||||
configText = optionalString (! cfg.customCfg) ''
|
||||
configText = lib.optionalString (! cfg.customCfg) ''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
|
||||
<server>
|
||||
|
@ -87,7 +84,7 @@ let
|
|||
</sqlite3>
|
||||
</storage>
|
||||
<protocolInfo extend="${optionYesNo cfg.ps3Support}"/>
|
||||
${optionalString cfg.dsmSupport ''
|
||||
${lib.optionalString cfg.dsmSupport ''
|
||||
<custom-http-headers>
|
||||
<add header="X-User-Agent: redsonic"/>
|
||||
</custom-http-headers>
|
||||
|
@ -95,7 +92,7 @@ let
|
|||
<manufacturerURL>redsonic.com</manufacturerURL>
|
||||
<modelNumber>105</modelNumber>
|
||||
''}
|
||||
${optionalString cfg.tg100Support ''
|
||||
${lib.optionalString cfg.tg100Support ''
|
||||
<upnp-string-limit>101</upnp-string-limit>
|
||||
''}
|
||||
<extended-runtime-options>
|
||||
|
@ -109,7 +106,7 @@ let
|
|||
</server>
|
||||
<import hidden-files="no">
|
||||
<autoscan use-inotify="auto">
|
||||
${concatMapStrings toMediaDirectory cfg.mediaDirectories}
|
||||
${lib.concatMapStrings toMediaDirectory cfg.mediaDirectories}
|
||||
</autoscan>
|
||||
<scripting script-charset="UTF-8">
|
||||
<common-script>${pkg}/share/${name}/js/common.js</common-script>
|
||||
|
@ -139,10 +136,10 @@ let
|
|||
<map from="flv" to="video/x-flv"/>
|
||||
<map from="mkv" to="video/x-matroska"/>
|
||||
<map from="mka" to="audio/x-matroska"/>
|
||||
${optionalString cfg.ps3Support ''
|
||||
${lib.optionalString cfg.ps3Support ''
|
||||
<map from="avi" to="video/divx"/>
|
||||
''}
|
||||
${optionalString cfg.dsmSupport ''
|
||||
${lib.optionalString cfg.dsmSupport ''
|
||||
<map from="avi" to="video/avi"/>
|
||||
''}
|
||||
</extension-mimetype>
|
||||
|
@ -199,26 +196,26 @@ in {
|
|||
|
||||
services.mediatomb = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable the Gerbera/Mediatomb DLNA server.
|
||||
'';
|
||||
};
|
||||
|
||||
serverName = mkOption {
|
||||
type = types.str;
|
||||
serverName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Gerbera (Mediatomb)";
|
||||
description = ''
|
||||
How to identify the server on the network.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "gerbera" { };
|
||||
package = lib.mkPackageOption pkgs "gerbera" { };
|
||||
|
||||
ps3Support = mkOption {
|
||||
type = types.bool;
|
||||
ps3Support = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable ps3 specific tweaks.
|
||||
|
@ -226,8 +223,8 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
dsmSupport = mkOption {
|
||||
type = types.bool;
|
||||
dsmSupport = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable D-Link DSM 320 specific tweaks.
|
||||
|
@ -235,69 +232,69 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
tg100Support = mkOption {
|
||||
type = types.bool;
|
||||
tg100Support = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable Telegent TG100 specific tweaks.
|
||||
'';
|
||||
};
|
||||
|
||||
transcoding = mkOption {
|
||||
type = types.bool;
|
||||
transcoding = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable transcoding.
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
dataDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/${name}";
|
||||
defaultText = literalExpression ''"/var/lib/''${config.${opt.package}.pname}"'';
|
||||
defaultText = lib.literalExpression ''"/var/lib/''${config.${opt.package}.pname}"'';
|
||||
description = ''
|
||||
The directory where Gerbera/Mediatomb stores its state, data, etc.
|
||||
'';
|
||||
};
|
||||
|
||||
pcDirectoryHide = mkOption {
|
||||
type = types.bool;
|
||||
pcDirectoryHide = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to list the top-level directory or not (from upnp client standpoint).
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "mediatomb";
|
||||
description = "User account under which the service runs.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "mediatomb";
|
||||
description = "Group account under which the service runs.";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 49152;
|
||||
description = ''
|
||||
The network port to listen on.
|
||||
'';
|
||||
};
|
||||
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
interface = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
A specific interface to bind to.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
If false (the default), this is up to the user to declare the firewall rules.
|
||||
|
@ -310,16 +307,16 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
uuid = mkOption {
|
||||
type = types.str;
|
||||
uuid = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "fdfc8a4e-a3ad-4c1d-b43d-a2eedb03a687";
|
||||
description = ''
|
||||
A unique (on your network) to identify the server by.
|
||||
'';
|
||||
};
|
||||
|
||||
mediaDirectories = mkOption {
|
||||
type = with types; listOf (submodule mediaDirectory);
|
||||
mediaDirectories = lib.mkOption {
|
||||
type = with lib.types; listOf (submodule mediaDirectory);
|
||||
default = [];
|
||||
description = ''
|
||||
Declare media directories to index.
|
||||
|
@ -330,8 +327,8 @@ in {
|
|||
];
|
||||
};
|
||||
|
||||
customCfg = mkOption {
|
||||
type = types.bool;
|
||||
customCfg = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Allow the service to create and use its own config file inside the `dataDir` as
|
||||
|
@ -350,9 +347,9 @@ in {
|
|||
###### implementation
|
||||
|
||||
config = let binaryCommand = "${pkg}/bin/${name}";
|
||||
interfaceFlag = optionalString ( cfg.interface != "") "--interface ${cfg.interface}";
|
||||
configFlag = optionalString (! cfg.customCfg) "--config ${pkgs.writeText "config.xml" configText}";
|
||||
in mkIf cfg.enable {
|
||||
interfaceFlag = lib.optionalString ( cfg.interface != "") "--interface ${cfg.interface}";
|
||||
configFlag = lib.optionalString (! cfg.customCfg) "--config ${pkgs.writeText "config.xml" configText}";
|
||||
in lib.mkIf cfg.enable {
|
||||
systemd.services.mediatomb = {
|
||||
description = "${cfg.serverName} media Server";
|
||||
# Gerbera might fail if the network interface is not available on startup
|
||||
|
@ -365,11 +362,11 @@ in {
|
|||
serviceConfig.Group = cfg.group;
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == "mediatomb") {
|
||||
users.groups = lib.optionalAttrs (cfg.group == "mediatomb") {
|
||||
mediatomb.gid = gid;
|
||||
};
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "mediatomb") {
|
||||
users.users = lib.optionalAttrs (cfg.user == "mediatomb") {
|
||||
mediatomb = {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
|
@ -380,11 +377,11 @@ in {
|
|||
};
|
||||
|
||||
# Open firewall only if users enable it
|
||||
networking.firewall = mkMerge [
|
||||
(mkIf (cfg.openFirewall && cfg.interface != "") {
|
||||
networking.firewall = lib.mkMerge [
|
||||
(lib.mkIf (cfg.openFirewall && cfg.interface != "") {
|
||||
interfaces."${cfg.interface}" = defaultFirewallRules;
|
||||
})
|
||||
(mkIf (cfg.openFirewall && cfg.interface == "") defaultFirewallRules)
|
||||
(lib.mkIf (cfg.openFirewall && cfg.interface == "") defaultFirewallRules)
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.mqtt2influxdb;
|
||||
filterNull = filterAttrsRecursive (n: v: v != null);
|
||||
filterNull = lib.filterAttrsRecursive (n: v: v != null);
|
||||
configFile = (pkgs.formats.yaml {}).generate "mqtt2influxdb.config.yaml" (
|
||||
filterNull {
|
||||
inherit (cfg) mqtt influxdb;
|
||||
|
@ -17,26 +14,26 @@ let
|
|||
}
|
||||
);
|
||||
|
||||
pointType = types.submodule {
|
||||
pointType = lib.types.submodule {
|
||||
options = {
|
||||
measurement = mkOption {
|
||||
type = types.str;
|
||||
measurement = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Name of the measurement";
|
||||
};
|
||||
topic = mkOption {
|
||||
type = types.str;
|
||||
topic = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "MQTT topic to subscribe to.";
|
||||
};
|
||||
fields = mkOption {
|
||||
type = types.submodule {
|
||||
fields = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
value = mkOption {
|
||||
type = types.str;
|
||||
value = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "$.payload";
|
||||
description = "Value to be picked up";
|
||||
};
|
||||
type = mkOption {
|
||||
type = with types; nullOr str;
|
||||
type = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
description = "Type to be picked up";
|
||||
};
|
||||
|
@ -44,8 +41,8 @@ let
|
|||
};
|
||||
description = "Field selector.";
|
||||
};
|
||||
tags = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
tags = lib.mkOption {
|
||||
type = with lib.types; attrsOf str;
|
||||
default = {};
|
||||
description = "Tags applied";
|
||||
};
|
||||
|
@ -124,10 +121,10 @@ let
|
|||
in {
|
||||
options = {
|
||||
services.mqtt2influxdb = {
|
||||
enable = mkEnableOption "BigClown MQTT to InfluxDB bridge";
|
||||
package = mkPackageOption pkgs ["python3Packages" "mqtt2influxdb"] {};
|
||||
environmentFiles = mkOption {
|
||||
type = types.listOf types.path;
|
||||
enable = lib.mkEnableOption "BigClown MQTT to InfluxDB bridge";
|
||||
package = lib.mkPackageOption pkgs ["python3Packages" "mqtt2influxdb"] {};
|
||||
environmentFiles = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [];
|
||||
example = [ "/run/keys/mqtt2influxdb.env" ];
|
||||
description = ''
|
||||
|
@ -138,23 +135,23 @@ in {
|
|||
'';
|
||||
};
|
||||
mqtt = {
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Host where MQTT server is running.";
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 1883;
|
||||
description = "MQTT server port.";
|
||||
};
|
||||
username = mkOption {
|
||||
type = with types; nullOr str;
|
||||
username = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
description = "Username used to connect to the MQTT server.";
|
||||
};
|
||||
password = mkOption {
|
||||
type = with types; nullOr str;
|
||||
password = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
MQTT password.
|
||||
|
@ -164,44 +161,44 @@ in {
|
|||
the store.
|
||||
'';
|
||||
};
|
||||
cafile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
cafile = lib.mkOption {
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
description = "Certification Authority file for MQTT";
|
||||
};
|
||||
certfile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
certfile = lib.mkOption {
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
description = "Certificate file for MQTT";
|
||||
};
|
||||
keyfile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
keyfile = lib.mkOption {
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
description = "Key file for MQTT";
|
||||
};
|
||||
};
|
||||
influxdb = {
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Host where InfluxDB server is running.";
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8086;
|
||||
description = "InfluxDB server port";
|
||||
};
|
||||
database = mkOption {
|
||||
type = types.str;
|
||||
database = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Name of the InfluxDB database.";
|
||||
};
|
||||
username = mkOption {
|
||||
type = with types; nullOr str;
|
||||
username = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
description = "Username for InfluxDB login.";
|
||||
};
|
||||
password = mkOption {
|
||||
type = with types; nullOr str;
|
||||
password = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Password for InfluxDB login.
|
||||
|
@ -211,26 +208,26 @@ in {
|
|||
the store.
|
||||
'';
|
||||
};
|
||||
ssl = mkOption {
|
||||
type = types.bool;
|
||||
ssl = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Use SSL to connect to the InfluxDB server.";
|
||||
};
|
||||
verify_ssl = mkOption {
|
||||
type = types.bool;
|
||||
verify_ssl = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Verify SSL certificate when connecting to the InfluxDB server.";
|
||||
};
|
||||
};
|
||||
points = mkOption {
|
||||
type = types.listOf pointType;
|
||||
points = lib.mkOption {
|
||||
type = lib.types.listOf pointType;
|
||||
default = defaultPoints;
|
||||
description = "Points to bridge from MQTT to InfluxDB.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.bigclown-mqtt2influxdb = let
|
||||
envConfig = cfg.environmentFiles != [];
|
||||
finalConfig = if envConfig
|
||||
|
@ -239,7 +236,7 @@ in {
|
|||
in {
|
||||
description = "BigClown MQTT to InfluxDB bridge";
|
||||
wantedBy = ["multi-user.target"];
|
||||
wants = mkIf config.services.mosquitto.enable ["mosquitto.service"];
|
||||
wants = lib.mkIf config.services.mosquitto.enable ["mosquitto.service"];
|
||||
preStart = ''
|
||||
umask 077
|
||||
${pkgs.envsubst}/bin/envsubst -i "${configFile}" -o "${finalConfig}"
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.nitter;
|
||||
configFile = pkgs.writeText "nitter.conf" ''
|
||||
${generators.toINI {
|
||||
${lib.generators.toINI {
|
||||
# String values need to be quoted
|
||||
mkKeyValue = generators.mkKeyValueDefault {
|
||||
mkKeyValue = lib.generators.mkKeyValueDefault {
|
||||
mkValueString = v:
|
||||
if isString v then "\"" + (strings.escape ["\""] (toString v)) + "\""
|
||||
else generators.mkValueStringDefault {} v;
|
||||
if lib.isString v then "\"" + (lib.escape ["\""] (toString v)) + "\""
|
||||
else lib.generators.mkValueStringDefault {} v;
|
||||
} " = ";
|
||||
} (lib.recursiveUpdate {
|
||||
Server = cfg.server;
|
||||
|
@ -47,57 +44,57 @@ in
|
|||
{
|
||||
imports = [
|
||||
# https://github.com/zedeus/nitter/pull/772
|
||||
(mkRemovedOptionModule [ "services" "nitter" "replaceInstagram" ] "Nitter no longer supports this option as Bibliogram has been discontinued.")
|
||||
(lib.mkRemovedOptionModule [ "services" "nitter" "replaceInstagram" ] "Nitter no longer supports this option as Bibliogram has been discontinued.")
|
||||
];
|
||||
|
||||
options = {
|
||||
services.nitter = {
|
||||
enable = mkEnableOption "Nitter, an alternative Twitter front-end";
|
||||
enable = lib.mkEnableOption "Nitter, an alternative Twitter front-end";
|
||||
|
||||
package = mkPackageOption pkgs "nitter" { };
|
||||
package = lib.mkPackageOption pkgs "nitter" { };
|
||||
|
||||
server = {
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
address = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "0.0.0.0";
|
||||
example = "127.0.0.1";
|
||||
description = "The address to listen on.";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8080;
|
||||
example = 8000;
|
||||
description = "The port to listen on.";
|
||||
};
|
||||
|
||||
https = mkOption {
|
||||
type = types.bool;
|
||||
https = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Set secure attribute on cookies. Keep it disabled to enable cookies when not using HTTPS.";
|
||||
};
|
||||
|
||||
httpMaxConnections = mkOption {
|
||||
type = types.int;
|
||||
httpMaxConnections = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 100;
|
||||
description = "Maximum number of HTTP connections.";
|
||||
};
|
||||
|
||||
staticDir = mkOption {
|
||||
type = types.path;
|
||||
staticDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "${cfg.package}/share/nitter/public";
|
||||
defaultText = literalExpression ''"''${config.services.nitter.package}/share/nitter/public"'';
|
||||
defaultText = lib.literalExpression ''"''${config.services.nitter.package}/share/nitter/public"'';
|
||||
description = "Path to the static files directory.";
|
||||
};
|
||||
|
||||
title = mkOption {
|
||||
type = types.str;
|
||||
title = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "nitter";
|
||||
description = "Title of the instance.";
|
||||
};
|
||||
|
||||
hostname = mkOption {
|
||||
type = types.str;
|
||||
hostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "localhost";
|
||||
example = "nitter.net";
|
||||
description = "Hostname of the instance.";
|
||||
|
@ -105,38 +102,38 @@ in
|
|||
};
|
||||
|
||||
cache = {
|
||||
listMinutes = mkOption {
|
||||
type = types.int;
|
||||
listMinutes = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 240;
|
||||
description = "How long to cache list info (not the tweets, so keep it high).";
|
||||
};
|
||||
|
||||
rssMinutes = mkOption {
|
||||
type = types.int;
|
||||
rssMinutes = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 10;
|
||||
description = "How long to cache RSS queries.";
|
||||
};
|
||||
|
||||
redisHost = mkOption {
|
||||
type = types.str;
|
||||
redisHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "localhost";
|
||||
description = "Redis host.";
|
||||
};
|
||||
|
||||
redisPort = mkOption {
|
||||
type = types.port;
|
||||
redisPort = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 6379;
|
||||
description = "Redis port.";
|
||||
};
|
||||
|
||||
redisConnections = mkOption {
|
||||
type = types.int;
|
||||
redisConnections = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 20;
|
||||
description = "Redis connection pool size.";
|
||||
};
|
||||
|
||||
redisMaxConnections = mkOption {
|
||||
type = types.int;
|
||||
redisMaxConnections = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 30;
|
||||
description = ''
|
||||
Maximum number of connections to Redis.
|
||||
|
@ -149,30 +146,30 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
base64Media = mkOption {
|
||||
type = types.bool;
|
||||
base64Media = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Use base64 encoding for proxied media URLs.";
|
||||
};
|
||||
|
||||
enableRSS = mkEnableOption "RSS feeds" // { default = true; };
|
||||
enableRSS = lib.mkEnableOption "RSS feeds" // { default = true; };
|
||||
|
||||
enableDebug = mkEnableOption "request logs and debug endpoints";
|
||||
enableDebug = lib.mkEnableOption "request logs and debug endpoints";
|
||||
|
||||
proxy = mkOption {
|
||||
type = types.str;
|
||||
proxy = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "URL to a HTTP/HTTPS proxy.";
|
||||
};
|
||||
|
||||
proxyAuth = mkOption {
|
||||
type = types.str;
|
||||
proxyAuth = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Credentials for proxy.";
|
||||
};
|
||||
|
||||
tokenCount = mkOption {
|
||||
type = types.int;
|
||||
tokenCount = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 10;
|
||||
description = ''
|
||||
Minimum amount of usable tokens.
|
||||
|
@ -187,114 +184,114 @@ in
|
|||
};
|
||||
|
||||
preferences = {
|
||||
replaceTwitter = mkOption {
|
||||
type = types.str;
|
||||
replaceTwitter = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "nitter.net";
|
||||
description = "Replace Twitter links with links to this instance (blank to disable).";
|
||||
};
|
||||
|
||||
replaceYouTube = mkOption {
|
||||
type = types.str;
|
||||
replaceYouTube = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "piped.kavin.rocks";
|
||||
description = "Replace YouTube links with links to this instance (blank to disable).";
|
||||
};
|
||||
|
||||
replaceReddit = mkOption {
|
||||
type = types.str;
|
||||
replaceReddit = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
example = "teddit.net";
|
||||
description = "Replace Reddit links with links to this instance (blank to disable).";
|
||||
};
|
||||
|
||||
mp4Playback = mkOption {
|
||||
type = types.bool;
|
||||
mp4Playback = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable MP4 video playback.";
|
||||
};
|
||||
|
||||
hlsPlayback = mkOption {
|
||||
type = types.bool;
|
||||
hlsPlayback = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable HLS video streaming (requires JavaScript).";
|
||||
};
|
||||
|
||||
proxyVideos = mkOption {
|
||||
type = types.bool;
|
||||
proxyVideos = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Proxy video streaming through the server (might be slow).";
|
||||
};
|
||||
|
||||
muteVideos = mkOption {
|
||||
type = types.bool;
|
||||
muteVideos = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Mute videos by default.";
|
||||
};
|
||||
|
||||
autoplayGifs = mkOption {
|
||||
type = types.bool;
|
||||
autoplayGifs = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Autoplay GIFs.";
|
||||
};
|
||||
|
||||
theme = mkOption {
|
||||
type = types.str;
|
||||
theme = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Nitter";
|
||||
description = "Instance theme.";
|
||||
};
|
||||
|
||||
infiniteScroll = mkOption {
|
||||
type = types.bool;
|
||||
infiniteScroll = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Infinite scrolling (requires JavaScript, experimental!).";
|
||||
};
|
||||
|
||||
stickyProfile = mkOption {
|
||||
type = types.bool;
|
||||
stickyProfile = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Make profile sidebar stick to top.";
|
||||
};
|
||||
|
||||
bidiSupport = mkOption {
|
||||
type = types.bool;
|
||||
bidiSupport = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Support bidirectional text (makes clicking on tweets harder).";
|
||||
};
|
||||
|
||||
hideTweetStats = mkOption {
|
||||
type = types.bool;
|
||||
hideTweetStats = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Hide tweet stats (replies, retweets, likes).";
|
||||
};
|
||||
|
||||
hideBanner = mkOption {
|
||||
type = types.bool;
|
||||
hideBanner = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Hide profile banner.";
|
||||
};
|
||||
|
||||
hidePins = mkOption {
|
||||
type = types.bool;
|
||||
hidePins = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Hide pinned tweets.";
|
||||
};
|
||||
|
||||
hideReplies = mkOption {
|
||||
type = types.bool;
|
||||
hideReplies = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Hide tweet replies.";
|
||||
};
|
||||
|
||||
squareAvatars = mkOption {
|
||||
type = types.bool;
|
||||
squareAvatars = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Square profile pictures.";
|
||||
};
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrs;
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Add settings here to override NixOS module generated settings.
|
||||
|
@ -304,8 +301,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
guestAccounts = mkOption {
|
||||
type = types.path;
|
||||
guestAccounts = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/nitter/guest_accounts.jsonl";
|
||||
description = ''
|
||||
Path to the guest accounts file.
|
||||
|
@ -321,21 +318,21 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
redisCreateLocally = mkOption {
|
||||
type = types.bool;
|
||||
redisCreateLocally = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Configure local Redis server for Nitter.";
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Open ports in the firewall for Nitter web interface.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = !cfg.redisCreateLocally || (cfg.cache.redisHost == "localhost" && cfg.cache.redisPort == 6379);
|
||||
|
@ -397,7 +394,7 @@ in
|
|||
port = cfg.cache.redisPort;
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.server.port ];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,39 +1,36 @@
|
|||
{ config, lib, pkgs, ...}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.mosquitto;
|
||||
|
||||
# note that mosquitto config parsing is very simplistic as of may 2021.
|
||||
# often times they'll e.g. strtok() a line, check the first two tokens, and ignore the rest.
|
||||
# there's no escaping available either, so we have to prevent any being necessary.
|
||||
str = types.strMatching "[^\r\n]*" // {
|
||||
str = lib.types.strMatching "[^\r\n]*" // {
|
||||
description = "single-line string";
|
||||
};
|
||||
path = types.addCheck types.path (p: str.check "${p}");
|
||||
configKey = types.strMatching "[^\r\n\t ]+";
|
||||
optionType = with types; oneOf [ str path bool int ] // {
|
||||
path = lib.types.addCheck lib.types.path (p: str.check "${p}");
|
||||
configKey = lib.types.strMatching "[^\r\n\t ]+";
|
||||
optionType = with lib.types; oneOf [ str path bool int ] // {
|
||||
description = "string, path, bool, or integer";
|
||||
};
|
||||
optionToString = v:
|
||||
if isBool v then boolToString v
|
||||
if lib.isBool v then lib.boolToString v
|
||||
else if path.check v then "${v}"
|
||||
else toString v;
|
||||
|
||||
assertKeysValid = prefix: valid: config:
|
||||
mapAttrsToList
|
||||
lib.mapAttrsToList
|
||||
(n: _: {
|
||||
assertion = valid ? ${n};
|
||||
message = "Invalid config key ${prefix}.${n}.";
|
||||
})
|
||||
config;
|
||||
|
||||
formatFreeform = { prefix ? "" }: mapAttrsToList (n: v: "${prefix}${n} ${optionToString v}");
|
||||
formatFreeform = { prefix ? "" }: lib.mapAttrsToList (n: v: "${prefix}${n} ${optionToString v}");
|
||||
|
||||
userOptions = with types; submodule {
|
||||
userOptions = with lib.types; submodule {
|
||||
options = {
|
||||
password = mkOption {
|
||||
password = lib.mkOption {
|
||||
type = uniq (nullOr str);
|
||||
default = null;
|
||||
description = ''
|
||||
|
@ -41,7 +38,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
passwordFile = lib.mkOption {
|
||||
type = uniq (nullOr path);
|
||||
example = "/path/to/file";
|
||||
default = null;
|
||||
|
@ -54,7 +51,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
hashedPassword = mkOption {
|
||||
hashedPassword = lib.mkOption {
|
||||
type = uniq (nullOr str);
|
||||
default = null;
|
||||
description = ''
|
||||
|
@ -66,7 +63,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
hashedPasswordFile = mkOption {
|
||||
hashedPasswordFile = lib.mkOption {
|
||||
type = uniq (nullOr path);
|
||||
example = "/path/to/file";
|
||||
default = null;
|
||||
|
@ -82,7 +79,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
acl = mkOption {
|
||||
acl = lib.mkOption {
|
||||
type = listOf str;
|
||||
example = [ "read A/B" "readwrite A/#" ];
|
||||
default = [];
|
||||
|
@ -94,15 +91,15 @@ let
|
|||
};
|
||||
|
||||
userAsserts = prefix: users:
|
||||
mapAttrsToList
|
||||
lib.mapAttrsToList
|
||||
(n: _: {
|
||||
assertion = builtins.match "[^:\r\n]+" n != null;
|
||||
message = "Invalid user name ${n} in ${prefix}";
|
||||
})
|
||||
users
|
||||
++ mapAttrsToList
|
||||
++ lib.mapAttrsToList
|
||||
(n: u: {
|
||||
assertion = count (s: s != null) [
|
||||
assertion = lib.count (s: s != null) [
|
||||
u.password u.passwordFile u.hashedPassword u.hashedPasswordFile
|
||||
] <= 1;
|
||||
message = "Cannot set more than one password option for user ${n} in ${prefix}";
|
||||
|
@ -112,26 +109,26 @@ let
|
|||
userScope = prefix: index: "${prefix}-user-${toString index}";
|
||||
credentialID = prefix: credential: "${prefix}-${credential}";
|
||||
|
||||
toScopedUsers = listenerScope: users: pipe users [
|
||||
attrNames
|
||||
(imap0 (index: user: nameValuePair user
|
||||
toScopedUsers = listenerScope: users: lib.pipe users [
|
||||
lib.attrNames
|
||||
(lib.imap0 (index: user: lib.nameValuePair user
|
||||
(users.${user} // { scope = userScope listenerScope index; })
|
||||
))
|
||||
listToAttrs
|
||||
lib.listToAttrs
|
||||
];
|
||||
|
||||
userCredentials = user: credentials: pipe credentials [
|
||||
(filter (credential: user.${credential} != null))
|
||||
userCredentials = user: credentials: lib.pipe credentials [
|
||||
(lib.filter (credential: user.${credential} != null))
|
||||
(map (credential: "${credentialID user.scope credential}:${user.${credential}}"))
|
||||
];
|
||||
usersCredentials = listenerScope: users: credentials: pipe users [
|
||||
usersCredentials = listenerScope: users: credentials: lib.pipe users [
|
||||
(toScopedUsers listenerScope)
|
||||
(mapAttrsToList (_: user: userCredentials user credentials))
|
||||
concatLists
|
||||
(lib.mapAttrsToList (_: user: userCredentials user credentials))
|
||||
lib.concatLists
|
||||
];
|
||||
systemdCredentials = listeners: listenerCredentials: pipe listeners [
|
||||
(imap0 (index: listener: listenerCredentials (listenerScope index) listener))
|
||||
concatLists
|
||||
systemdCredentials = listeners: listenerCredentials: lib.pipe listeners [
|
||||
(lib.imap0 (index: listener: listenerCredentials (listenerScope index) listener))
|
||||
lib.concatLists
|
||||
];
|
||||
|
||||
makePasswordFile = listenerScope: users: path:
|
||||
|
@ -139,12 +136,12 @@ let
|
|||
makeLines = store: file: let
|
||||
scopedUsers = toScopedUsers listenerScope users;
|
||||
in
|
||||
mapAttrsToList
|
||||
(name: user: ''addLine ${escapeShellArg name} "''$(systemd-creds cat ${credentialID user.scope store})"'')
|
||||
(filterAttrs (_: user: user.${store} != null) scopedUsers)
|
||||
++ mapAttrsToList
|
||||
(name: user: ''addFile ${escapeShellArg name} "''${CREDENTIALS_DIRECTORY}/${credentialID user.scope file}"'')
|
||||
(filterAttrs (_: user: user.${file} != null) scopedUsers);
|
||||
lib.mapAttrsToList
|
||||
(name: user: ''addLine ${lib.escapeShellArg name} "''$(systemd-creds cat ${credentialID user.scope store})"'')
|
||||
(lib.filterAttrs (_: user: user.${store} != null) scopedUsers)
|
||||
++ lib.mapAttrsToList
|
||||
(name: user: ''addFile ${lib.escapeShellArg name} "''${CREDENTIALS_DIRECTORY}/${credentialID user.scope file}"'')
|
||||
(lib.filterAttrs (_: user: user.${file} != null) scopedUsers);
|
||||
plainLines = makeLines "password" "passwordFile";
|
||||
hashedLines = makeLines "hashedPassword" "hashedPasswordFile";
|
||||
in
|
||||
|
@ -154,7 +151,7 @@ let
|
|||
|
||||
set -eu
|
||||
|
||||
file=${escapeShellArg path}
|
||||
file=${lib.escapeShellArg path}
|
||||
|
||||
rm -f "$file"
|
||||
touch "$file"
|
||||
|
@ -170,23 +167,23 @@ let
|
|||
echo "$1:$(cat "$2")" >> "$file"
|
||||
}
|
||||
''
|
||||
+ concatStringsSep "\n"
|
||||
+ lib.concatStringsSep "\n"
|
||||
(plainLines
|
||||
++ optional (plainLines != []) ''
|
||||
++ lib.optional (plainLines != []) ''
|
||||
${cfg.package}/bin/mosquitto_passwd -U "$file"
|
||||
''
|
||||
++ hashedLines));
|
||||
|
||||
authPluginOptions = with types; submodule {
|
||||
authPluginOptions = with lib.types; submodule {
|
||||
options = {
|
||||
plugin = mkOption {
|
||||
plugin = lib.mkOption {
|
||||
type = path;
|
||||
description = ''
|
||||
Plugin path to load, should be a `.so` file.
|
||||
'';
|
||||
};
|
||||
|
||||
denySpecialChars = mkOption {
|
||||
denySpecialChars = lib.mkOption {
|
||||
type = bool;
|
||||
description = ''
|
||||
Automatically disallow all clients using `#`
|
||||
|
@ -195,7 +192,7 @@ let
|
|||
default = true;
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
options = lib.mkOption {
|
||||
type = attrsOf optionType;
|
||||
description = ''
|
||||
Options for the auth plugin. Each key turns into a `auth_opt_*`
|
||||
|
@ -207,7 +204,7 @@ let
|
|||
};
|
||||
|
||||
authAsserts = prefix: auth:
|
||||
mapAttrsToList
|
||||
lib.mapAttrsToList
|
||||
(n: _: {
|
||||
assertion = configKey.check n;
|
||||
message = "Invalid auth plugin key ${prefix}.${n}";
|
||||
|
@ -253,9 +250,9 @@ let
|
|||
use_username_as_clientid = 1;
|
||||
};
|
||||
|
||||
listenerOptions = with types; submodule {
|
||||
listenerOptions = with lib.types; submodule {
|
||||
options = {
|
||||
port = mkOption {
|
||||
port = lib.mkOption {
|
||||
type = port;
|
||||
description = ''
|
||||
Port to listen on. Must be set to 0 to listen on a unix domain socket.
|
||||
|
@ -263,7 +260,7 @@ let
|
|||
default = 1883;
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
address = lib.mkOption {
|
||||
type = nullOr str;
|
||||
description = ''
|
||||
Address to listen on. Listen on `0.0.0.0`/`::`
|
||||
|
@ -272,7 +269,7 @@ let
|
|||
default = null;
|
||||
};
|
||||
|
||||
authPlugins = mkOption {
|
||||
authPlugins = lib.mkOption {
|
||||
type = listOf authPluginOptions;
|
||||
description = ''
|
||||
Authentication plugin to attach to this listener.
|
||||
|
@ -282,7 +279,7 @@ let
|
|||
default = [];
|
||||
};
|
||||
|
||||
users = mkOption {
|
||||
users = lib.mkOption {
|
||||
type = attrsOf userOptions;
|
||||
example = { john = { password = "123456"; acl = [ "readwrite john/#" ]; }; };
|
||||
description = ''
|
||||
|
@ -291,7 +288,7 @@ let
|
|||
default = {};
|
||||
};
|
||||
|
||||
omitPasswordAuth = mkOption {
|
||||
omitPasswordAuth = lib.mkOption {
|
||||
type = bool;
|
||||
description = ''
|
||||
Omits password checking, allowing anyone to log in with any user name unless
|
||||
|
@ -300,7 +297,7 @@ let
|
|||
default = false;
|
||||
};
|
||||
|
||||
acl = mkOption {
|
||||
acl = lib.mkOption {
|
||||
type = listOf str;
|
||||
description = ''
|
||||
Additional ACL items to prepend to the generated ACL file.
|
||||
|
@ -309,7 +306,7 @@ let
|
|||
default = [];
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
type = submodule {
|
||||
freeformType = attrsOf optionType;
|
||||
};
|
||||
|
@ -324,7 +321,7 @@ let
|
|||
listenerAsserts = prefix: listener:
|
||||
assertKeysValid "${prefix}.settings" freeformListenerKeys listener.settings
|
||||
++ userAsserts prefix listener.users
|
||||
++ imap0
|
||||
++ lib.imap0
|
||||
(i: v: authAsserts "${prefix}.authPlugins.${toString i}" v)
|
||||
listener.authPlugins;
|
||||
|
||||
|
@ -333,9 +330,9 @@ let
|
|||
"listener ${toString listener.port} ${toString listener.address}"
|
||||
"acl_file /etc/mosquitto/acl-${toString idx}.conf"
|
||||
]
|
||||
++ optional (! listener.omitPasswordAuth) "password_file ${cfg.dataDir}/passwd-${toString idx}"
|
||||
++ lib.optional (! listener.omitPasswordAuth) "password_file ${cfg.dataDir}/passwd-${toString idx}"
|
||||
++ formatFreeform {} listener.settings
|
||||
++ concatMap formatAuthPlugin listener.authPlugins;
|
||||
++ lib.concatMap formatAuthPlugin listener.authPlugins;
|
||||
|
||||
freeformBridgeKeys = {
|
||||
bridge_alpn = 1;
|
||||
|
@ -373,19 +370,19 @@ let
|
|||
try_private = 1;
|
||||
};
|
||||
|
||||
bridgeOptions = with types; submodule {
|
||||
bridgeOptions = with lib.types; submodule {
|
||||
options = {
|
||||
addresses = mkOption {
|
||||
addresses = lib.mkOption {
|
||||
type = listOf (submodule {
|
||||
options = {
|
||||
address = mkOption {
|
||||
address = lib.mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
Address of the remote MQTT broker.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
port = lib.mkOption {
|
||||
type = port;
|
||||
description = ''
|
||||
Port of the remote MQTT broker.
|
||||
|
@ -400,7 +397,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
topics = mkOption {
|
||||
topics = lib.mkOption {
|
||||
type = listOf str;
|
||||
description = ''
|
||||
Topic patterns to be shared between the two brokers.
|
||||
|
@ -411,7 +408,7 @@ let
|
|||
example = [ "# both 2 local/topic/ remote/topic/" ];
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
type = submodule {
|
||||
freeformType = attrsOf optionType;
|
||||
};
|
||||
|
@ -426,14 +423,14 @@ let
|
|||
bridgeAsserts = prefix: bridge:
|
||||
assertKeysValid "${prefix}.settings" freeformBridgeKeys bridge.settings
|
||||
++ [ {
|
||||
assertion = length bridge.addresses > 0;
|
||||
assertion = lib.length bridge.addresses > 0;
|
||||
message = "Bridge ${prefix} needs remote broker addresses";
|
||||
} ];
|
||||
|
||||
formatBridge = name: bridge:
|
||||
[
|
||||
"connection ${name}"
|
||||
"addresses ${concatMapStringsSep " " (a: "${a.address}:${toString a.port}") bridge.addresses}"
|
||||
"addresses ${lib.concatMapStringsSep " " (a: "${a.address}:${toString a.port}") bridge.addresses}"
|
||||
]
|
||||
++ map (t: "topic ${t}") bridge.topics
|
||||
++ formatFreeform {} bridge.settings;
|
||||
|
@ -468,12 +465,12 @@ let
|
|||
websockets_log_level = 1;
|
||||
};
|
||||
|
||||
globalOptions = with types; {
|
||||
enable = mkEnableOption "the MQTT Mosquitto broker";
|
||||
globalOptions = with lib.types; {
|
||||
enable = lib.mkEnableOption "the MQTT Mosquitto broker";
|
||||
|
||||
package = mkPackageOption pkgs "mosquitto" { };
|
||||
package = lib.mkPackageOption pkgs "mosquitto" { };
|
||||
|
||||
bridges = mkOption {
|
||||
bridges = lib.mkOption {
|
||||
type = attrsOf bridgeOptions;
|
||||
default = {};
|
||||
description = ''
|
||||
|
@ -481,7 +478,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
listeners = mkOption {
|
||||
listeners = lib.mkOption {
|
||||
type = listOf listenerOptions;
|
||||
default = [];
|
||||
description = ''
|
||||
|
@ -489,7 +486,7 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
includeDirs = mkOption {
|
||||
includeDirs = lib.mkOption {
|
||||
type = listOf path;
|
||||
description = ''
|
||||
Directories to be scanned for further config files to include.
|
||||
|
@ -500,7 +497,7 @@ let
|
|||
default = [];
|
||||
};
|
||||
|
||||
logDest = mkOption {
|
||||
logDest = lib.mkOption {
|
||||
type = listOf (either path (enum [ "stdout" "stderr" "syslog" "topic" "dlt" ]));
|
||||
description = ''
|
||||
Destinations to send log messages to.
|
||||
|
@ -508,7 +505,7 @@ let
|
|||
default = [ "stderr" ];
|
||||
};
|
||||
|
||||
logType = mkOption {
|
||||
logType = lib.mkOption {
|
||||
type = listOf (enum [ "debug" "error" "warning" "notice" "information"
|
||||
"subscribe" "unsubscribe" "websockets" "none" "all" ]);
|
||||
description = ''
|
||||
|
@ -517,7 +514,7 @@ let
|
|||
default = [];
|
||||
};
|
||||
|
||||
persistence = mkOption {
|
||||
persistence = lib.mkOption {
|
||||
type = bool;
|
||||
description = ''
|
||||
Enable persistent storage of subscriptions and messages.
|
||||
|
@ -525,15 +522,15 @@ let
|
|||
default = true;
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
dataDir = lib.mkOption {
|
||||
default = "/var/lib/mosquitto";
|
||||
type = types.path;
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
The data directory.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
type = submodule {
|
||||
freeformType = attrsOf optionType;
|
||||
};
|
||||
|
@ -545,10 +542,10 @@ let
|
|||
};
|
||||
|
||||
globalAsserts = prefix: cfg:
|
||||
flatten [
|
||||
lib.flatten [
|
||||
(assertKeysValid "${prefix}.settings" freeformGlobalKeys cfg.settings)
|
||||
(imap0 (n: l: listenerAsserts "${prefix}.listener.${toString n}" l) cfg.listeners)
|
||||
(mapAttrsToList (n: b: bridgeAsserts "${prefix}.bridge.${n}" b) cfg.bridges)
|
||||
(lib.imap0 (n: l: listenerAsserts "${prefix}.listener.${toString n}" l) cfg.listeners)
|
||||
(lib.mapAttrsToList (n: b: bridgeAsserts "${prefix}.bridge.${n}" b) cfg.bridges)
|
||||
];
|
||||
|
||||
formatGlobal = cfg:
|
||||
|
@ -561,12 +558,12 @@ let
|
|||
cfg.logDest
|
||||
++ map (t: "log_type ${t}") cfg.logType
|
||||
++ formatFreeform {} cfg.settings
|
||||
++ concatLists (imap0 formatListener cfg.listeners)
|
||||
++ concatLists (mapAttrsToList formatBridge cfg.bridges)
|
||||
++ lib.concatLists (lib.imap0 formatListener cfg.listeners)
|
||||
++ lib.concatLists (lib.mapAttrsToList formatBridge cfg.bridges)
|
||||
++ map (d: "include_dir ${d}") cfg.includeDirs;
|
||||
|
||||
configFile = pkgs.writeText "mosquitto.conf"
|
||||
(concatStringsSep "\n" (formatGlobal cfg));
|
||||
(lib.concatStringsSep "\n" (formatGlobal cfg));
|
||||
|
||||
in
|
||||
|
||||
|
@ -578,7 +575,7 @@ in
|
|||
|
||||
###### Implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
assertions = globalAsserts "services.mosquitto" cfg;
|
||||
|
||||
|
@ -633,13 +630,13 @@ in
|
|||
ReadWritePaths = [
|
||||
cfg.dataDir
|
||||
"/tmp" # mosquitto_passwd creates files in /tmp before moving them
|
||||
] ++ filter path.check cfg.logDest;
|
||||
] ++ lib.filter path.check cfg.logDest;
|
||||
ReadOnlyPaths =
|
||||
map (p: "${p}")
|
||||
(cfg.includeDirs
|
||||
++ filter
|
||||
++ lib.filter
|
||||
(v: v != null)
|
||||
(flatten [
|
||||
(lib.flatten [
|
||||
(map
|
||||
(l: [
|
||||
(l.settings.psk_file or null)
|
||||
|
@ -652,7 +649,7 @@ in
|
|||
(l.settings.keyfile or null)
|
||||
])
|
||||
cfg.listeners)
|
||||
(mapAttrsToList
|
||||
(lib.mapAttrsToList
|
||||
(_: b: [
|
||||
(b.settings.bridge_cafile or null)
|
||||
(b.settings.bridge_capath or null)
|
||||
|
@ -680,26 +677,26 @@ in
|
|||
UMask = "0077";
|
||||
};
|
||||
preStart =
|
||||
concatStringsSep
|
||||
lib.concatStringsSep
|
||||
"\n"
|
||||
(imap0
|
||||
(lib.imap0
|
||||
(idx: listener: makePasswordFile (listenerScope idx) listener.users "${cfg.dataDir}/passwd-${toString idx}")
|
||||
cfg.listeners);
|
||||
};
|
||||
|
||||
environment.etc = listToAttrs (
|
||||
imap0
|
||||
environment.etc = lib.listToAttrs (
|
||||
lib.imap0
|
||||
(idx: listener: {
|
||||
name = "mosquitto/acl-${toString idx}.conf";
|
||||
value = {
|
||||
user = config.users.users.mosquitto.name;
|
||||
group = config.users.users.mosquitto.group;
|
||||
mode = "0400";
|
||||
text = (concatStringsSep
|
||||
text = (lib.concatStringsSep
|
||||
"\n"
|
||||
(flatten [
|
||||
(lib.flatten [
|
||||
listener.acl
|
||||
(mapAttrsToList
|
||||
(lib.mapAttrsToList
|
||||
(n: u: [ "user ${n}" ] ++ map (t: "topic ${t}") u.acl)
|
||||
listener.users)
|
||||
]));
|
||||
|
|
|
@ -23,6 +23,8 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
unprivilegedContainers = lib.mkEnableOption "support for unprivileged users to launch containers";
|
||||
|
||||
systemConfig =
|
||||
lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
|
@ -53,6 +55,15 @@ in
|
|||
administration access in LXC. See {manpage}`lxc-usernet(5)`.
|
||||
'';
|
||||
};
|
||||
|
||||
bridgeConfig =
|
||||
lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
This is the config file for override lxc-net bridge default settings.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
@ -62,6 +73,8 @@ in
|
|||
environment.etc."lxc/lxc.conf".text = cfg.systemConfig;
|
||||
environment.etc."lxc/lxc-usernet".text = cfg.usernetConfig;
|
||||
environment.etc."lxc/default.conf".text = cfg.defaultConfig;
|
||||
environment.etc."lxc/lxc-net".text = cfg.bridgeConfig;
|
||||
environment.pathsToLink = [ "/share/lxc" ];
|
||||
systemd.tmpfiles.rules = [ "d /var/lib/lxc/rootfs 0755 root root -" ];
|
||||
|
||||
security.apparmor.packages = [ cfg.package ];
|
||||
|
@ -73,5 +86,30 @@ in
|
|||
include ${cfg.package}/etc/apparmor.d/lxc-containers
|
||||
'';
|
||||
};
|
||||
|
||||
# We don't need the `lxc-user` group, unless the unprivileged containers are enabled.
|
||||
users.groups = lib.mkIf cfg.unprivilegedContainers { lxc-user = {}; };
|
||||
|
||||
# `lxc-user-nic` needs suid to attach to bridge for unpriv containers.
|
||||
security.wrappers = lib.mkIf cfg.unprivilegedContainers {
|
||||
lxcUserNet = {
|
||||
source = "${pkgs.lxc}/libexec/lxc/lxc-user-nic";
|
||||
setuid = true;
|
||||
owner = "root";
|
||||
group = "lxc-user";
|
||||
program = "lxc-user-nic";
|
||||
permissions = "u+rx,g+x,o-rx";
|
||||
};
|
||||
};
|
||||
|
||||
# Add lxc-net service if unpriv mode is enabled.
|
||||
systemd.packages = lib.mkIf cfg.unprivilegedContainers [ pkgs.lxc ];
|
||||
systemd.services = lib.mkIf cfg.unprivilegedContainers {
|
||||
lxc-net = {
|
||||
enable = true;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = [ pkgs.iproute2 pkgs.iptables pkgs.getent pkgs.dnsmasq ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -539,6 +539,7 @@ in {
|
|||
loki = handleTest ./loki.nix {};
|
||||
luks = handleTest ./luks.nix {};
|
||||
lvm2 = handleTest ./lvm2 {};
|
||||
lxc = handleTest ./lxc {};
|
||||
lxd = pkgs.recurseIntoAttrs (handleTest ./lxd { inherit handleTestOn; });
|
||||
lxd-image-server = handleTest ./lxd-image-server.nix {};
|
||||
#logstash = handleTest ./logstash.nix {};
|
||||
|
|
|
@ -11,8 +11,8 @@ let
|
|||
extra;
|
||||
};
|
||||
|
||||
container-image-metadata = releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system};
|
||||
container-image-rootfs = releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system};
|
||||
container-image-metadata = "${releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system}}/tarball/nixos-system-${pkgs.stdenv.hostPlatform.system}.tar.xz";
|
||||
container-image-rootfs = "${releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system}}/nixos-lxc-image-${pkgs.stdenv.hostPlatform.system}.squashfs";
|
||||
in
|
||||
{
|
||||
inherit name;
|
||||
|
@ -61,7 +61,7 @@ in
|
|||
machine.succeed("incus admin init --minimal")
|
||||
|
||||
with subtest("Container image can be imported"):
|
||||
machine.succeed("incus image import ${container-image-metadata}/*/*.tar.xz ${container-image-rootfs} --alias nixos")
|
||||
machine.succeed("incus image import ${container-image-metadata} ${container-image-rootfs} --alias nixos")
|
||||
|
||||
with subtest("Container can be launched and managed"):
|
||||
machine.succeed("incus launch nixos container")
|
||||
|
|
|
@ -16,8 +16,12 @@ import ../make-test-python.nix (
|
|||
};
|
||||
};
|
||||
|
||||
container-image-metadata = releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system};
|
||||
container-image-rootfs = releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system};
|
||||
container-image-metadata = "${
|
||||
releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system}
|
||||
}/tarball/nixos-system-${pkgs.stdenv.hostPlatform.system}.tar.xz";
|
||||
container-image-rootfs = "${
|
||||
releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system}
|
||||
}/nixos-lxc-image-${pkgs.stdenv.hostPlatform.system}.squashfs";
|
||||
in
|
||||
{
|
||||
name = "incusd-options";
|
||||
|
@ -87,7 +91,7 @@ import ../make-test-python.nix (
|
|||
machine.wait_for_unit("incus-preseed.service")
|
||||
|
||||
with subtest("Container image can be imported"):
|
||||
machine.succeed("incus image import ${container-image-metadata}/*/*.tar.xz ${container-image-rootfs} --alias nixos")
|
||||
machine.succeed("incus image import ${container-image-metadata} ${container-image-rootfs} --alias nixos")
|
||||
|
||||
with subtest("Container can be launched and managed"):
|
||||
machine.succeed("incus launch nixos container")
|
||||
|
|
124
nixos/tests/lxc/default.nix
Normal file
124
nixos/tests/lxc/default.nix
Normal file
|
@ -0,0 +1,124 @@
|
|||
import ../make-test-python.nix (
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
releases = import ../../release.nix {
|
||||
configuration = {
|
||||
# Building documentation makes the test unnecessarily take a longer time:
|
||||
documentation.enable = lib.mkForce false;
|
||||
};
|
||||
};
|
||||
|
||||
lxc-image-metadata = releases.lxdContainerMeta.${pkgs.stdenv.hostPlatform.system};
|
||||
lxc-image-rootfs = releases.lxdContainerImage.${pkgs.stdenv.hostPlatform.system};
|
||||
|
||||
in
|
||||
{
|
||||
name = "lxc-container-unprivileged";
|
||||
|
||||
meta = {
|
||||
maintainers = lib.teams.lxc.members;
|
||||
};
|
||||
|
||||
nodes.machine =
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
virtualisation = {
|
||||
diskSize = 6144;
|
||||
cores = 2;
|
||||
memorySize = 512;
|
||||
writableStore = true;
|
||||
|
||||
lxc = {
|
||||
enable = true;
|
||||
unprivilegedContainers = true;
|
||||
systemConfig = ''
|
||||
lxc.lxcpath = /tmp/lxc
|
||||
'';
|
||||
defaultConfig = ''
|
||||
lxc.net.0.type = veth
|
||||
lxc.net.0.link = lxcbr0
|
||||
lxc.net.0.flags = up
|
||||
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
|
||||
lxc.idmap = u 0 100000 65536
|
||||
lxc.idmap = g 0 100000 65536
|
||||
'';
|
||||
# Permit user alice to connect to bridge
|
||||
usernetConfig = ''
|
||||
@lxc-user veth lxcbr0 10
|
||||
'';
|
||||
bridgeConfig = ''
|
||||
LXC_IPV6_ADDR=""
|
||||
LXC_IPV6_MASK=""
|
||||
LXC_IPV6_NETWORK=""
|
||||
LXC_IPV6_NAT="false"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Needed for lxc
|
||||
environment.systemPackages = with pkgs; [
|
||||
pkgs.wget
|
||||
pkgs.dnsmasq
|
||||
];
|
||||
|
||||
# Create user for test
|
||||
users.users.alice = {
|
||||
isNormalUser = true;
|
||||
password = "test";
|
||||
description = "Lxc unprivileged user with access to lxcbr0";
|
||||
extraGroups = [ "lxc-user" ];
|
||||
subGidRanges = [
|
||||
{
|
||||
startGid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
subUidRanges = [
|
||||
{
|
||||
startUid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
users.users.bob = {
|
||||
isNormalUser = true;
|
||||
password = "test";
|
||||
description = "Lxc unprivileged user without access to lxcbr0";
|
||||
subGidRanges = [
|
||||
{
|
||||
startGid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
subUidRanges = [
|
||||
{
|
||||
startUid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("lxc-net.service")
|
||||
|
||||
# Copy config files for alice
|
||||
machine.execute("su -- alice -c 'mkdir -p ~/.config/lxc'")
|
||||
machine.execute("su -- alice -c 'cp /etc/lxc/default.conf ~/.config/lxc/'")
|
||||
machine.execute("su -- alice -c 'cp /etc/lxc/lxc.conf ~/.config/lxc/'")
|
||||
|
||||
machine.succeed("su -- alice -c 'lxc-create -t local -n test -- --metadata ${lxc-image-metadata}/*/*.tar.xz --fstree ${lxc-image-rootfs}/*/*.tar.xz'")
|
||||
machine.succeed("su -- alice -c 'lxc-start test'")
|
||||
machine.succeed("su -- alice -c 'lxc-stop test'")
|
||||
|
||||
# Copy config files for bob
|
||||
machine.execute("su -- bob -c 'mkdir -p ~/.config/lxc'")
|
||||
machine.execute("su -- bob -c 'cp /etc/lxc/default.conf ~/.config/lxc/'")
|
||||
machine.execute("su -- bob -c 'cp /etc/lxc/lxc.conf ~/.config/lxc/'")
|
||||
|
||||
machine.fail("su -- bob -c 'lxc-start test'")
|
||||
'';
|
||||
}
|
||||
)
|
|
@ -64,7 +64,7 @@ in {
|
|||
|
||||
with subtest("Squashfs image is functional"):
|
||||
machine.succeed(
|
||||
"lxc image import ${lxd-image-metadata}/*/*.tar.xz ${lxd-image-rootfs-squashfs} --alias nixos-squashfs"
|
||||
"lxc image import ${lxd-image-metadata}/*/*.tar.xz ${lxd-image-rootfs-squashfs}/nixos-lxc-image-${pkgs.stdenv.hostPlatform.system}.squashfs --alias nixos-squashfs"
|
||||
)
|
||||
machine.succeed("lxc launch nixos-squashfs container")
|
||||
with machine.nested("Waiting for instance to start and be usable"):
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
{ lib
|
||||
, python3
|
||||
, fetchFromGitHub
|
||||
, meson
|
||||
, ninja
|
||||
, gettext
|
||||
, appstream
|
||||
, appstream-glib
|
||||
, wrapGAppsHook4
|
||||
, desktop-file-utils
|
||||
, gobject-introspection
|
||||
, gtk4
|
||||
, gtksourceview5
|
||||
, libadwaita
|
||||
, libportal
|
||||
, librsvg
|
||||
, poppler_gi
|
||||
, webkitgtk_6_0
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "setzer";
|
||||
version = "65";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "cvfosammmm";
|
||||
repo = "Setzer";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-5Hpj/RkD11bNcr9/gQG0Y7BNMsh1BGZQiN4IMbI4osc=";
|
||||
};
|
||||
|
||||
format = "other";
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
gettext
|
||||
appstream # for appstreamcli
|
||||
appstream-glib
|
||||
wrapGAppsHook4
|
||||
desktop-file-utils
|
||||
gobject-introspection
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gtk4
|
||||
gtksourceview5
|
||||
libadwaita
|
||||
libportal
|
||||
librsvg
|
||||
poppler_gi
|
||||
webkitgtk_6_0
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
bibtexparser
|
||||
numpy
|
||||
pdfminer-six
|
||||
pexpect
|
||||
pillow
|
||||
pycairo
|
||||
pygobject3
|
||||
pyxdg
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
meson test --print-errorlogs
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "LaTeX editor written in Python with Gtk";
|
||||
mainProgram = "setzer";
|
||||
homepage = src.meta.homepage;
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{ stdenv, nixosTests, lib, edk2, util-linux, nasm, acpica-tools, llvmPackages
|
||||
, fetchurl, python3, pexpect, xorriso, qemu, dosfstools, mtools
|
||||
, fetchFromGitLab, python3, pexpect, xorriso, qemu, dosfstools, mtools
|
||||
, fdSize2MB ? false
|
||||
, fdSize4MB ? secureBoot
|
||||
, secureBoot ? false
|
||||
|
@ -12,7 +12,7 @@
|
|||
# to use as the PK and first KEK for the keystore.
|
||||
#
|
||||
# By default, we use Debian's cert. This default
|
||||
# should chnage to a NixOS cert once we have our
|
||||
# should change to a NixOS cert once we have our
|
||||
# own secure boot signing infrastructure.
|
||||
#
|
||||
# Ignored if msVarsTemplate is false.
|
||||
|
@ -66,9 +66,18 @@ let
|
|||
|
||||
OvmfPkKek1AppPrefix = "4e32566d-8e9e-4f52-81d3-5bb9715f9727";
|
||||
|
||||
debian-edk-src = fetchurl {
|
||||
url = "http://deb.debian.org/debian/pool/main/e/edk2/edk2_2023.11-5.debian.tar.xz";
|
||||
sha256 = "1yxlab4md30pxvjadr6b4xn6cyfw0c292q63pyfv4vylvhsb24g4";
|
||||
debian-edk-src = fetchFromGitLab {
|
||||
domain = "salsa.debian.org";
|
||||
owner = "qemu-team";
|
||||
repo = "edk2";
|
||||
nonConeMode = true;
|
||||
sparseCheckout = [
|
||||
"debian/edk2-vars-generator.py"
|
||||
"debian/python"
|
||||
"debian/PkKek-1-*.pem"
|
||||
];
|
||||
rev = "refs/tags/debian/2024.05-1";
|
||||
hash = "sha256-uAjXJaHOVh944ZxcA2IgCsrsncxuhc0JKlsXs0E03s0=";
|
||||
};
|
||||
|
||||
buildPrefix = "Build/*/*";
|
||||
|
@ -111,7 +120,7 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||
env.PYTHON_COMMAND = "python3";
|
||||
|
||||
postUnpack = lib.optionalDrvAttr msVarsTemplate ''
|
||||
unpackFile ${debian-edk-src}
|
||||
ln -s ${debian-edk-src}/debian
|
||||
'';
|
||||
|
||||
postConfigure = lib.optionalDrvAttr msVarsTemplate ''
|
||||
|
@ -138,7 +147,8 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||
'' + lib.optionalString msVarsTemplate ''
|
||||
(
|
||||
cd ${buildPrefix}
|
||||
python3 $NIX_BUILD_TOP/debian/edk2-vars-generator.py \
|
||||
# locale must be set on Darwin for invocations of mtools to work correctly
|
||||
LC_ALL=C python3 $NIX_BUILD_TOP/debian/edk2-vars-generator.py \
|
||||
--flavor ${msVarsArgs.flavor} \
|
||||
--enrolldefaultkeys ${msVarsArgs.archDir}/EnrollDefaultKeys.efi \
|
||||
--shell ${msVarsArgs.archDir}/Shell.efi \
|
||||
|
@ -165,7 +175,7 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||
ln -sv $fd/FV/${fwPrefix}_CODE{,.ms}.fd
|
||||
'' + lib.optionalString stdenv.hostPlatform.isAarch ''
|
||||
mv -v $out/FV/QEMU_{EFI,VARS}.fd $fd/FV
|
||||
# Add symlinks for Fedora dir layout: https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/edk2.spec
|
||||
# Add symlinks for Fedora dir layout: https://src.fedoraproject.org/rpms/edk2/blob/main/f/edk2.spec
|
||||
mkdir -vp $fd/AAVMF
|
||||
ln -s $fd/FV/AAVMF_CODE.fd $fd/AAVMF/QEMU_EFI-pflash.raw
|
||||
ln -s $fd/FV/AAVMF_VARS.fd $fd/AAVMF/vars-template-pflash.raw
|
||||
|
@ -179,6 +189,9 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||
in {
|
||||
firmware = "${prefix}_CODE.fd";
|
||||
variables = "${prefix}_VARS.fd";
|
||||
variablesMs =
|
||||
assert msVarsTemplate;
|
||||
"${prefix}_VARS.ms.fd";
|
||||
# This will test the EFI firmware for the host platform as part of the NixOS Tests setup.
|
||||
tests.basic-systemd-boot = nixosTests.systemd-boot.basic;
|
||||
tests.secureBoot-systemd-boot = nixosTests.systemd-boot.secureBoot;
|
||||
|
@ -190,7 +203,7 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
|
|||
homepage = "https://github.com/tianocore/tianocore.github.io/wiki/OVMF";
|
||||
license = lib.licenses.bsd2;
|
||||
platforms = metaPlatforms;
|
||||
maintainers = with lib.maintainers; [ adamcstephens raitobezarius ];
|
||||
broken = stdenv.isDarwin;
|
||||
maintainers = with lib.maintainers; [ adamcstephens raitobezarius mjoerg ];
|
||||
broken = stdenv.isDarwin && stdenv.isAarch64;
|
||||
};
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@ let
|
|||
self = python3;
|
||||
packageOverrides = _: super: { tree-sitter = super.tree-sitter_0_21; };
|
||||
};
|
||||
version = "0.51.0";
|
||||
version = "0.53.0";
|
||||
in
|
||||
python3.pkgs.buildPythonApplication {
|
||||
pname = "aider-chat";
|
||||
|
@ -23,7 +23,7 @@ python3.pkgs.buildPythonApplication {
|
|||
owner = "paul-gauthier";
|
||||
repo = "aider";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-vomRXWL3++1R8jpjMKbsGrB+B1FWQxVbLKxuPttnspw=";
|
||||
hash = "sha256-KQp4qqQKm++oB9RVQZhAWQJs7Nbyssc9eKKRH1VZbRU=";
|
||||
};
|
||||
|
||||
build-system = with python3.pkgs; [ setuptools ];
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
|
||||
buildNpmPackage rec {
|
||||
pname = "bitwarden-cli";
|
||||
version = "2024.8.0";
|
||||
version = "2024.8.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "bitwarden";
|
||||
repo = "clients";
|
||||
rev = "cli-v${version}";
|
||||
hash = "sha256-vosEc8HCMHEaaQadzA+jDjQA1liEtD8sS1Zndz/Iv00=";
|
||||
hash = "sha256-l9fLh1YFivVcMs688vM0pHoN0Um2r/EDpo7dvwvZFwY=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
|
@ -27,10 +27,10 @@ buildNpmPackage rec {
|
|||
|
||||
nodejs = nodejs_20;
|
||||
|
||||
npmDepsHash = "sha256-5neEpU7ZhVO5OR181owsvAnFfl7lr0MymvqbRFCPs3M=";
|
||||
npmDepsHash = "sha256-/6yWdTy6/GvYy8u5eZB+x5KRG6vhPVE0DIn+RUAO5MI=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
(python3.withPackages (ps: with ps; [ setuptools ]))
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
cctools
|
||||
xcbuild.xcrun
|
||||
|
@ -38,7 +38,19 @@ buildNpmPackage rec {
|
|||
|
||||
makeCacheWritable = true;
|
||||
|
||||
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
env = {
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
npm_config_build_from_source = "true";
|
||||
};
|
||||
|
||||
# node-argon2 builds with LTO, but that causes missing symbols. So disable it
|
||||
# and rebuild. See https://github.com/ranisalt/node-argon2/pull/415
|
||||
preConfigure = ''
|
||||
pushd node_modules/argon2
|
||||
substituteInPlace binding.gyp --replace-fail '"-flto", ' ""
|
||||
"$npm_config_node_gyp" rebuild
|
||||
popd
|
||||
'';
|
||||
|
||||
npmBuildScript = "build:oss:prod";
|
||||
|
||||
|
|
2749
pkgs/by-name/co/cosmic-notifications/Cargo.lock
generated
2749
pkgs/by-name/co/cosmic-notifications/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -15,27 +15,31 @@
|
|||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "cosmic-notifications";
|
||||
version = "unstable-2024-01-05";
|
||||
version = "1.0.0-alpha.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pop-os";
|
||||
repo = pname;
|
||||
rev = "3b07cf550a54b757a5f136e4d8fde74d09afe3fd";
|
||||
hash = "sha256-+S8bPorarSJQwIQfTmo4qK+B1kKAlQvllUuZ2UBL0eY=";
|
||||
repo = "cosmic-notifications";
|
||||
rev = "epoch-${version}";
|
||||
hash = "sha256-tCizZePze94tbJbR91N9rfUhrLFTAMW2oL9ByKOeDAU=";
|
||||
};
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"accesskit-0.11.0" = "sha256-xVhe6adUb8VmwIKKjHxwCwOo5Y1p3Or3ylcJJdLDrrE=";
|
||||
"accesskit-0.12.2" = "sha256-1UwgRyUe0PQrZrpS7574oNLi13fg5HpgILtZGW6JNtQ=";
|
||||
"atomicwrites-0.4.2" = "sha256-QZSuGPrJXh+svMeFWqAXoqZQxLq/WfIiamqvjJNVhxA=";
|
||||
"cosmic-client-toolkit-0.1.0" = "sha256-AEgvF7i/OWPdEMi8WUaAg99igBwE/AexhAXHxyeJMdc=";
|
||||
"cosmic-config-0.1.0" = "sha256-DmuUvFjhoqI5lneiWFFYF3WM3mACx5ZfZqeKpsyL7Ss=";
|
||||
"cosmic-text-0.10.0" = "sha256-kIBhh6CakQaWGfBWu5qaV8LAbJENX7GW+BStJK/P4iA=";
|
||||
"cosmic-settings-daemon-0.1.0" = "sha256-z/dvRyc3Zc1fAQh2HKk6NI6QSDpNqarqslwszjU+0nc=";
|
||||
"glyphon-0.3.0" = "sha256-JGkNIfj1HjOF8kGxqJPNq/JO+NhZD6XrZ4KmkXEP6Xc=";
|
||||
"smithay-client-toolkit-0.18.0" = "sha256-2WbDKlSGiyVmi7blNBr2Aih9FfF2dq/bny57hoA4BrE=";
|
||||
"softbuffer-0.3.3" = "sha256-eKYFVr6C1+X6ulidHIu9SP591rJxStxwL9uMiqnXx4k=";
|
||||
"clipboard_macos-0.1.0" = "sha256-cG5vnkiyDlQnbEfV2sPbmBYKv1hd3pjJrymfZb8ziKk=";
|
||||
"cosmic-client-toolkit-0.1.0" = "sha256-1XtyEvednEMN4MApxTQid4eed19dEN5ZBDt/XRjuda0=";
|
||||
"cosmic-config-0.1.0" = "sha256-DgMh0gqWUmXjBhBySR0CMnv/8O3XbS2BwomU9eNt+4o=";
|
||||
"cosmic-panel-config-0.1.0" = "sha256-bBUSZ3CTLq/DCQ2dMvaIcGcIcjqM/5vny5kTE3Jclj8=";
|
||||
"cosmic-settings-daemon-0.1.0" = "sha256-+1XB7r45Uc71fLnNR4U0DUF2EB8uzKeE4HIrdvKhFXo=";
|
||||
"cosmic-text-0.12.1" = "sha256-x0XTxzbmtE2d4XCG/Nuq3DzBpz15BbnjRRlirfNJEiU=";
|
||||
"cosmic-time-0.4.0" = "sha256-w4yY1fc4r1+pSv93dy/Hu3AD+I1+sozIPbbCoaVQj7w=";
|
||||
"d3d12-0.19.0" = "sha256-usrxQXWLGJDjmIdw1LBXtBvX+CchZDvE8fHC0LjvhD4=";
|
||||
"glyphon-0.5.0" = "sha256-j1HrbEpUBqazWqNfJhpyjWuxYAxkvbXzRKeSouUoPWg=";
|
||||
"smithay-clipboard-0.8.0" = "sha256-4InFXm0ahrqFrtNLeqIuE3yeOpxKZJZx+Bc0yQDtv34=";
|
||||
"softbuffer-0.4.1" = "sha256-a0bUFz6O8CWRweNt/OxTvflnPYwO5nm6vsyc/WcXyNg=";
|
||||
"taffy-0.3.11" = "sha256-SCx9GEIJjWdoNVyq+RZAGn0N71qraKZxf9ZWhvyzLaI=";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cosmic-protocols";
|
||||
version = "0-unstable-2024-01-11";
|
||||
version = "0-unstable-2024-07-31";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pop-os";
|
||||
repo = pname;
|
||||
rev = "e65fa5e2bb47e51656221657049bd3f88ae9dae5";
|
||||
hash = "sha256-vj7Wm1uJ5ULvGNEwKznNhujCZQiuntsWMyKQbIVaO/Q=";
|
||||
rev = "de2fead49d6af3a221db153642e4d7c2235aafc4";
|
||||
hash = "sha256-qgo8FMKo/uCbhUjfykRRN8KSavbyhZpu82M8npLcIPI=";
|
||||
};
|
||||
|
||||
makeFlags = [ "PREFIX=${placeholder "out"}" ];
|
||||
|
@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
|
|||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/pop-os/cosmic-protocols";
|
||||
description = "Addtional wayland-protocols used by the COSMIC desktop environment";
|
||||
description = "Additional wayland-protocols used by the COSMIC desktop environment";
|
||||
license = [ licenses.mit licenses.gpl3Only ];
|
||||
maintainers = with maintainers; [ nyanbinary ];
|
||||
platforms = platforms.linux;
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "cosmic-screenshot";
|
||||
version = "unstable-2023-11-08";
|
||||
version = "1.0.0-alpha.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pop-os";
|
||||
repo = pname;
|
||||
rev = "b413a7128ddcdfb3c63e84bdade5c5b90b163a9a";
|
||||
hash = "sha256-SDxBBhmnqNDX95Rb7QiI46sAxrfodB5tSq8AbXAU480=";
|
||||
rev = "epoch-${version}";
|
||||
hash = "sha256-+yHpRbK+AWnpcGrC5U0wKbt0u8tm3CFGjKTCDQpb3G0=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-ZRsAhIWPm38Ys9jM/3yVJLW818lUGLCcSfFZb+UTbnU=";
|
||||
cargoHash = "sha256-d56y35npMPrQM0yF0ytNcOdMKBz9IQvEz37DNvKBBSk=";
|
||||
|
||||
nativeBuildInputs = [ just pkg-config ];
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{ stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, applyPatches
|
||||
, libuuid
|
||||
, bc
|
||||
, lib
|
||||
, buildPackages
|
||||
, nixosTests
|
||||
, runCommand
|
||||
, writeScript
|
||||
}:
|
||||
|
||||
|
@ -31,45 +31,68 @@ buildType = if stdenv.isDarwin then
|
|||
else
|
||||
"GCC5";
|
||||
|
||||
edk2 = stdenv.mkDerivation rec {
|
||||
edk2 = stdenv.mkDerivation {
|
||||
pname = "edk2";
|
||||
version = "202402";
|
||||
|
||||
patches = [
|
||||
# pass targetPrefix as an env var
|
||||
(fetchpatch {
|
||||
url = "https://src.fedoraproject.org/rpms/edk2/raw/08f2354cd280b4ce5a7888aa85cf520e042955c3/f/0021-Tweak-the-tools_def-to-support-cross-compiling.patch";
|
||||
hash = "sha256-E1/fiFNVx0aB1kOej2DJ2DlBIs9tAAcxoedym2Zhjxw=";
|
||||
})
|
||||
# https://github.com/tianocore/edk2/pull/5658
|
||||
(fetchpatch {
|
||||
url = "https://github.com/tianocore/edk2/commit/a34ff4a8f69a7b8a52b9b299153a8fac702c7df1.patch";
|
||||
hash = "sha256-u+niqwjuLV5tNPykW4xhb7PW2XvUmXhx5uvftG1UIbU=";
|
||||
})
|
||||
];
|
||||
version = "202408";
|
||||
|
||||
srcWithVendoring = fetchFromGitHub {
|
||||
owner = "tianocore";
|
||||
repo = "edk2";
|
||||
rev = "edk2-stable${edk2.version}";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-Nurm6QNKCyV6wvbj0ELdYAL7mbZ0yg/tTwnEJ+N18ng=";
|
||||
hash = "sha256-2odaTqiAZD5xduT0dwIYWj3gY/aFPVsTFbblIsEhBiA=";
|
||||
};
|
||||
|
||||
# We don't want EDK2 to keep track of OpenSSL,
|
||||
# they're frankly bad at it.
|
||||
src = runCommand "edk2-unvendored-src" { } ''
|
||||
cp --no-preserve=mode -r ${srcWithVendoring} $out
|
||||
rm -rf $out/CryptoPkg/Library/OpensslLib/openssl
|
||||
mkdir -p $out/CryptoPkg/Library/OpensslLib/openssl
|
||||
tar --strip-components=1 -xf ${buildPackages.openssl.src} -C $out/CryptoPkg/Library/OpensslLib/openssl
|
||||
chmod -R +w $out/
|
||||
src = applyPatches {
|
||||
name = "edk2-${edk2.version}-unvendored-src";
|
||||
src = edk2.srcWithVendoring;
|
||||
|
||||
# Fix missing INT64_MAX include that edk2 explicitly does not provide
|
||||
# via it's own <stdint.h>. Let's pull in openssl's definition instead:
|
||||
sed -i $out/CryptoPkg/Library/OpensslLib/openssl/crypto/property/property_parse.c \
|
||||
-e '1i #include "internal/numbers.h"'
|
||||
'';
|
||||
patches = [
|
||||
# pass targetPrefix as an env var
|
||||
(fetchpatch {
|
||||
url = "https://src.fedoraproject.org/rpms/edk2/raw/08f2354cd280b4ce5a7888aa85cf520e042955c3/f/0021-Tweak-the-tools_def-to-support-cross-compiling.patch";
|
||||
hash = "sha256-E1/fiFNVx0aB1kOej2DJ2DlBIs9tAAcxoedym2Zhjxw=";
|
||||
})
|
||||
# https://github.com/tianocore/edk2/pull/5658
|
||||
(fetchpatch {
|
||||
name = "fix-cross-compilation-antlr-dlg.patch";
|
||||
url = "https://github.com/tianocore/edk2/commit/a34ff4a8f69a7b8a52b9b299153a8fac702c7df1.patch";
|
||||
hash = "sha256-u+niqwjuLV5tNPykW4xhb7PW2XvUmXhx5uvftG1UIbU=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# We don't want EDK2 to keep track of OpenSSL, they're frankly bad at it.
|
||||
rm -r CryptoPkg/Library/OpensslLib/openssl
|
||||
mkdir -p CryptoPkg/Library/OpensslLib/openssl
|
||||
(
|
||||
cd CryptoPkg/Library/OpensslLib/openssl
|
||||
tar --strip-components=1 -xf ${buildPackages.openssl.src}
|
||||
|
||||
# Apply OpenSSL patches.
|
||||
${lib.pipe buildPackages.openssl.patches [
|
||||
(builtins.filter (
|
||||
patch:
|
||||
!builtins.elem (baseNameOf patch) [
|
||||
# Exclude patches not required in this context.
|
||||
"nix-ssl-cert-file.patch"
|
||||
"openssl-disable-kernel-detection.patch"
|
||||
"use-etc-ssl-certs-darwin.patch"
|
||||
"use-etc-ssl-certs.patch"
|
||||
]
|
||||
))
|
||||
(map (patch: "patch -p1 < ${patch}\n"))
|
||||
lib.concatStrings
|
||||
]}
|
||||
)
|
||||
|
||||
# enable compilation using Clang
|
||||
# https://bugzilla.tianocore.org/show_bug.cgi?id=4620
|
||||
substituteInPlace BaseTools/Conf/tools_def.template --replace-fail \
|
||||
'DEFINE CLANGPDB_WARNING_OVERRIDES = ' \
|
||||
'DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-unneeded-internal-declaration '
|
||||
'';
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pythonEnv ];
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.bash ];
|
||||
|
@ -100,12 +123,13 @@ edk2 = stdenv.mkDerivation rec {
|
|||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Intel EFI development kit";
|
||||
homepage = "https://github.com/tianocore/tianocore.github.io/wiki/EDK-II/";
|
||||
changelog = "https://github.com/tianocore/edk2/releases/tag/edk2-stable${edk2.version}";
|
||||
license = licenses.bsd2;
|
||||
platforms = with platforms; aarch64 ++ arm ++ i686 ++ x86_64 ++ riscv64;
|
||||
license = lib.licenses.bsd2;
|
||||
platforms = with lib.platforms; aarch64 ++ arm ++ i686 ++ x86_64 ++ riscv64;
|
||||
maintainers = [ lib.maintainers.mjoerg ];
|
||||
};
|
||||
|
||||
passthru = {
|
||||
|
|
|
@ -122,6 +122,9 @@ rustPlatform.buildRustPackage rec {
|
|||
withSecretProvisioning = kanidm.override { enableSecretProvisioning = true; };
|
||||
};
|
||||
|
||||
# can take over 4 hours on 2 cores and needs 16GB+ RAM
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/kanidm/kanidm/releases/tag/v${version}";
|
||||
description = "Simple, secure and fast identity management platform";
|
||||
|
|
|
@ -48,16 +48,37 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
patches = [
|
||||
# fix docbook2man version detection
|
||||
./docbook-hack.patch
|
||||
|
||||
# Fix hardcoded path of lxc-user-nic
|
||||
# This is needed to use unprivileged containers
|
||||
./user-nic.diff
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
"-Dinstall-init-files=false"
|
||||
"-Dinstall-init-files=true"
|
||||
"-Dinstall-state-dirs=false"
|
||||
"-Dspecfile=false"
|
||||
"-Dtools-multicall=true"
|
||||
"-Dtools=false"
|
||||
"-Dusernet-config-path=/etc/lxc/lxc-usernet"
|
||||
"-Ddistrosysconfdir=${placeholder "out"}/etc/lxc"
|
||||
"-Dsystemd-unitdir=${placeholder "out"}/lib/systemd/system"
|
||||
];
|
||||
|
||||
# /run/current-system/sw/share
|
||||
postInstall = ''
|
||||
substituteInPlace $out/etc/lxc/lxc --replace-fail "$out/etc/lxc" "/etc/lxc"
|
||||
substituteInPlace $out/libexec/lxc/lxc-net --replace-fail "$out/etc/lxc" "/etc/lxc"
|
||||
|
||||
substituteInPlace $out/share/lxc/templates/lxc-download --replace-fail "$out/share" "/run/current-system/sw/share"
|
||||
substituteInPlace $out/share/lxc/templates/lxc-local --replace-fail "$out/share" "/run/current-system/sw/share"
|
||||
substituteInPlace $out/share/lxc/templates/lxc-oci --replace-fail "$out/share" "/run/current-system/sw/share"
|
||||
|
||||
substituteInPlace $out/share/lxc/config/common.conf --replace-fail "$out/share" "/run/current-system/sw/share"
|
||||
substituteInPlace $out/share/lxc/config/userns.conf --replace-fail "$out/share" "/run/current-system/sw/share"
|
||||
substituteInPlace $out/share/lxc/config/oci.common.conf --replace-fail "$out/share" "/run/current-system/sw/share"
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
|
@ -66,6 +87,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
tests = {
|
||||
incus-legacy-init = nixosTests.incus.container-legacy-init;
|
||||
incus-systemd-init = nixosTests.incus.container-systemd-init;
|
||||
lxc = nixosTests.lxc;
|
||||
lxd = nixosTests.lxd.container;
|
||||
};
|
||||
|
||||
|
|
13
pkgs/by-name/lx/lxc/user-nic.diff
Normal file
13
pkgs/by-name/lx/lxc/user-nic.diff
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/lxc/network.c b/src/lxc/network.c
|
||||
index 0a99d32..850e975 100644
|
||||
--- a/src/lxc/network.c
|
||||
+++ b/src/lxc/network.c
|
||||
@@ -2940,7 +2940,7 @@ int lxc_find_gateway_addresses(struct lxc_handler *handler)
|
||||
|
||||
#ifdef IN_LIBLXC
|
||||
|
||||
-#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
|
||||
+#define LXC_USERNIC_PATH "/run/wrappers/bin/lxc-user-nic"
|
||||
static int lxc_create_network_unpriv_exec(const char *lxcpath,
|
||||
const char *lxcname,
|
||||
struct lxc_netdev *netdev, pid_t pid,
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "nwg-panel";
|
||||
version = "0.9.37";
|
||||
version = "0.9.38";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nwg-piotr";
|
||||
repo = "nwg-panel";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-CKufaOAh7wH2ECN+zsPk4PQNYuewT2BzTci8nt8EhlU=";
|
||||
hash = "sha256-5vq/5QovvoDUDu9IiAeI9c06g0iy9YLi7CdpEhXbLqI=";
|
||||
};
|
||||
|
||||
# No tests
|
||||
|
|
|
@ -18,15 +18,15 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
postPatch = ''
|
||||
substituteInPlace src/lib.rs \
|
||||
--replace '/usr/lib/pop-launcher' "$out/share/pop-launcher"
|
||||
--replace-fail '/usr/lib/pop-launcher' "$out/share/pop-launcher"
|
||||
substituteInPlace plugins/src/scripts/mod.rs \
|
||||
--replace '/usr/lib/pop-launcher' "$out/share/pop-launcher"
|
||||
--replace-fail '/usr/lib/pop-launcher' "$out/share/pop-launcher"
|
||||
substituteInPlace plugins/src/calc/mod.rs \
|
||||
--replace 'Command::new("qalc")' 'Command::new("${libqalculate}/bin/qalc")'
|
||||
--replace-fail 'Command::new("qalc")' 'Command::new("${libqalculate}/bin/qalc")'
|
||||
substituteInPlace plugins/src/find/mod.rs \
|
||||
--replace 'spawn("fd")' 'spawn("${fd}/bin/fd")'
|
||||
--replace-fail 'spawn("fd")' 'spawn("${fd}/bin/fd")'
|
||||
substituteInPlace plugins/src/terminal/mod.rs \
|
||||
--replace '/usr/bin/gnome-terminal' 'gnome-terminal'
|
||||
--replace-fail '/usr/bin/gnome-terminal' 'gnome-terminal'
|
||||
'';
|
||||
|
||||
cargoHash = "sha256-cTvrq0fH057UIx/O9u8zHMsg+psMGg1q9klV5OMxtok=";
|
81
pkgs/by-name/se/setzer/package.nix
Normal file
81
pkgs/by-name/se/setzer/package.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
appstream,
|
||||
appstream-glib,
|
||||
desktop-file-utils,
|
||||
fetchFromGitHub,
|
||||
gettext,
|
||||
gobject-introspection,
|
||||
gtk4,
|
||||
gtksourceview5,
|
||||
lib,
|
||||
libadwaita,
|
||||
libportal,
|
||||
librsvg,
|
||||
meson,
|
||||
ninja,
|
||||
poppler_gi,
|
||||
python3Packages,
|
||||
webkitgtk_6_0,
|
||||
wrapGAppsHook4,
|
||||
}:
|
||||
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "setzer";
|
||||
version = "66";
|
||||
pyproject = false;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "cvfosammmm";
|
||||
repo = "Setzer";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-hqwwDR9jCk2XptcqpaReZ73jqpq4JpYD3Rc2OmrEPxg=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
gettext
|
||||
appstream # for appstreamcli
|
||||
appstream-glib
|
||||
wrapGAppsHook4
|
||||
desktop-file-utils
|
||||
gobject-introspection
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gtk4
|
||||
gtksourceview5
|
||||
libadwaita
|
||||
libportal
|
||||
librsvg
|
||||
poppler_gi
|
||||
webkitgtk_6_0
|
||||
];
|
||||
|
||||
dependencies = with python3Packages; [
|
||||
bibtexparser
|
||||
numpy
|
||||
pdfminer-six
|
||||
pexpect
|
||||
pillow
|
||||
pycairo
|
||||
pygobject3
|
||||
pyxdg
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
meson test --print-errorlogs
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "LaTeX editor written in Python with Gtk";
|
||||
mainProgram = "setzer";
|
||||
homepage = "https://www.cvfosammmm.org/setzer/";
|
||||
license = lib.licenses.gpl3Plus;
|
||||
maintainers = with lib.maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "uxn";
|
||||
version = "1.0-unstable-2024-08-12";
|
||||
version = "1.0-unstable-2024-08-25";
|
||||
|
||||
src = fetchFromSourcehut {
|
||||
owner = "~rabbits";
|
||||
repo = "uxn";
|
||||
rev = "3a901ed0beeaf5e3268a40779f2944ef99f93774";
|
||||
hash = "sha256-JlDNiKcaZG2OYeiVlIovEIDN/h7ET5d0M83vlHMQQK4=";
|
||||
rev = "6d5e3848bdbd76420b93ca47de148cbf46baf9f6";
|
||||
hash = "sha256-YTDL3NZSjbVqu6aPJBmUmsT3bDX2VUeufXq/Q+jn4Og=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "projects" ];
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
|
||||
stdenv.mkDerivation (finalPackages: {
|
||||
pname = "xarcan";
|
||||
version = "0-unstable-2024-08-04";
|
||||
version = "0-unstable-2024-08-26";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "letoram";
|
||||
repo = "xarcan";
|
||||
rev = "7644616b3bd0ff2b5708e93acc990cd757b20ae9";
|
||||
hash = "sha256-iKYTuJ/1iwm449ZOBOzi+LkrTTio7aaIHUn+M+Sbzc8=";
|
||||
rev = "5672116f627de492fb4df0b33d36b78041cd3931";
|
||||
hash = "sha256-xZX6uLs/H/wONKrUnYxSynHK7CL7FDfzWvSjtXxT8es=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
|
|
@ -16,6 +16,7 @@ let
|
|||
"12.1" = "12.1.1";
|
||||
"12.2" = "12.2.2";
|
||||
"12.3" = "12.3.0";
|
||||
"12.4" = "12.4.0";
|
||||
};
|
||||
|
||||
# Check if the current CUDA version is supported.
|
||||
|
|
1674
pkgs/development/cuda-modules/cuda/manifests/feature_12.4.0.json
Normal file
1674
pkgs/development/cuda-modules/cuda/manifests/feature_12.4.0.json
Normal file
File diff suppressed because it is too large
Load diff
1205
pkgs/development/cuda-modules/cuda/manifests/redistrib_12.4.0.json
Normal file
1205
pkgs/development/cuda-modules/cuda/manifests/redistrib_12.4.0.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -105,4 +105,10 @@
|
|||
url = "https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda_12.3.0_545.23.06_linux.run";
|
||||
sha256 = "sha256-fBP6zjr2TW4WSNbjEB0xyBEedHFDrLAHfZc8FpCCBCI=";
|
||||
};
|
||||
|
||||
"12.4" = {
|
||||
version = "12.4.0";
|
||||
url = "https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run";
|
||||
sha256 = "sha256-5qhC9OypSQV1zbaLaxu3jUe5Wol95I3uKSxDGJLlfRc=";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,6 +11,13 @@
|
|||
url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-aarch64/cudnn-linux-aarch64-8.9.5.30_cuda12-archive.tar.xz";
|
||||
hash = "sha256-BJH3sC9VwiB362eL8xTB+RdSS9UHz1tlgjm/mKRyM6E=";
|
||||
}
|
||||
{
|
||||
version = "9.3.0.75";
|
||||
minCudaVersion = "12.0";
|
||||
maxCudaVersion = "12.6";
|
||||
url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-aarch64/cudnn-linux-aarch64-9.3.0.75_cuda12-archive.tar.xz";
|
||||
hash = "sha256-Gq5L/O1j+TC0Z3+eko4ZeHjezi7dUcqPp6uDY9Dm7WA=";
|
||||
}
|
||||
];
|
||||
# powerpc
|
||||
linux-ppc64le = [ ];
|
||||
|
@ -72,6 +79,20 @@
|
|||
url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-sbsa/cudnn-linux-sbsa-8.9.7.29_cuda12-archive.tar.xz";
|
||||
hash = "sha256-6Yt8gAEHheXVygHuTOm1sMjHNYfqb4ZIvjTT+NHUe9E=";
|
||||
}
|
||||
{
|
||||
version = "9.3.0.75";
|
||||
minCudaVersion = "12.0";
|
||||
maxCudaVersion = "12.6";
|
||||
url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-sbsa/cudnn-linux-sbsa-9.3.0.75_cuda12-archive.tar.xz";
|
||||
hash = "sha256-Eibdm5iciYY4VSlj0ACjz7uKCgy5uvjLCear137X1jk=";
|
||||
}
|
||||
{
|
||||
version = "9.3.0.75";
|
||||
minCudaVersion = "11.8";
|
||||
maxCudaVersion = "11.8";
|
||||
url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-sbsa/cudnn-linux-sbsa-9.3.0.75_cuda11-archive.tar.xz";
|
||||
hash = "sha256-BLVvv3vuFcJOM5wrqU0Xqoi54zTQzRnnWFPcVFJ5S/c=";
|
||||
}
|
||||
];
|
||||
# x86_64
|
||||
linux-x86_64 = [
|
||||
|
|
|
@ -119,6 +119,12 @@ let
|
|||
|
||||
# No changes from 12.2 to 12.3
|
||||
"12.3" = attrs."12.2";
|
||||
|
||||
# No changes from 12.2 to 12.3
|
||||
"12.4" = attrs."12.3" // {
|
||||
clangMaxMajorVersion = "17";
|
||||
gccMaxMajorVersion = "13";
|
||||
};
|
||||
};
|
||||
in
|
||||
attrs
|
||||
|
|
38
pkgs/development/python-modules/curio-compat/default.nix
Normal file
38
pkgs/development/python-modules/curio-compat/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
pytestCheckHook,
|
||||
setuptools,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "curio-compat";
|
||||
version = "1.6.7";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "klen";
|
||||
repo = "curio";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-Crd9r4Icwga85wvtXaePbE56R192o+FXU9Zn+Lc7trI=";
|
||||
};
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
||||
pythonImportsCheck = [ "curio" ];
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
|
||||
disabledTests = [
|
||||
# contacts google.com
|
||||
"test_ssl_outgoing"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Coroutine-based library for concurrent systems programming";
|
||||
homepage = "https://github.com/klen/curio";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
41
pkgs/development/python-modules/idasen-ha/default.nix
Normal file
41
pkgs/development/python-modules/idasen-ha/default.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
idasen,
|
||||
lib,
|
||||
pytest-asyncio,
|
||||
pytestCheckHook,
|
||||
setuptools,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "idasen-ha";
|
||||
version = "2.6.2";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "abmantis";
|
||||
repo = "idasen-ha";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-lqqSx4jxQVq2pjVv9lvaX6nNK6OqtMjPqOtLMLpVMUU=";
|
||||
};
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
||||
dependencies = [ idasen ];
|
||||
|
||||
pythonImportsCheck = [ "idasen_ha" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytest-asyncio
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/abmantis/idasen-ha/releases/tag/${version}";
|
||||
description = "Home Assistant helper lib for the IKEA Idasen Desk integration";
|
||||
homepage = "https://github.com/abmantis/idasen-ha";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
buildPythonPackage rec {
|
||||
pname = "idasen";
|
||||
version = "0.12.0";
|
||||
format = "pyproject";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.8";
|
||||
|
||||
|
@ -25,9 +25,9 @@ buildPythonPackage rec {
|
|||
hash = "sha256-TQ+DBFpG+IeZ4/dN+YKMw3AM4Dl1rpqA1kRcb3Tb3jA=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ poetry-core ];
|
||||
build-system = [ poetry-core ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
bleak
|
||||
pyyaml
|
||||
voluptuous
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
buildPythonPackage rec {
|
||||
pname = "marimo";
|
||||
version = "0.7.20";
|
||||
version = "0.8.3";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.8";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-vkEBHJN7VqJU+diijiTV7JABT5g/5NY2XEXM0turDWU=";
|
||||
hash = "sha256-t7VYKInsZ0hYW+svD0vnsMyGcMtIeuWaor8nijyDhn8=";
|
||||
};
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
|
|
@ -1,34 +1,31 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
darwin,
|
||||
ocl-icd,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
buildPythonPackage,
|
||||
|
||||
# build-system
|
||||
cmake,
|
||||
nanobind,
|
||||
ninja,
|
||||
numpy,
|
||||
pathspec,
|
||||
scikit-build-core,
|
||||
|
||||
# buildInputs
|
||||
opencl-headers,
|
||||
pybind11,
|
||||
pathspec,
|
||||
ninja,
|
||||
nanobind,
|
||||
|
||||
# dependencies
|
||||
darwin,
|
||||
numpy,
|
||||
ocl-icd,
|
||||
opencl-headers,
|
||||
platformdirs,
|
||||
pybind11,
|
||||
pytools,
|
||||
|
||||
# checks
|
||||
# tests
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
let
|
||||
os-specific-buildInputs =
|
||||
if stdenv.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ];
|
||||
os-specific-buildInputs = if stdenv.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ];
|
||||
in
|
||||
buildPythonPackage rec {
|
||||
pname = "pyopencl";
|
||||
|
@ -39,7 +36,8 @@ buildPythonPackage rec {
|
|||
owner = "inducer";
|
||||
repo = "pyopencl";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-DfZCtTeN1a1KS2qUU6iztba4opAVC/RUCe/hnkqTbII=";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-VeaEDYnGfMYf9/WqMIZ9g4KounD48eWF3Romt79RMEQ=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
|
@ -66,23 +64,28 @@ buildPythonPackage rec {
|
|||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
|
||||
preBuild = ''
|
||||
preCheck = ''
|
||||
export HOME=$(mktemp -d)
|
||||
rm -rf pyopencl
|
||||
|
||||
# import from $out
|
||||
rm -r pyopencl
|
||||
'';
|
||||
|
||||
# gcc: error: pygpu_language_opencl.cpp: No such file or directory
|
||||
# pyopencl._cl.LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR
|
||||
doCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "pyopencl" ];
|
||||
pythonImportsCheck = [
|
||||
"pyopencl"
|
||||
"pyopencl.array"
|
||||
"pyopencl.cltypes"
|
||||
"pyopencl.elementwise"
|
||||
"pyopencl.tools"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Python wrapper for OpenCL";
|
||||
homepage = "https://github.com/pyopencl/pyopencl";
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/inducer/pyopencl/releases/tag/v${version}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ GaetanLepage ];
|
||||
# ld: symbol(s) not found for architecture arm64
|
||||
broken = stdenv.isDarwin && stdenv.isAarch64;
|
||||
description = "Python wrapper for OpenCL";
|
||||
homepage = "https://github.com/inducer/pyopencl";
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
lib,
|
||||
anyio,
|
||||
buildPythonPackage,
|
||||
curio,
|
||||
curio-compat,
|
||||
fetchFromGitHub,
|
||||
hypothesis,
|
||||
pytest,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
poetry-core,
|
||||
sniffio,
|
||||
trio,
|
||||
trio-asyncio,
|
||||
uvloop,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
|
@ -19,7 +19,7 @@ buildPythonPackage rec {
|
|||
version = "1.9.0";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
disabled = pythonOlder "3.9";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "klen";
|
||||
|
@ -32,16 +32,18 @@ buildPythonPackage rec {
|
|||
|
||||
buildInputs = [ pytest ];
|
||||
|
||||
dependencies = [
|
||||
anyio
|
||||
curio
|
||||
hypothesis
|
||||
sniffio
|
||||
trio
|
||||
trio-asyncio
|
||||
];
|
||||
optional-dependencies = {
|
||||
curio = [ curio-compat ];
|
||||
trio = [ trio ];
|
||||
uvloop = [ uvloop ];
|
||||
};
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
nativeCheckInputs = [
|
||||
anyio
|
||||
hypothesis
|
||||
pytestCheckHook
|
||||
trio-asyncio
|
||||
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
||||
|
||||
pythonImportsCheck = [ "pytest_aio" ];
|
||||
|
||||
|
|
|
@ -5,11 +5,16 @@
|
|||
fetchFromGitHub,
|
||||
hatchling,
|
||||
aiohttp,
|
||||
mashumaro,
|
||||
aioresponses,
|
||||
pytest-aio,
|
||||
pytestCheckHook,
|
||||
syrupy,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "solarlog-cli";
|
||||
version = "0.1.6";
|
||||
version = "0.2.0";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.12";
|
||||
|
@ -18,17 +23,24 @@ buildPythonPackage rec {
|
|||
owner = "dontinelli";
|
||||
repo = "solarlog_cli";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-Bliq1n6xH0cZQHueiGDyalIo0zms8zCSpUGq2KH5xZY=";
|
||||
hash = "sha256-x9MovIKFImu60Ns2sJTy71S22cR9Az/yNMWzGM50y7Y=";
|
||||
};
|
||||
|
||||
build-system = [ hatchling ];
|
||||
|
||||
dependencies = [ aiohttp ];
|
||||
dependencies = [
|
||||
aiohttp
|
||||
mashumaro
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "solarlog_cli" ];
|
||||
|
||||
# upstream has no tests
|
||||
doCheck = false;
|
||||
nativeCheckInputs = [
|
||||
aioresponses
|
||||
pytest-aio
|
||||
pytestCheckHook
|
||||
syrupy
|
||||
];
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/dontinelli/solarlog_cli/releases/tag/v${version}";
|
||||
|
|
|
@ -5,30 +5,27 @@
|
|||
python,
|
||||
poetry-core,
|
||||
pytest,
|
||||
colored,
|
||||
invoke,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "syrupy";
|
||||
version = "4.6.1";
|
||||
format = "pyproject";
|
||||
version = "4.7.1";
|
||||
pyproject = true;
|
||||
|
||||
disabled = lib.versionOlder python.version "3.8.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tophat";
|
||||
owner = "syrupy-project";
|
||||
repo = "syrupy";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-NBJJqQsZqqKHOdqGa/j/2KQvlenLCEJBqlfdjtFK00U=";
|
||||
hash = "sha256-dTUugNqzaMuKV6ZwxRSf9df7tsnmZUBhgqwgGxBhirw=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ poetry-core ];
|
||||
build-system = [ poetry-core ];
|
||||
|
||||
buildInputs = [ pytest ];
|
||||
|
||||
propagatedBuildInputs = [ colored ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
invoke
|
||||
pytest
|
||||
|
@ -43,11 +40,11 @@ buildPythonPackage rec {
|
|||
|
||||
pythonImportsCheck = [ "syrupy" ];
|
||||
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/tophat/syrupy/releases/tag/v${version}";
|
||||
meta = {
|
||||
changelog = "https://github.com/syrupy-project/syrupy/blob/${src.rev}/CHANGELOG.md";
|
||||
description = "Pytest Snapshot Test Utility";
|
||||
homepage = "https://github.com/tophat/syrupy";
|
||||
license = licenses.asl20;
|
||||
maintainers = [ ];
|
||||
homepage = "https://github.com/syrupy-project/syrupy";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
||||
|
|
38
pkgs/development/tools/bpf-linker/Cargo.lock
generated
38
pkgs/development/tools/bpf-linker/Cargo.lock
generated
|
@ -27,9 +27,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.6"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
|
||||
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
|
@ -73,9 +73,9 @@ checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69"
|
|||
|
||||
[[package]]
|
||||
name = "aya-rustc-llvm-proxy"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09de71afbd6668d1e10f1895f967d5a2c02b2e6db01ea4ac9677c29e22dac548"
|
||||
checksum = "3c81d599ae18f5a5fdf5e3e13e376c142a6e2c3d4d5ee960e50e61b034ada46b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_metadata",
|
||||
|
@ -103,7 +103,7 @@ checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
|||
|
||||
[[package]]
|
||||
name = "bpf-linker"
|
||||
version = "0.9.12"
|
||||
version = "0.9.13"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ar",
|
||||
|
@ -170,9 +170,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.11"
|
||||
version = "4.5.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3"
|
||||
checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
|
@ -180,9 +180,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.11"
|
||||
version = "4.5.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa"
|
||||
checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -192,9 +192,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.11"
|
||||
version = "4.5.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e"
|
||||
checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
@ -447,9 +447,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
|||
|
||||
[[package]]
|
||||
name = "llvm-sys"
|
||||
version = "180.0.0"
|
||||
version = "191.0.0-rc1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "778fa5fa02e32728e718f11eec147e6f134137399ab02fd2c13d32476337affa"
|
||||
checksum = "fc981f56df5430a462d0f7676913fe9e8e4c8cc4df02e3157a6e3d808f7ae443"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cc",
|
||||
|
@ -598,9 +598,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.5"
|
||||
version = "1.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -648,9 +648,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
|||
|
||||
[[package]]
|
||||
name = "rustc-build-sysroot"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa3ca63cc537c1cb69e4c2c0afc5fda2ccd36ac84c97d5a4ae05e69b1c834afb"
|
||||
checksum = "2471f8f296262437d7e848e527b4210b44a96e53a3b4435b890227ce3e6da106"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"rustc_version",
|
||||
|
@ -1015,9 +1015,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "6.0.1"
|
||||
version = "6.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8211e4f58a2b2805adfbefbc07bab82958fc91e3836339b1ab7ae32465dce0d7"
|
||||
checksum = "3d9c5ed668ee1f17edb3b627225343d210006a90bb1e3745ce1f30b1fb115075"
|
||||
dependencies = [
|
||||
"either",
|
||||
"home",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
, stdenv
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, llvmPackages_18
|
||||
, llvmPackages_19
|
||||
, zlib
|
||||
, ncurses
|
||||
, libxml2
|
||||
|
@ -10,13 +10,13 @@
|
|||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "bpf-linker";
|
||||
version = "0.9.12-unstable-2024-07-31";
|
||||
version = "0.9.13";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aya-rs";
|
||||
repo = pname;
|
||||
rev = "7585ff7c0709bae13f2ad25f421450d493b02c1a";
|
||||
hash = "sha256-HvjS+74ZjyhF3h2IaKq4T+aGB5/XJRR3TxLSxp0rEYk=";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-CRYp1ktmmY4OS23+LNKOBQJUMkd+GXptBp5LPfbyZAc=";
|
||||
};
|
||||
|
||||
cargoLock = {
|
||||
|
@ -28,7 +28,7 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
buildNoDefaultFeatures = true;
|
||||
|
||||
nativeBuildInputs = [ llvmPackages_18.llvm ];
|
||||
nativeBuildInputs = [ llvmPackages_19.llvm ];
|
||||
buildInputs = [ zlib ncurses libxml2 ];
|
||||
|
||||
# fails with: couldn't find crate `core` with expected target triple bpfel-unknown-none
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "typos";
|
||||
version = "1.23.7";
|
||||
version = "1.24.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "crate-ci";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
hash = "sha256-VxmSYqpKtzPaiKuB3lhjYGi2T1W4VFt2414OUDGUaZI=";
|
||||
hash = "sha256-oQy3R9PSM8jU4qs3clxK0HmmM0Ua4pwZYxnu0d6SW+I=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-SdHlejMxoh8B/HkOdOAtEIRGKfWYDIKXw7SL80sxvJw=";
|
||||
cargoHash = "sha256-z2JN5JyUIEeZInw5qpRf/Zja+7Np9YnBj3hcohFkAsc=";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Source code spell checker";
|
||||
|
|
|
@ -1,70 +1,91 @@
|
|||
{ lib, stdenv, fetchurl, kernel }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
fetchFromGitHub,
|
||||
kernel,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "6.30.223.271";
|
||||
hashes = {
|
||||
i686-linux = "1kaqa2dw3nb8k23ffvx46g8jj3wdhz8xa6jp1v3wb35cjfr712sg";
|
||||
x86_64-linux = "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz";
|
||||
i686-linux = "sha256-T4twspOsjMXHDlca1dGHjQ8p0TOkb+eGmGjZwZtQWM0=";
|
||||
x86_64-linux = "sha256-X3l3TVvuyPdja1nA+wegMQju8eP9MkVjiyCFjHFBRL4=";
|
||||
};
|
||||
|
||||
arch = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "_64";
|
||||
tarballVersion = lib.replaceStrings ["."] ["_"] version;
|
||||
tarballVersion = lib.replaceStrings [ "." ] [ "_" ] version;
|
||||
tarball = "hybrid-v35${arch}-nodebug-pcoem-${tarballVersion}.tar.gz";
|
||||
|
||||
rpmFusionPatches = fetchFromGitHub {
|
||||
owner = "rpmfusion";
|
||||
repo = "wl-kmod";
|
||||
rev = "a04330284bfc38fd91eade6f8b28fa63cfcdc95e";
|
||||
hash = "sha256-c72Pr/v+nxZPLEeNKbWnSpbH3gqYZaTgzMO9PlYQkf0=";
|
||||
};
|
||||
patchset = [
|
||||
"wl-kmod-001_wext_workaround.patch"
|
||||
"wl-kmod-002_kernel_3.18_null_pointer.patch"
|
||||
"wl-kmod-003_gcc_4.9_remove_TIME_DATE_macros.patch"
|
||||
"wl-kmod-004_kernel_4.3_rdtscl_to_rdtsc.patch"
|
||||
"wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch"
|
||||
"wl-kmod-006_gcc_6_fix_indentation_warnings.patch"
|
||||
"wl-kmod-007_kernel_4.8_add_cfg80211_scan_info_struct.patch"
|
||||
"wl-kmod-008_fix_kernel_warnings.patch"
|
||||
"wl-kmod-009_kernel_4.11_remove_last_rx_in_net_device_struct.patch"
|
||||
"wl-kmod-010_kernel_4.12_add_cfg80211_roam_info_struct.patch"
|
||||
"wl-kmod-011_kernel_4.14_new_kernel_read_function_prototype.patch"
|
||||
"wl-kmod-012_kernel_4.15_new_timer.patch"
|
||||
"wl-kmod-013_gcc8_fix_bounds_check_warnings.patch"
|
||||
"wl-kmod-014_kernel_read_pos_increment_fix.patch"
|
||||
"wl-kmod-015_kernel_5.1_get_ds_removed.patch"
|
||||
"wl-kmod-016_fix_unsupported_mesh_point.patch"
|
||||
"wl-kmod-017_fix_gcc_fallthrough_warning.patch"
|
||||
"wl-kmod-018_kernel_5.6_adaptations.patch"
|
||||
"wl-kmod-019_kernel_5.9_segment_eq_removed.patch"
|
||||
"wl-kmod-020_kernel_5.10_get_set_fs_removed.patch"
|
||||
"wl-kmod-021_kernel_5.17_adaptation.patch"
|
||||
"wl-kmod-022_kernel_5.18_adaptation.patch"
|
||||
"wl-kmod-023_kernel_6.0_adaptation.patch"
|
||||
"wl-kmod-024_kernel_6.1_adaptation.patch"
|
||||
"wl-kmod-025_kernel_6.5_adaptation.patch"
|
||||
"wl-kmod-026_kernel_6.10_fix_empty_body_in_if_warning.patch"
|
||||
"wl-kmod-027_wpa_supplicant-2.11_add_max_scan_ie_len.patch"
|
||||
];
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "broadcom-sta-${version}-${kernel.version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/${tarball}";
|
||||
sha256 = hashes.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
hash =
|
||||
hashes.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
};
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
|
||||
patches = [
|
||||
./license.patch
|
||||
./linux-4.7.patch
|
||||
# source: https://git.archlinux.org/svntogit/community.git/tree/trunk/004-linux48.patch?h=packages/broadcom-wl-dkms
|
||||
./linux-4.8.patch
|
||||
# source: https://aur.archlinux.org/cgit/aur.git/tree/linux411.patch?h=broadcom-wl
|
||||
./linux-4.11.patch
|
||||
# source: https://aur.archlinux.org/cgit/aur.git/tree/linux412.patch?h=broadcom-wl
|
||||
./linux-4.12.patch
|
||||
./linux-4.15.patch
|
||||
./linux-5.1.patch
|
||||
# source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f
|
||||
./linux-5.6.patch
|
||||
# source: https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290
|
||||
./linux-5.9.patch
|
||||
# source: https://github.com/archlinux/svntogit-community/blob/33b4bd2b9e30679b03f5d7aa2741911d914dcf94/trunk/012-linux517.patch
|
||||
./linux-5.17.patch
|
||||
# source: https://github.com/archlinux/svntogit-community/blob/2e1fd240f9ce06f500feeaa3e4a9675e65e6b967/trunk/013-linux518.patch
|
||||
./linux-5.18.patch
|
||||
# source: https://gist.github.com/joanbm/207210d74637870c01ef5a3c262a597d
|
||||
./linux-6.0.patch
|
||||
# source: https://gist.github.com/joanbm/94323ea99eff1e1d1c51241b5b651549
|
||||
./linux-6.1.patch
|
||||
./pedantic-fix.patch
|
||||
./null-pointer-fix.patch
|
||||
./gcc.patch
|
||||
];
|
||||
patches = map (patch: "${rpmFusionPatches}/${patch}") patchset;
|
||||
|
||||
makeFlags = [ "KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}" ];
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
sourceRoot=broadcom-sta
|
||||
mkdir "$sourceRoot"
|
||||
tar xvf "$src" -C "$sourceRoot"
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
|
||||
docDir="$out/share/doc/broadcom-sta/"
|
||||
mkdir -p "$binDir" "$docDir"
|
||||
cp wl.ko "$binDir"
|
||||
cp lib/LICENSE.txt "$docDir"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
From 3e28c2a24c3b3b011506bcaa4fee7e8da347c5ff Mon Sep 17 00:00:00 2001
|
||||
From: Charles Strahan <charles.c.strahan@gmail.com>
|
||||
Date: Tue, 5 May 2015 15:09:51 -0400
|
||||
Subject: [PATCH 01/16] linuxPackages.broadcom_sta: since GCC respects
|
||||
SOURCE_DATE_EPOCH, set in the stdenv, set -Wno-date-time
|
||||
|
||||
---
|
||||
Makefile | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index a323a0d..15e85c8 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -140,10 +140,7 @@ wl-objs += src/wl/sys/wl_cfg80211_hybrid.o
|
||||
EXTRA_CFLAGS += -I$(src)/src/include -I$(src)/src/common/include
|
||||
EXTRA_CFLAGS += -I$(src)/src/wl/sys -I$(src)/src/wl/phy -I$(src)/src/wl/ppr/include
|
||||
EXTRA_CFLAGS += -I$(src)/src/shared/bcmwifi/include
|
||||
-#EXTRA_CFLAGS += -DBCMDBG_ASSERT -DBCMDBG_ERR
|
||||
-ifeq "$(GE_49)" "1"
|
||||
EXTRA_CFLAGS += -Wno-date-time
|
||||
-endif
|
||||
|
||||
EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
From 5a964e14474e4482a4d24c015371856560dacabc Mon Sep 17 00:00:00 2001
|
||||
From: Shea Levy <shea@shealevy.com>
|
||||
Date: Sat, 4 Jan 2014 20:57:21 -0500
|
||||
Subject: [PATCH 02/16] linuxPackages.broadcom_sta: apply MIXED/Proprietary
|
||||
license
|
||||
|
||||
---
|
||||
src/wl/sys/wl_linux.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 0d05100..14922c0 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -148,6 +148,8 @@ static struct wl_if *wl_alloc_if(wl_info_t *wl, int iftype, uint unit, struct wl
|
||||
static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
|
||||
static void wl_get_driver_info(struct net_device *dev, struct ethtool_drvinfo *info);
|
||||
|
||||
+MODULE_LICENSE("MIXED/Proprietary");
|
||||
+
|
||||
#if defined(WL_CONFIG_RFKILL)
|
||||
#include <linux/rfkill.h>
|
||||
static int wl_init_rfkill(wl_info_t *wl);
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
From 5a0301c2d9c65dbb3c5b8990e635d37f071d26c4 Mon Sep 17 00:00:00 2001
|
||||
From: georgewhewell <georgerw@gmail.com>
|
||||
Date: Fri, 2 Jun 2017 14:19:04 +0100
|
||||
Subject: [PATCH 06/16] linuxPackages.broadcom_sta: fix build for kernel 4.11+
|
||||
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 3 +++
|
||||
src/wl/sys/wl_linux.c | 12 ++++++++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 84f0068..9fd8ed1 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -30,6 +30,9 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/ieee80211.h>
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
+#include <linux/sched/signal.h>
|
||||
+#endif
|
||||
#include <net/cfg80211.h>
|
||||
#include <linux/nl80211.h>
|
||||
#include <net/rtnetlink.h>
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 65d7a22..18841d9 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -117,6 +117,9 @@ int wl_found = 0;
|
||||
|
||||
typedef struct priv_link {
|
||||
wl_if_t *wlif;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
+ unsigned long last_rx;
|
||||
+#endif
|
||||
} priv_link_t;
|
||||
|
||||
#define WL_DEV_IF(dev) ((wl_if_t*)((priv_link_t*)DEV_PRIV(dev))->wlif)
|
||||
@@ -2451,6 +2454,9 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
|
||||
{
|
||||
struct sk_buff *oskb = (struct sk_buff *)p;
|
||||
struct sk_buff *skb;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
+ priv_link_t *priv_link;
|
||||
+#endif
|
||||
uchar *pdata;
|
||||
uint len;
|
||||
|
||||
@@ -2917,7 +2923,13 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
|
||||
if (skb == NULL) return;
|
||||
|
||||
skb->dev = wl->monitor_dev;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
+ priv_link = MALLOC(wl->osh, sizeof(priv_link_t));
|
||||
+ priv_link = netdev_priv(skb->dev);
|
||||
+ priv_link->last_rx = jiffies;
|
||||
+#else
|
||||
skb->dev->last_rx = jiffies;
|
||||
+#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
|
||||
skb_reset_mac_header(skb);
|
||||
#else
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
From 2e9c7bd146fbc3b4a62940140eafb47df16b6cb4 Mon Sep 17 00:00:00 2001
|
||||
From: aszlig <aszlig@redmoonstudios.org>
|
||||
Date: Tue, 18 Jul 2017 21:32:13 +0200
|
||||
Subject: [PATCH 07/16] linuxPackages.broadcom_sta: fix build for kernel 4.12+
|
||||
|
||||
The patch is from Arch Linux at:
|
||||
|
||||
https://aur.archlinux.org/cgit/aur.git/tree/linux412.patch?h=broadcom-wl
|
||||
|
||||
Tested this by building against the following attributes:
|
||||
|
||||
* linuxPackages.broadcom_sta
|
||||
* linuxPackages_latest.broadcom_sta
|
||||
* pkgsI686Linux.linuxPackages.broadcom_sta
|
||||
* pkgsI686Linux.linuxPackages_latest.broadcom_sta
|
||||
|
||||
I have not tested whether this works at runtime, because I do not possess the hardware.
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 29 ++++++++++++++++++++++++++++-
|
||||
1 file changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 9fd8ed1..1893a53 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR;
|
||||
#endif
|
||||
|
||||
static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
+ enum nl80211_iftype type, struct vif_params *params);
|
||||
+#else
|
||||
enum nl80211_iftype type, u32 *flags, struct vif_params *params);
|
||||
+#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
|
||||
static s32
|
||||
wl_cfg80211_scan(struct wiphy *wiphy,
|
||||
@@ -466,7 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
|
||||
|
||||
static s32
|
||||
wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
+ enum nl80211_iftype type,
|
||||
+#else
|
||||
enum nl80211_iftype type, u32 *flags,
|
||||
+#endif
|
||||
struct vif_params *params)
|
||||
{
|
||||
struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
|
||||
@@ -2361,6 +2369,20 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
const wl_event_msg_t *e, void *data)
|
||||
{
|
||||
struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
+ struct cfg80211_bss *bss;
|
||||
+ struct wlc_ssid *ssid;
|
||||
+ ssid = &wl->profile->ssid;
|
||||
+ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
|
||||
+ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
||||
+ struct cfg80211_roam_info roam_info = {
|
||||
+ .bss = bss,
|
||||
+ .req_ie = conn_info->req_ie,
|
||||
+ .req_ie_len = conn_info->req_ie_len,
|
||||
+ .resp_ie = conn_info->resp_ie,
|
||||
+ .resp_ie_len = conn_info->resp_ie_len,
|
||||
+ };
|
||||
+#endif
|
||||
s32 err = 0;
|
||||
|
||||
wl_get_assoc_ies(wl);
|
||||
@@ -2368,12 +2390,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
|
||||
wl_update_bss_info(wl);
|
||||
cfg80211_roamed(ndev,
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
+ &roam_info,
|
||||
+#else
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
|
||||
&wl->conf->channel,
|
||||
#endif
|
||||
(u8 *)&wl->bssid,
|
||||
conn_info->req_ie, conn_info->req_ie_len,
|
||||
- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
|
||||
+ conn_info->resp_ie, conn_info->resp_ie_len,
|
||||
+#endif
|
||||
+ GFP_KERNEL);
|
||||
WL_DBG(("Report roaming result\n"));
|
||||
|
||||
set_bit(WL_STATUS_CONNECTED, &wl->status);
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
From ae88c3c0c91d26ca5e4dc1e498a370747d2c3b03 Mon Sep 17 00:00:00 2001
|
||||
From: Yegor Timoshenko <yegortimoshenko@riseup.net>
|
||||
Date: Wed, 31 Jan 2018 22:59:09 +0000
|
||||
Subject: [PATCH 08/16] linuxPackages.broadcom_sta: fix build for kernel 4.15+
|
||||
|
||||
See: https://lkml.org/lkml/2017/11/25/90
|
||||
---
|
||||
src/wl/sys/wl_linux.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 18841d9..83b8859 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -93,7 +93,11 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
|
||||
|
||||
#include <wlc_wowl.h>
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||
+static void wl_timer(struct timer_list *tl);
|
||||
+#else
|
||||
static void wl_timer(ulong data);
|
||||
+#endif
|
||||
static void _wl_timer(wl_timer_t *t);
|
||||
static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
|
||||
|
||||
@@ -2303,9 +2307,15 @@ wl_timer_task(wl_task_t *task)
|
||||
}
|
||||
|
||||
static void
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||
+wl_timer(struct timer_list *tl)
|
||||
+{
|
||||
+ wl_timer_t *t = from_timer(t, tl, timer);
|
||||
+#else
|
||||
wl_timer(ulong data)
|
||||
{
|
||||
wl_timer_t *t = (wl_timer_t *)data;
|
||||
+#endif
|
||||
|
||||
if (!WL_ALL_PASSIVE_ENAB(t->wl))
|
||||
_wl_timer(t);
|
||||
@@ -2357,9 +2367,13 @@ wl_init_timer(wl_info_t *wl, void (*fn)(void *arg), void *arg, const char *tname
|
||||
|
||||
bzero(t, sizeof(wl_timer_t));
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||
+ timer_setup(&t->timer, wl_timer, 0);
|
||||
+#else
|
||||
init_timer(&t->timer);
|
||||
t->timer.data = (ulong) t;
|
||||
t->timer.function = wl_timer;
|
||||
+#endif
|
||||
t->wl = wl;
|
||||
t->fn = fn;
|
||||
t->arg = arg;
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
From bc408ef546b08443dabbe8fcdfec5e1e48494ed8 Mon Sep 17 00:00:00 2001
|
||||
From: aszlig <aszlig@redmoonstudios.org>
|
||||
Date: Mon, 1 Aug 2016 20:45:47 +0200
|
||||
Subject: [PATCH 04/16] linuxPackages.broadcom_sta: fix build for kernel 4.7+
|
||||
|
||||
Patch is from Arch Linux at:
|
||||
|
||||
https://aur.archlinux.org/cgit/aur.git/tree/?h=broadcom-wl
|
||||
|
||||
I've tested building against 3.18.36, 4.4.16 and 4.7.0.
|
||||
|
||||
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
||||
Cc: @phreedom, @vcunat
|
||||
|
||||
Since Linux 4.7, the enum ieee80211_band is no longer used
|
||||
|
||||
This shall cause no problem's since both enums ieee80211_band
|
||||
and nl80211_band were added in the same commit:
|
||||
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c
|
||||
|
||||
This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*
|
||||
|
||||
Reference:
|
||||
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 24 ++++++++++++------------
|
||||
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 7b606e0..3b438ba 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -236,7 +236,7 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = {
|
||||
#endif
|
||||
|
||||
#define CHAN2G(_channel, _freq, _flags) { \
|
||||
- .band = IEEE80211_BAND_2GHZ, \
|
||||
+ .band = NL80211_BAND_2GHZ, \
|
||||
.center_freq = (_freq), \
|
||||
.hw_value = (_channel), \
|
||||
.flags = (_flags), \
|
||||
@@ -245,7 +245,7 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = {
|
||||
}
|
||||
|
||||
#define CHAN5G(_channel, _flags) { \
|
||||
- .band = IEEE80211_BAND_5GHZ, \
|
||||
+ .band = NL80211_BAND_5GHZ, \
|
||||
.center_freq = 5000 + (5 * (_channel)), \
|
||||
.hw_value = (_channel), \
|
||||
.flags = (_flags), \
|
||||
@@ -379,7 +379,7 @@ static struct ieee80211_channel __wl_5ghz_n_channels[] = {
|
||||
};
|
||||
|
||||
static struct ieee80211_supported_band __wl_band_2ghz = {
|
||||
- .band = IEEE80211_BAND_2GHZ,
|
||||
+ .band = NL80211_BAND_2GHZ,
|
||||
.channels = __wl_2ghz_channels,
|
||||
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
|
||||
.bitrates = wl_g_rates,
|
||||
@@ -387,7 +387,7 @@ static struct ieee80211_supported_band __wl_band_2ghz = {
|
||||
};
|
||||
|
||||
static struct ieee80211_supported_band __wl_band_5ghz_a = {
|
||||
- .band = IEEE80211_BAND_5GHZ,
|
||||
+ .band = NL80211_BAND_5GHZ,
|
||||
.channels = __wl_5ghz_a_channels,
|
||||
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
|
||||
.bitrates = wl_a_rates,
|
||||
@@ -395,7 +395,7 @@ static struct ieee80211_supported_band __wl_band_5ghz_a = {
|
||||
};
|
||||
|
||||
static struct ieee80211_supported_band __wl_band_5ghz_n = {
|
||||
- .band = IEEE80211_BAND_5GHZ,
|
||||
+ .band = NL80211_BAND_5GHZ,
|
||||
.channels = __wl_5ghz_n_channels,
|
||||
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
|
||||
.bitrates = wl_a_rates,
|
||||
@@ -1876,8 +1876,8 @@ static s32 wl_alloc_wdev(struct device *dev, struct wireless_dev **rwdev)
|
||||
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
|
||||
#endif
|
||||
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
|
||||
- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
|
||||
- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
|
||||
+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
|
||||
+ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
|
||||
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
|
||||
wdev->wiphy->cipher_suites = __wl_cipher_suites;
|
||||
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
|
||||
@@ -2000,7 +2000,7 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
|
||||
freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
|
||||
(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
|
||||
- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
|
||||
+ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
|
||||
#else
|
||||
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
|
||||
#endif
|
||||
@@ -2116,7 +2116,7 @@ wl_notify_connect_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
return err;
|
||||
}
|
||||
chan = wf_chspec_ctlchan(chanspec);
|
||||
- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
|
||||
+ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
|
||||
freq = ieee80211_channel_to_frequency(chan, band);
|
||||
channel = ieee80211_get_channel(wiphy, freq);
|
||||
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
|
||||
@@ -2250,10 +2250,10 @@ static void wl_ch_to_chanspec(struct ieee80211_channel *chan, struct wl_join_par
|
||||
join_params->params.chanspec_list[0] =
|
||||
ieee80211_frequency_to_channel(chan->center_freq);
|
||||
|
||||
- if (chan->band == IEEE80211_BAND_2GHZ) {
|
||||
+ if (chan->band == NL80211_BAND_2GHZ) {
|
||||
chanspec |= WL_CHANSPEC_BAND_2G;
|
||||
}
|
||||
- else if (chan->band == IEEE80211_BAND_5GHZ) {
|
||||
+ else if (chan->band == NL80211_BAND_5GHZ) {
|
||||
chanspec |= WL_CHANSPEC_BAND_5G;
|
||||
}
|
||||
else {
|
||||
@@ -2885,7 +2885,7 @@ static s32 wl_update_wiphybands(struct wl_cfg80211_priv *wl)
|
||||
|
||||
if (phy == 'n' || phy == 'a' || phy == 'v') {
|
||||
wiphy = wl_to_wiphy(wl);
|
||||
- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
|
||||
+ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
|
||||
}
|
||||
|
||||
return err;
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
From 8c536235639010135f8dc11a8ec0968f9b200a6e Mon Sep 17 00:00:00 2001
|
||||
From: Alberto Milone <alberto.milone@canonical.com>
|
||||
Date: Fri, 2 Sep 2016 17:35:34 +0200
|
||||
Subject: [PATCH 05/16] linuxPackages.broadcom_sta: fix build for kernel 4.8+
|
||||
|
||||
Original author: Krzysztof Kolasa
|
||||
|
||||
Source: https://git.archlinux.org/svntogit/community.git/tree/trunk/004-linux48.patch?h=packages/broadcom-wl-dkms
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 3b438ba..84f0068 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -2386,8 +2386,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
s32 err = 0;
|
||||
|
||||
if (wl->scan_request) {
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||
+ struct cfg80211_scan_info info = {
|
||||
+ .aborted = true,
|
||||
+ };
|
||||
+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
|
||||
+ cfg80211_scan_done(wl->scan_request, &info);
|
||||
+#else
|
||||
WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
|
||||
cfg80211_scan_done(wl->scan_request, true);
|
||||
+#endif
|
||||
wl->scan_request = NULL;
|
||||
}
|
||||
|
||||
@@ -2488,7 +2496,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
|
||||
scan_done_out:
|
||||
if (wl->scan_request) {
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||
+ struct cfg80211_scan_info info = {
|
||||
+ .aborted = false,
|
||||
+ };
|
||||
+ cfg80211_scan_done(wl->scan_request, &info);
|
||||
+#else
|
||||
cfg80211_scan_done(wl->scan_request, false);
|
||||
+#endif
|
||||
wl->scan_request = NULL;
|
||||
}
|
||||
rtnl_unlock();
|
||||
@@ -2913,7 +2928,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
|
||||
s32 err = 0;
|
||||
|
||||
if (wl->scan_request) {
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||
+ struct cfg80211_scan_info info = {
|
||||
+ .aborted = true,
|
||||
+ };
|
||||
+ cfg80211_scan_done(wl->scan_request, &info);
|
||||
+#else
|
||||
cfg80211_scan_done(wl->scan_request, true);
|
||||
+#endif
|
||||
wl->scan_request = NULL;
|
||||
}
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
From 35c712b7ad2b20088a1a4e233f1d22d7f6dc2525 Mon Sep 17 00:00:00 2001
|
||||
From: georgewhewell <georgerw@gmail.com>
|
||||
Date: Sat, 18 May 2019 21:36:26 +0100
|
||||
Subject: [PATCH 09/16] linuxPackages.broadcom_sta: fix build for kernel 5.1+
|
||||
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 2 +-
|
||||
src/wl/sys/wl_iw.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 1893a53..4b3298f 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -457,7 +457,7 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
|
||||
ifr.ifr_data = (caddr_t)&ioc;
|
||||
|
||||
fs = get_fs();
|
||||
- set_fs(get_ds());
|
||||
+ set_fs(KERNEL_DS);
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
#else
|
||||
diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
|
||||
index c4c610b..9c3c74e 100644
|
||||
--- a/src/wl/sys/wl_iw.c
|
||||
+++ b/src/wl/sys/wl_iw.c
|
||||
@@ -117,7 +117,7 @@ dev_wlc_ioctl(
|
||||
ifr.ifr_data = (caddr_t) &ioc;
|
||||
|
||||
fs = get_fs();
|
||||
- set_fs(get_ds());
|
||||
+ set_fs(KERNEL_DS);
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
#else
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
From a5e450dcdc7bc4ce06379189c3577f8c7a36fbde Mon Sep 17 00:00:00 2001
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Wed, 12 Jan 2022 20:49:20 +0100
|
||||
Subject: [PATCH 12/16] linuxPackages.broadcom_sta: fix build for kernel 5.17+
|
||||
|
||||
Tentative fix for broadcom-wl 6.30.223.271 driver for Linux 5.17-rc1
|
||||
|
||||
Set netdev->dev_addr through dev_addr_mod + PDE_DATA fix
|
||||
|
||||
Since Linux 5.17 netdev->dev_addr is const and must be changed through
|
||||
dev_addr_mod, otherwise a warning is logged in dmesg and bad things may happen.
|
||||
|
||||
NB: The #if is not wrong, dev_addr_mod is defined since Linux 5.15-rc1
|
||||
|
||||
Plus a trivial fix for PDE_DATA.
|
||||
|
||||
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-28 on Arch Linux.
|
||||
|
||||
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=adeef3e32146a8d2a73c399dc6f5d76a449131b1
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa
|
||||
---
|
||||
src/wl/sys/wl_linux.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 26ba9fa..25c4706 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -93,6 +93,10 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
|
||||
|
||||
#include <wlc_wowl.h>
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
|
||||
+#define PDE_DATA pde_data
|
||||
+#endif
|
||||
+
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||
static void wl_timer(struct timer_list *tl);
|
||||
#else
|
||||
@@ -646,7 +650,7 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
|
||||
WL_ERROR(("wl%d: Error setting MAC ADDRESS\n", unit));
|
||||
}
|
||||
#endif
|
||||
- bcopy(&wl->pub->cur_etheraddr, dev->dev_addr, ETHER_ADDR_LEN);
|
||||
+ eth_hw_addr_set(dev, wl->pub->cur_etheraddr.octet);
|
||||
|
||||
online_cpus = 1;
|
||||
|
||||
@@ -1852,7 +1856,7 @@ wl_set_mac_address(struct net_device *dev, void *addr)
|
||||
|
||||
WL_LOCK(wl);
|
||||
|
||||
- bcopy(sa->sa_data, dev->dev_addr, ETHER_ADDR_LEN);
|
||||
+ eth_hw_addr_set(dev, sa->sa_data);
|
||||
err = wlc_iovar_op(wl->wlc, "cur_etheraddr", NULL, 0, sa->sa_data, ETHER_ADDR_LEN,
|
||||
IOV_SET, (WL_DEV_IF(dev))->wlcif);
|
||||
WL_UNLOCK(wl);
|
||||
@@ -3033,7 +3037,7 @@ _wl_add_monitor_if(wl_task_t *task)
|
||||
else
|
||||
dev->type = ARPHRD_IEEE80211_RADIOTAP;
|
||||
|
||||
- bcopy(wl->dev->dev_addr, dev->dev_addr, ETHER_ADDR_LEN);
|
||||
+ eth_hw_addr_set(dev, wl->dev->dev_addr);
|
||||
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
dev->netdev_ops = &wl_netdev_monitor_ops;
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
From 6c66b0eaaa3e6ebaa84891298715b71f7b2f0b1c Mon Sep 17 00:00:00 2001
|
||||
From: X9VoiD <oscar.silvestrexx@gmail.com>
|
||||
Date: Mon, 13 Jun 2022 17:38:18 +0800
|
||||
Subject: [PATCH 13/16] linuxPackages.broadcom_sta: fix build for kernel 5.18+
|
||||
|
||||
---
|
||||
src/shared/linux_osl.c | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
|
||||
index dcfc075..5a25b82 100644
|
||||
--- a/src/shared/linux_osl.c
|
||||
+++ b/src/shared/linux_osl.c
|
||||
@@ -599,6 +599,8 @@ osl_dma_alloc_consistent(osl_t *osh, uint size, uint16 align_bits, uint *alloced
|
||||
va = kmalloc(size, GFP_ATOMIC | __GFP_ZERO);
|
||||
if (va)
|
||||
*pap = (ulong)__virt_to_phys(va);
|
||||
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ va = dma_alloc_coherent(&((struct pci_dev *)osh->pdev)->dev, size, (dma_addr_t*)pap, GFP_ATOMIC);
|
||||
#else
|
||||
va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap);
|
||||
#endif
|
||||
@@ -612,6 +614,8 @@ osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa)
|
||||
|
||||
#ifdef __ARM_ARCH_7A__
|
||||
kfree(va);
|
||||
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dma_free_coherent(&((struct pci_dev *)osh->pdev)->dev, size, va, (dma_addr_t)pa);
|
||||
#else
|
||||
pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
|
||||
#endif
|
||||
@@ -623,7 +627,11 @@ osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p, hnddma_seg_
|
||||
int dir;
|
||||
|
||||
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE;
|
||||
+#else
|
||||
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
|
||||
+#endif
|
||||
|
||||
#if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL)
|
||||
if (dmah != NULL) {
|
||||
@@ -641,7 +649,11 @@ osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p, hnddma_seg_
|
||||
ASSERT(totsegs + nsegs <= MAX_DMA_SEGS);
|
||||
sg->page_link = 0;
|
||||
sg_set_buf(sg, PKTDATA(osh, skb), PKTLEN(osh, skb));
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dma_map_single(&((struct pci_dev *)osh->pdev)->dev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
|
||||
+#else
|
||||
pci_map_single(osh->pdev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
|
||||
+#endif
|
||||
}
|
||||
totsegs += nsegs;
|
||||
totlen += PKTLEN(osh, skb);
|
||||
@@ -656,7 +668,11 @@ osl_dma_map(osl_t *osh, void *va, uint size, int direction, void *p, hnddma_seg_
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ return (dma_map_single(&((struct pci_dev *)osh->pdev)->dev, va, size, dir));
|
||||
+#else
|
||||
return (pci_map_single(osh->pdev, va, size, dir));
|
||||
+#endif
|
||||
}
|
||||
|
||||
void BCMFASTPATH
|
||||
@@ -665,8 +681,13 @@ osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction)
|
||||
int dir;
|
||||
|
||||
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE;
|
||||
+ dma_unmap_single(&((struct pci_dev *)osh->pdev)->dev, (uint32)pa, size, dir);
|
||||
+#else
|
||||
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
|
||||
pci_unmap_single(osh->pdev, (uint32)pa, size, dir);
|
||||
+#endif
|
||||
}
|
||||
|
||||
#if defined(BCMDBG_ASSERT)
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
From 24decccfadc0d95b973e6dd8d476ddde2f0a4b21 Mon Sep 17 00:00:00 2001
|
||||
From: Herman van Hazendonk <github.com@herrie.org>
|
||||
Date: Tue, 31 Mar 2020 17:09:55 +0200
|
||||
Subject: [PATCH 10/16] linuxPackages.broadcom_sta: fix build for kernel 5.6+
|
||||
|
||||
Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above.
|
||||
|
||||
Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
|
||||
|
||||
Source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f
|
||||
---
|
||||
src/shared/linux_osl.c | 6 +++++-
|
||||
src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++-
|
||||
2 files changed, 25 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
|
||||
index 6157d18..dcfc075 100644
|
||||
--- a/src/shared/linux_osl.c
|
||||
+++ b/src/shared/linux_osl.c
|
||||
@@ -942,7 +942,11 @@ osl_getcycles(void)
|
||||
void *
|
||||
osl_reg_map(uint32 pa, uint size)
|
||||
{
|
||||
- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
||||
+ return (ioremap((unsigned long)pa, (unsigned long)size));
|
||||
+ #else
|
||||
+ return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
|
||||
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 83b8859..646f1d9 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -591,10 +591,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
|
||||
}
|
||||
wl->bcm_bustype = bustype;
|
||||
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
||||
+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
|
||||
+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ #else
|
||||
if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
|
||||
WL_ERROR(("wl%d: ioremap() failed\n", unit));
|
||||
goto fail;
|
||||
}
|
||||
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
|
||||
|
||||
wl->bar1_addr = bar1_addr;
|
||||
wl->bar1_size = bar1_size;
|
||||
@@ -781,8 +788,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if ((val & 0x0000ff00) != 0)
|
||||
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
|
||||
bar1_size = pci_resource_len(pdev, 2);
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
||||
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
|
||||
+ bar1_size);
|
||||
+ #else
|
||||
bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
|
||||
bar1_size);
|
||||
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
|
||||
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
|
||||
pdev->irq, bar1_addr, bar1_size);
|
||||
|
||||
@@ -3363,12 +3375,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
||||
+static const struct proc_ops wl_fops = {
|
||||
+ .proc_read = wl_proc_read,
|
||||
+ .proc_write = wl_proc_write,
|
||||
+};
|
||||
+#else
|
||||
static const struct file_operations wl_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = wl_proc_read,
|
||||
.write = wl_proc_write,
|
||||
};
|
||||
-#endif
|
||||
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
|
||||
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
|
||||
|
||||
static int
|
||||
wl_reg_proc_entry(wl_info_t *wl)
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,214 +0,0 @@
|
|||
From 34d611f2dcf7d34db2cb413cc7b4f86f3706fec6 Mon Sep 17 00:00:00 2001
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Tue, 13 Oct 2020 19:35:55 +0200
|
||||
Subject: [PATCH 11/16] linuxPackages.broadcom_sta: fix build for kernel 5.9+
|
||||
|
||||
Get rid of get_fs/set_fs calls in Broadcom WL driver.
|
||||
|
||||
Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 5.10 (tested -rc1 up to 5.10.1)
|
||||
|
||||
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-23 on Arch Linux.
|
||||
|
||||
NB: Some checks in wlc_ioctl_internal are likely superfluous,
|
||||
but I'm not familiar enough with the driver to remove them with confidence.
|
||||
|
||||
See also: https://lwn.net/Articles/722267/
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47058bb54b57962b3958a936ddbc59355e4c5504
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
|
||||
|
||||
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 26 ++-------------------
|
||||
src/wl/sys/wl_iw.c | 25 ++-------------------
|
||||
src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++-----
|
||||
src/wl/sys/wl_linux.h | 2 ++
|
||||
src/wl/sys/wlc_pub.h | 1 +
|
||||
5 files changed, 42 insertions(+), 52 deletions(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 4b3298f..c45ad48 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <wlioctl.h>
|
||||
#include <proto/802.11.h>
|
||||
#include <wl_cfg80211_hybrid.h>
|
||||
+#include <wl_linux.h>
|
||||
|
||||
#define EVENT_TYPE(e) dtoh32((e)->event_type)
|
||||
#define EVENT_FLAGS(e) dtoh16((e)->flags)
|
||||
@@ -442,30 +443,7 @@ static void key_endian_to_host(struct wl_wsec_key *key)
|
||||
static s32
|
||||
wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
|
||||
{
|
||||
- struct ifreq ifr;
|
||||
- struct wl_ioctl ioc;
|
||||
- mm_segment_t fs;
|
||||
- s32 err = 0;
|
||||
-
|
||||
- BUG_ON(len < sizeof(int));
|
||||
-
|
||||
- memset(&ioc, 0, sizeof(ioc));
|
||||
- ioc.cmd = cmd;
|
||||
- ioc.buf = arg;
|
||||
- ioc.len = len;
|
||||
- strcpy(ifr.ifr_name, dev->name);
|
||||
- ifr.ifr_data = (caddr_t)&ioc;
|
||||
-
|
||||
- fs = get_fs();
|
||||
- set_fs(KERNEL_DS);
|
||||
-#if defined(WL_USE_NETDEV_OPS)
|
||||
- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#else
|
||||
- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#endif
|
||||
- set_fs(fs);
|
||||
-
|
||||
- return err;
|
||||
+ return wlc_ioctl_internal(dev, cmd, arg, len);
|
||||
}
|
||||
|
||||
static s32
|
||||
diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
|
||||
index 9c3c74e..e346b15 100644
|
||||
--- a/src/wl/sys/wl_iw.c
|
||||
+++ b/src/wl/sys/wl_iw.c
|
||||
@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
|
||||
|
||||
#include <wl_dbg.h>
|
||||
#include <wl_iw.h>
|
||||
+#include <wl_linux.h>
|
||||
|
||||
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
|
||||
uint32 reason, char* stringBuf, uint buflen);
|
||||
@@ -103,29 +104,7 @@ dev_wlc_ioctl(
|
||||
int len
|
||||
)
|
||||
{
|
||||
- struct ifreq ifr;
|
||||
- wl_ioctl_t ioc;
|
||||
- mm_segment_t fs;
|
||||
- int ret;
|
||||
-
|
||||
- memset(&ioc, 0, sizeof(ioc));
|
||||
- ioc.cmd = cmd;
|
||||
- ioc.buf = arg;
|
||||
- ioc.len = len;
|
||||
-
|
||||
- strcpy(ifr.ifr_name, dev->name);
|
||||
- ifr.ifr_data = (caddr_t) &ioc;
|
||||
-
|
||||
- fs = get_fs();
|
||||
- set_fs(KERNEL_DS);
|
||||
-#if defined(WL_USE_NETDEV_OPS)
|
||||
- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#else
|
||||
- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#endif
|
||||
- set_fs(fs);
|
||||
-
|
||||
- return ret;
|
||||
+ return wlc_ioctl_internal(dev, cmd, arg, len);
|
||||
}
|
||||
|
||||
static int
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 646f1d9..26ba9fa 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -1664,10 +1664,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
goto done2;
|
||||
}
|
||||
|
||||
- if (segment_eq(get_fs(), KERNEL_DS))
|
||||
- buf = ioc.buf;
|
||||
-
|
||||
- else if (ioc.buf) {
|
||||
+ if (ioc.buf) {
|
||||
if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
|
||||
bcmerror = BCME_NORESOURCE;
|
||||
goto done2;
|
||||
@@ -1688,7 +1685,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
WL_UNLOCK(wl);
|
||||
|
||||
done1:
|
||||
- if (ioc.buf && (ioc.buf != buf)) {
|
||||
+ if (ioc.buf) {
|
||||
if (copy_to_user(ioc.buf, buf, ioc.len))
|
||||
bcmerror = BCME_BADADDR;
|
||||
MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
|
||||
@@ -1701,6 +1698,39 @@ done2:
|
||||
return (OSL_ERROR(bcmerror));
|
||||
}
|
||||
|
||||
+int
|
||||
+wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
|
||||
+{
|
||||
+ wl_info_t *wl;
|
||||
+ wl_if_t *wlif;
|
||||
+ int bcmerror;
|
||||
+
|
||||
+ if (!dev)
|
||||
+ return -ENETDOWN;
|
||||
+
|
||||
+ wl = WL_INFO(dev);
|
||||
+ wlif = WL_DEV_IF(dev);
|
||||
+ if (wlif == NULL || wl == NULL || wl->dev == NULL)
|
||||
+ return -ENETDOWN;
|
||||
+
|
||||
+ bcmerror = 0;
|
||||
+
|
||||
+ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
|
||||
+
|
||||
+ WL_LOCK(wl);
|
||||
+ if (!capable(CAP_NET_ADMIN)) {
|
||||
+ bcmerror = BCME_EPERM;
|
||||
+ } else {
|
||||
+ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
|
||||
+ }
|
||||
+ WL_UNLOCK(wl);
|
||||
+
|
||||
+ ASSERT(VALID_BCMERROR(bcmerror));
|
||||
+ if (bcmerror != 0)
|
||||
+ wl->pub->bcmerror = bcmerror;
|
||||
+ return (OSL_ERROR(bcmerror));
|
||||
+}
|
||||
+
|
||||
static struct net_device_stats*
|
||||
wl_get_stats(struct net_device *dev)
|
||||
{
|
||||
diff --git a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
|
||||
index 5b1048e..c8c1f41 100644
|
||||
--- a/src/wl/sys/wl_linux.h
|
||||
+++ b/src/wl/sys/wl_linux.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#define _wl_linux_h_
|
||||
|
||||
#include <wlc_types.h>
|
||||
+#include <wlc_pub.h>
|
||||
|
||||
typedef struct wl_timer {
|
||||
struct timer_list timer;
|
||||
@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs);
|
||||
extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
|
||||
extern void wl_free(wl_info_t *wl);
|
||||
extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
|
||||
+extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
|
||||
extern struct net_device * wl_netdev_get(wl_info_t *wl);
|
||||
|
||||
#endif
|
||||
diff --git a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
|
||||
index 53a98b8..2b5a029 100644
|
||||
--- a/src/wl/sys/wlc_pub.h
|
||||
+++ b/src/wl/sys/wlc_pub.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <wlc_types.h>
|
||||
#include <wlc_utils.h>
|
||||
+#include <siutils.h>
|
||||
#include "proto/802.11.h"
|
||||
#include "proto/bcmevent.h"
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
From cec136ba06039aa2e4441771df855894391db298 Mon Sep 17 00:00:00 2001
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Thu, 30 Jun 2022 02:15:35 +0200
|
||||
Subject: [PATCH 14/16] linuxPackages.broadcom_sta: fix build for kernel 6.0+
|
||||
|
||||
Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 6.0-rc1
|
||||
|
||||
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-33 on Arch Linux.
|
||||
|
||||
Source: https://gist.github.com/joanbm/207210d74637870c01ef5a3c262a597d
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index c45ad48..9ae56a1 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -2354,7 +2354,12 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
|
||||
ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
||||
struct cfg80211_roam_info roam_info = {
|
||||
+// Rel. commit "cfg80211: Indicate MLO connection info in connect and roam callbacks" (Veerendranath Jakkam, Wed Jun 8)
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
|
||||
.bss = bss,
|
||||
+#else
|
||||
+ .links[0].bss = bss,
|
||||
+#endif
|
||||
.req_ie = conn_info->req_ie,
|
||||
.req_ie_len = conn_info->req_ie_len,
|
||||
.resp_ie = conn_info->resp_ie,
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
From febe94b43294a3155e39e844db4ac4ee81614ad1 Mon Sep 17 00:00:00 2001
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Mon, 29 Aug 2022 00:06:53 +0200
|
||||
Subject: [PATCH 16/16] linuxPackages.broadcom_sta: fix build for kernel 6.1+
|
||||
|
||||
Tentative patch for broadcom-wl 6.30.223.271 driver for Linux 6.1-rc1
|
||||
|
||||
Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-35 on Arch Linux
|
||||
|
||||
Source: https://gist.github.com/joanbm/94323ea99eff1e1d1c51241b5b651549
|
||||
---
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 21 +++++++++++++--------
|
||||
1 file changed, 13 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index a6b2ca2..333866c 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -104,20 +104,25 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wd
|
||||
static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
|
||||
#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
+#define MAYBE_INT_LINK_ID int link_id,
|
||||
+#else
|
||||
+#define MAYBE_INT_LINK_ID
|
||||
+#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
|
||||
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
|
||||
- struct net_device *dev, u8 key_idx, bool unicast, bool multicast);
|
||||
+ struct net_device *dev, MAYBE_INT_LINK_ID u8 key_idx, bool unicast, bool multicast);
|
||||
#else
|
||||
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
|
||||
struct net_device *dev, u8 key_idx);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
- u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params);
|
||||
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params);
|
||||
static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
- u8 key_idx, bool pairwise, const u8 *mac_addr);
|
||||
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr);
|
||||
static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
- u8 key_idx, bool pairwise, const u8 *mac_addr,
|
||||
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr,
|
||||
void *cookie, void (*callback) (void *cookie, struct key_params *params));
|
||||
#else
|
||||
static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
@@ -1165,7 +1170,7 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
|
||||
static s32
|
||||
wl_cfg80211_config_default_key(struct wiphy *wiphy,
|
||||
- struct net_device *dev, u8 key_idx, bool unicast, bool multicast)
|
||||
+ struct net_device *dev, MAYBE_INT_LINK_ID u8 key_idx, bool unicast, bool multicast)
|
||||
#else
|
||||
static s32
|
||||
wl_cfg80211_config_default_key(struct wiphy *wiphy,
|
||||
@@ -1190,7 +1195,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
static s32
|
||||
wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
- u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params)
|
||||
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr, struct key_params *params)
|
||||
#else
|
||||
static s32
|
||||
wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
@@ -1311,7 +1316,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
static s32
|
||||
wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
- u8 key_idx, bool pairwise, const u8 *mac_addr)
|
||||
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr)
|
||||
#else
|
||||
static s32
|
||||
wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
@@ -1354,7 +1359,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
static s32
|
||||
wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
|
||||
- u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
|
||||
+ MAYBE_INT_LINK_ID u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
|
||||
void (*callback) (void *cookie, struct key_params * params))
|
||||
#else
|
||||
static s32
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
From 507d93e3651d78c1df8bd185b0703872d0c2585b Mon Sep 17 00:00:00 2001
|
||||
From: aszlig <aszlig@redmoonstudios.org>
|
||||
Date: Mon, 1 Aug 2016 21:00:02 +0200
|
||||
Subject: [PATCH 03/16] linuxPackages.broadcom_sta: fix NULL pointer deref
|
||||
|
||||
The patch is from the following Gentoo bug:
|
||||
|
||||
https://bugs.gentoo.org/show_bug.cgi?id=523326#c24
|
||||
|
||||
Built successfully against Linux 3.18.36, 4.4.16 and 4.7.0.
|
||||
|
||||
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
|
||||
Cc: @phreedom, @vcunat
|
||||
---
|
||||
src/wl/sys/wl_linux.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 14922c0..65d7a22 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -2167,8 +2167,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
|
||||
wlif = WL_DEV_IF(dev);
|
||||
wl = WL_INFO(dev);
|
||||
|
||||
+ skb->prev = NULL;
|
||||
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
|
||||
- skb->prev = NULL;
|
||||
|
||||
TXQ_LOCK(wl);
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
From 99b1bbc01ea0611e93cb94c2a2532aef96676976 Mon Sep 17 00:00:00 2001
|
||||
From: X9VoiD <oscar.silvestrexx@gmail.com>
|
||||
Date: Wed, 19 Oct 2022 00:29:28 +0800
|
||||
Subject: [PATCH 15/16] linuxPackages.broadcom_sta: fix build issues with
|
||||
kernel 6.0+
|
||||
|
||||
---
|
||||
src/shared/linux_osl.c | 2 +-
|
||||
src/wl/sys/wl_cfg80211_hybrid.c | 17 ++++++++---------
|
||||
src/wl/sys/wl_iw.h | 1 -
|
||||
src/wl/sys/wl_linux.c | 17 +++++++++--------
|
||||
4 files changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
|
||||
index 5a25b82..18bacb6 100644
|
||||
--- a/src/shared/linux_osl.c
|
||||
+++ b/src/shared/linux_osl.c
|
||||
@@ -1101,7 +1101,7 @@ osl_os_get_image_block(char *buf, int len, void *image)
|
||||
if (!image)
|
||||
return 0;
|
||||
|
||||
- rdlen = kernel_read(fp, fp->f_pos, buf, len);
|
||||
+ rdlen = kernel_read(fp, (void *)fp->f_pos, (size_t)len, (loff_t *)buf);
|
||||
if (rdlen > 0)
|
||||
fp->f_pos += rdlen;
|
||||
|
||||
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 9ae56a1..a6b2ca2 100644
|
||||
--- a/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -790,6 +790,7 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
|
||||
break;
|
||||
case NL80211_AUTHTYPE_NETWORK_EAP:
|
||||
WL_DBG(("network eap\n"));
|
||||
+ break;
|
||||
default:
|
||||
val = 2;
|
||||
WL_ERR(("invalid auth type (%d)\n", sme->auth_type));
|
||||
@@ -2347,26 +2348,24 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
|
||||
const wl_event_msg_t *e, void *data)
|
||||
{
|
||||
struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
|
||||
+ s32 err = 0;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
struct cfg80211_bss *bss;
|
||||
struct wlc_ssid *ssid;
|
||||
+ struct cfg80211_roam_info roam_info;
|
||||
ssid = &wl->profile->ssid;
|
||||
bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
|
||||
ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
||||
- struct cfg80211_roam_info roam_info = {
|
||||
// Rel. commit "cfg80211: Indicate MLO connection info in connect and roam callbacks" (Veerendranath Jakkam, Wed Jun 8)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
|
||||
- .bss = bss,
|
||||
+ roam_info.bss = bss;
|
||||
#else
|
||||
- .links[0].bss = bss,
|
||||
+ roam_info.links[0].bss = bss;
|
||||
#endif
|
||||
- .req_ie = conn_info->req_ie,
|
||||
- .req_ie_len = conn_info->req_ie_len,
|
||||
- .resp_ie = conn_info->resp_ie,
|
||||
- .resp_ie_len = conn_info->resp_ie_len,
|
||||
- };
|
||||
+ roam_info.req_ie = conn_info->req_ie;
|
||||
+ roam_info.req_ie_len = conn_info->req_ie_len;
|
||||
+ roam_info.resp_ie = conn_info->resp_ie;
|
||||
#endif
|
||||
- s32 err = 0;
|
||||
|
||||
wl_get_assoc_ies(wl);
|
||||
memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
|
||||
diff --git a/src/wl/sys/wl_iw.h b/src/wl/sys/wl_iw.h
|
||||
index 3ab084f..471d11f 100644
|
||||
--- a/src/wl/sys/wl_iw.h
|
||||
+++ b/src/wl/sys/wl_iw.h
|
||||
@@ -70,7 +70,6 @@ struct cntry_locales_custom {
|
||||
#define WL_IW_RSSI_EXCELLENT -57
|
||||
#define WL_IW_RSSI_INVALID 0
|
||||
#define MAX_WX_STRING 80
|
||||
-#define isprint(c) bcm_isprint(c)
|
||||
#define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1)
|
||||
#define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3)
|
||||
#define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5)
|
||||
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
|
||||
index 25c4706..4c7e238 100644
|
||||
--- a/src/wl/sys/wl_linux.c
|
||||
+++ b/src/wl/sys/wl_linux.c
|
||||
@@ -791,14 +791,15 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
pci_read_config_dword(pdev, 0x40, &val);
|
||||
if ((val & 0x0000ff00) != 0)
|
||||
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
|
||||
- bar1_size = pci_resource_len(pdev, 2);
|
||||
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
||||
- bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
|
||||
- bar1_size);
|
||||
- #else
|
||||
- bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
|
||||
- bar1_size);
|
||||
- #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
|
||||
+
|
||||
+ bar1_size = pci_resource_len(pdev, 2);
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
||||
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
|
||||
+ bar1_size);
|
||||
+ #else
|
||||
+ bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
|
||||
+ bar1_size);
|
||||
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
|
||||
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
|
||||
pdev->irq, bar1_addr, bar1_size);
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
|
@ -1821,13 +1821,14 @@
|
|||
habluetooth
|
||||
hassil
|
||||
home-assistant-intents
|
||||
idasen-ha
|
||||
ifaddr
|
||||
mutagen
|
||||
pymicro-vad
|
||||
pyserial
|
||||
pyudev
|
||||
zeroconf
|
||||
]; # missing inputs: idasen-ha
|
||||
];
|
||||
"idteck_prox" = ps: with ps; [
|
||||
]; # missing inputs: rfk101py
|
||||
"ifttt" = ps: with ps; [
|
||||
|
@ -5164,6 +5165,7 @@
|
|||
"iaqualink"
|
||||
"ibeacon"
|
||||
"icloud"
|
||||
"idasen_desk"
|
||||
"ifttt"
|
||||
"ign_sismologia"
|
||||
"image"
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
callPackage ../nginx/generic.nix args rec {
|
||||
pname = "openresty";
|
||||
nginxVersion = "1.25.3";
|
||||
version = "${nginxVersion}.1";
|
||||
version = "${nginxVersion}.2";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://openresty.org/download/openresty-${version}.tar.gz";
|
||||
sha256 = "sha256-MuwaJTpaEyUDVaB1/mW31j7EXFYLviEzUPCZKlfNed8=";
|
||||
sha256 = "sha256-LVZAIrBuM7Rfflz68eXcVx041hgDr5+idU3/81PCjZw=";
|
||||
};
|
||||
|
||||
# generic.nix applies fixPatch on top of every patch defined there.
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "snappymail";
|
||||
version = "2.37.2";
|
||||
version = "2.37.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/the-djmaze/snappymail/releases/download/v${version}/snappymail-${version}.tar.gz";
|
||||
sha256 = "sha256-kKL3+T4VXhHDYdKfiGVB8cx9/OJajqjvlcImCIrp9yw=";
|
||||
sha256 = "sha256-Fa6VbWPROkdVS8wHkXYCNR+DiBR6SqvfmrjGVlhhkwU=";
|
||||
};
|
||||
|
||||
sourceRoot = "snappymail";
|
||||
|
|
|
@ -37,6 +37,7 @@ edk2.mkDerivation "ShellPkg/ShellPkg.dsc" (finalAttrs: {
|
|||
inherit (edk2.meta) license platforms;
|
||||
description = "UEFI Shell from Tianocore EFI development kit";
|
||||
homepage = "https://github.com/tianocore/tianocore.github.io/wiki/ShellPkg";
|
||||
maintainers = with lib.maintainers; [ LunNova ];
|
||||
maintainers = with lib.maintainers; [ LunNova mjoerg ];
|
||||
broken = stdenv.isDarwin && stdenv.isAarch64;
|
||||
};
|
||||
})
|
||||
|
|
|
@ -62,7 +62,6 @@ let
|
|||
the `tectonic` derivation is updated.
|
||||
*/
|
||||
inherit (emptyFile)
|
||||
outputHashAlgo
|
||||
outputHashMode
|
||||
outputHash
|
||||
;
|
||||
|
|
|
@ -6912,7 +6912,8 @@ with pkgs;
|
|||
cudaPackages_12_1 = callPackage ./cuda-packages.nix { cudaVersion = "12.1"; };
|
||||
cudaPackages_12_2 = callPackage ./cuda-packages.nix { cudaVersion = "12.2"; };
|
||||
cudaPackages_12_3 = callPackage ./cuda-packages.nix { cudaVersion = "12.3"; };
|
||||
cudaPackages_12 = cudaPackages_12_2; # Latest supported by cudnn
|
||||
cudaPackages_12_4 = callPackage ./cuda-packages.nix { cudaVersion = "12.4"; };
|
||||
cudaPackages_12 = cudaPackages_12_4; # Latest supported by cudnn
|
||||
|
||||
cudaPackages = recurseIntoAttrs cudaPackages_12;
|
||||
|
||||
|
@ -12429,8 +12430,6 @@ with pkgs;
|
|||
|
||||
setserial = callPackage ../tools/system/setserial { };
|
||||
|
||||
setzer = callPackage ../applications/editors/setzer { };
|
||||
|
||||
seqdiag = with python3Packages; toPythonApplication seqdiag;
|
||||
|
||||
sequoia-sqv = callPackage ../tools/security/sequoia-sqv { };
|
||||
|
@ -32782,8 +32781,6 @@ with pkgs;
|
|||
|
||||
ponymix = callPackage ../applications/audio/ponymix { };
|
||||
|
||||
pop-launcher = callPackage ../applications/misc/pop-launcher { };
|
||||
|
||||
pothos = libsForQt5.callPackage ../applications/radio/pothos { };
|
||||
|
||||
potrace = callPackage ../applications/graphics/potrace { };
|
||||
|
|
|
@ -2717,6 +2717,8 @@ self: super: with self; {
|
|||
|
||||
curio = callPackage ../development/python-modules/curio { };
|
||||
|
||||
curio-compat = callPackage ../development/python-modules/curio-compat { };
|
||||
|
||||
curlify = callPackage ../development/python-modules/curlify { };
|
||||
|
||||
curl-cffi = callPackage ../development/python-modules/curl-cffi { };
|
||||
|
@ -5884,6 +5886,8 @@ self: super: with self; {
|
|||
|
||||
idasen = callPackage ../development/python-modules/idasen { };
|
||||
|
||||
idasen-ha = callPackage ../development/python-modules/idasen-ha { };
|
||||
|
||||
icoextract = toPythonModule (pkgs.icoextract.override {
|
||||
python3Packages = self;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue