forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
120 changed files
with
2,813 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6199,6 +6199,16 @@ | |
githubId = 45048741; | ||
name = "Alwanga Oyango"; | ||
}; | ||
galaxy = { | ||
email = "[email protected]"; | ||
matrix = "@galaxy:mozilla.org"; | ||
name = "The Galaxy"; | ||
github = "ga1aksy"; | ||
githubId = 148551648; | ||
keys = [{ | ||
fingerprint = "48CA 3873 9E9F CA8E 76A0 835A E3DE CF85 4212 E1EA"; | ||
}]; | ||
}; | ||
gal_bolle = { | ||
email = "[email protected]"; | ||
github = "FlorentBecker"; | ||
|
@@ -13664,6 +13674,12 @@ | |
githubId = 152312; | ||
name = "Periklis Tsirakidis"; | ||
}; | ||
perstark = { | ||
email = "[email protected]"; | ||
github = "perstarkse"; | ||
githubId = 63069986; | ||
name = "Per Stark"; | ||
}; | ||
petercommand = { | ||
email = "[email protected]"; | ||
github = "petercommand"; | ||
|
@@ -17883,6 +17899,10 @@ | |
githubId = 13155277; | ||
name = "Tom Houle"; | ||
}; | ||
tomkoid = { | ||
email = "[email protected]"; | ||
name = "Tomkoid"; | ||
}; | ||
tomodachi94 = { | ||
email = "[email protected]"; | ||
matrix = "@tomodachi94:matrix.org"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ config, lib, pkgs, ... }: | ||
let | ||
cfg = config.services.fanout; | ||
mknodCmds = n: lib.lists.imap0 (i: s: | ||
"mknod /dev/fanout${builtins.toString i} c $MAJOR ${builtins.toString i}" | ||
) (lib.lists.replicate n ""); | ||
in | ||
{ | ||
options.services.fanout = { | ||
enable = lib.mkEnableOption (lib.mdDoc "fanout"); | ||
fanoutDevices = lib.mkOption { | ||
type = lib.types.int; | ||
default = 1; | ||
description = "Number of /dev/fanout devices"; | ||
}; | ||
bufferSize = lib.mkOption { | ||
type = lib.types.int; | ||
default = 16384; | ||
description = "Size of /dev/fanout buffer in bytes"; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
boot.extraModulePackages = [ config.boot.kernelPackages.fanout.out ]; | ||
|
||
boot.kernelModules = [ "fanout" ]; | ||
|
||
boot.extraModprobeConfig = '' | ||
options fanout buffersize=${builtins.toString cfg.bufferSize} | ||
''; | ||
|
||
systemd.services.fanout = { | ||
description = "Bring up /dev/fanout devices"; | ||
script = '' | ||
MAJOR=$(${pkgs.gnugrep}/bin/grep fanout /proc/devices | ${pkgs.gawk}/bin/awk '{print $1}') | ||
${lib.strings.concatLines (mknodCmds cfg.fanoutDevices)} | ||
''; | ||
|
||
wantedBy = [ "multi-user.target" ]; | ||
|
||
serviceConfig = { | ||
Type = "oneshot"; | ||
User = "root"; | ||
RemainAfterExit = "yes"; | ||
Restart = "no"; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.services.soft-serve; | ||
configFile = format.generate "config.yaml" cfg.settings; | ||
format = pkgs.formats.yaml { }; | ||
docUrl = "https://charm.sh/blog/self-hosted-soft-serve/"; | ||
stateDir = "/var/lib/soft-serve"; | ||
in | ||
{ | ||
options = { | ||
services.soft-serve = { | ||
enable = mkEnableOption "Enable soft-serve service"; | ||
|
||
package = mkPackageOption pkgs "soft-serve" { }; | ||
|
||
settings = mkOption { | ||
type = format.type; | ||
default = { }; | ||
description = mdDoc '' | ||
The contents of the configuration file. | ||
See <${docUrl}>. | ||
''; | ||
example = literalExpression '' | ||
{ | ||
name = "dadada's repos"; | ||
log_format = "text"; | ||
ssh = { | ||
listen_addr = ":23231"; | ||
public_url = "ssh://localhost:23231"; | ||
max_timeout = 30; | ||
idle_timeout = 120; | ||
}; | ||
stats.listen_addr = ":23233"; | ||
} | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
|
||
systemd.tmpfiles.rules = [ | ||
# The config file has to be inside the state dir | ||
"L+ ${stateDir}/config.yaml - - - - ${configFile}" | ||
]; | ||
|
||
systemd.services.soft-serve = { | ||
description = "Soft Serve git server"; | ||
documentation = [ docUrl ]; | ||
requires = [ "network-online.target" ]; | ||
after = [ "network-online.target" ]; | ||
wantedBy = [ "multi-user.target" ]; | ||
|
||
environment.SOFT_SERVE_DATA_PATH = stateDir; | ||
|
||
serviceConfig = { | ||
Type = "simple"; | ||
DynamicUser = true; | ||
Restart = "always"; | ||
ExecStart = "${getExe cfg.package} serve"; | ||
StateDirectory = "soft-serve"; | ||
WorkingDirectory = stateDir; | ||
RuntimeDirectory = "soft-serve"; | ||
RuntimeDirectoryMode = "0750"; | ||
ProcSubset = "pid"; | ||
ProtectProc = "invisible"; | ||
UMask = "0027"; | ||
CapabilityBoundingSet = ""; | ||
ProtectHome = true; | ||
PrivateDevices = true; | ||
PrivateUsers = true; | ||
ProtectHostname = true; | ||
ProtectClock = true; | ||
ProtectKernelTunables = true; | ||
ProtectKernelModules = true; | ||
ProtectKernelLogs = true; | ||
ProtectControlGroups = true; | ||
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ]; | ||
RestrictNamespaces = true; | ||
LockPersonality = true; | ||
MemoryDenyWriteExecute = true; | ||
RestrictRealtime = true; | ||
RemoveIPC = true; | ||
PrivateMounts = true; | ||
SystemCallArchitectures = "native"; | ||
SystemCallFilter = [ | ||
"@system-service" | ||
"~@cpu-emulation @debug @keyring @module @mount @obsolete @privileged @raw-io @reboot @setuid @swap" | ||
]; | ||
}; | ||
}; | ||
}; | ||
|
||
meta.maintainers = [ maintainers.dadada ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ system ? builtins.currentSystem | ||
, config ? {} | ||
, pkgs ? import ../.. { inherit system config; } | ||
}: | ||
import ./make-test-python.nix ({lib, pkgs, ...}: { | ||
name = "fanout"; | ||
meta.maintainers = [ lib.maintainers.therishidesai ]; | ||
|
||
nodes = let | ||
cfg = { ... }: { | ||
services.fanout = { | ||
enable = true; | ||
fanoutDevices = 2; | ||
bufferSize = 8192; | ||
}; | ||
}; | ||
in { | ||
machine = cfg; | ||
}; | ||
|
||
testScript = '' | ||
start_all() | ||
# mDNS. | ||
machine.wait_for_unit("multi-user.target") | ||
machine.succeed("test -c /dev/fanout0") | ||
machine.succeed("test -c /dev/fanout1") | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.