{nixos,nixosTests}/redlib: format with nixfmt
This commit is contained in:
parent
d78d09350a
commit
e286b91ebc
@ -1,8 +1,21 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
with lib;
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib)
|
||||||
|
concatStringsSep
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
mkOption
|
||||||
|
mkPackageOption
|
||||||
|
mkRenamedOptionModule
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
cfg = config.services.redlib;
|
cfg = config.services.redlib;
|
||||||
|
|
||||||
args = concatStringsSep " " ([
|
args = concatStringsSep " " ([
|
||||||
@ -12,7 +25,16 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule [ "services" "libreddit" ] [ "services" "redlib" ])
|
(mkRenamedOptionModule
|
||||||
|
[
|
||||||
|
"services"
|
||||||
|
"libreddit"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"services"
|
||||||
|
"redlib"
|
||||||
|
]
|
||||||
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
@ -55,6 +77,7 @@ in
|
|||||||
AmbientCapabilities = lib.mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
|
AmbientCapabilities = lib.mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "2s";
|
RestartSec = "2s";
|
||||||
|
|
||||||
# Hardening
|
# Hardening
|
||||||
CapabilityBoundingSet = if (cfg.port < 1024) then [ "CAP_NET_BIND_SERVICE" ] else [ "" ];
|
CapabilityBoundingSet = if (cfg.port < 1024) then [ "CAP_NET_BIND_SERVICE" ] else [ "" ];
|
||||||
DeviceAllow = [ "" ];
|
DeviceAllow = [ "" ];
|
||||||
@ -73,12 +96,19 @@ in
|
|||||||
ProtectKernelModules = true;
|
ProtectKernelModules = true;
|
||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
ProtectProc = "invisible";
|
ProtectProc = "invisible";
|
||||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
|
RestrictAddressFamilies = [
|
||||||
|
"AF_INET"
|
||||||
|
"AF_INET6"
|
||||||
|
];
|
||||||
RestrictNamespaces = true;
|
RestrictNamespaces = true;
|
||||||
RestrictRealtime = true;
|
RestrictRealtime = true;
|
||||||
RestrictSUIDSGID = true;
|
RestrictSUIDSGID = true;
|
||||||
SystemCallArchitectures = "native";
|
SystemCallArchitectures = "native";
|
||||||
SystemCallFilter = [ "@system-service" "~@privileged" "~@resources" ];
|
SystemCallFilter = [
|
||||||
|
"@system-service"
|
||||||
|
"~@privileged"
|
||||||
|
"~@resources"
|
||||||
|
];
|
||||||
UMask = "0077";
|
UMask = "0077";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
import ./make-test-python.nix (
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
{
|
||||||
name = "redlib";
|
name = "redlib";
|
||||||
meta.maintainers = with lib.maintainers; [ soispha ];
|
meta.maintainers = with lib.maintainers; [ soispha ];
|
||||||
|
|
||||||
@ -17,4 +19,5 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
|||||||
# Query a page that does not require Internet access
|
# Query a page that does not require Internet access
|
||||||
machine.succeed("curl --fail http://localhost:80/settings")
|
machine.succeed("curl --fail http://localhost:80/settings")
|
||||||
'';
|
'';
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user