uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
54
nixos/modules/services/networking/websockify.nix
Normal file
54
nixos/modules/services/networking/websockify.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.services.networking.websockify; in {
|
||||
options = {
|
||||
services.networking.websockify = {
|
||||
enable = mkOption {
|
||||
description = "Whether to enable websockify to forward websocket connections to TCP connections.";
|
||||
|
||||
default = false;
|
||||
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
sslCert = mkOption {
|
||||
description = "Path to the SSL certificate.";
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
sslKey = mkOption {
|
||||
description = "Path to the SSL key.";
|
||||
default = cfg.sslCert;
|
||||
defaultText = literalExpression "config.services.networking.websockify.sslCert";
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
portMap = mkOption {
|
||||
description = "Ports to map by default.";
|
||||
default = {};
|
||||
type = types.attrsOf types.int;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services."websockify@" = {
|
||||
description = "Service to forward websocket connections to TCP connections (from port:to port %I)";
|
||||
script = ''
|
||||
IFS=':' read -a array <<< "$1"
|
||||
${pkgs.pythonPackages.websockify}/bin/websockify --ssl-only \
|
||||
--cert=${cfg.sslCert} --key=${cfg.sslKey} 0.0.0.0:''${array[0]} 0.0.0.0:''${array[1]}
|
||||
'';
|
||||
scriptArgs = "%i";
|
||||
};
|
||||
|
||||
systemd.targets.default-websockify = {
|
||||
description = "Target to start all default websockify@ services";
|
||||
unitConfig.X-StopOnReconfiguration = true;
|
||||
wants = mapAttrsToList (name: value: "websockify@${name}:${toString value}.service") cfg.portMap;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue