nixbld: NixOS 23.11

This commit is contained in:
Sebastien Bourdeauducq 2023-12-16 13:03:19 +08:00
parent c34d9cc7cf
commit e7c1746832
2 changed files with 74 additions and 77 deletions

View File

@ -20,8 +20,8 @@ in
./afws-module.nix ./afws-module.nix
./rt.nix ./rt.nix
(builtins.fetchTarball { (builtins.fetchTarball {
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/4966c0f63f04659015f064f2aa34b1893a16dfde/nixos-mailserver-nixos.tar.gz"; url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/008d78cc21959e33d0d31f375b88353a7d7121ae/nixos-mailserver-nixos.tar.gz";
sha256 = "sha256:0bbv0hcwpm9vhvqnj51k84c3fx6x0vgv68yf0f8kdjvprpzxjdgk"; sha256 = "sha256:0pnfyg4icsvrw390a227m8b1j5w8awicx5aza3d0fiyyzpnrpn5a";
}) })
]; ];
@ -56,36 +56,36 @@ in
services.fail2ban.ignoreIP = [ "94.190.212.123" "2001:470:18:390::2" ]; services.fail2ban.ignoreIP = [ "94.190.212.123" "2001:470:18:390::2" ];
services.fail2ban.maxretry = 9; services.fail2ban.maxretry = 9;
services.fail2ban.bantime-increment.enable = true; services.fail2ban.bantime-increment.enable = true;
services.fail2ban.jails.sshd = services.fail2ban.jails.sshd = {
'' settings = {
enabled = true filter = "sshd";
filter = sshd action = "iptables-allports";
action = iptables-allports };
''; };
services.fail2ban.jails.nginx-botsearch = services.fail2ban.jails.nginx-botsearch = {
'' settings = {
enabled = true filter = "nginx-botsearch";
filter = nginx-botsearch action = "iptables-allports";
action = iptables-allports };
''; };
services.fail2ban.jails.nginx-limit-req = services.fail2ban.jails.nginx-limit-req = {
'' settings = {
enabled = true filter = "nginx-limit-req";
filter = nginx-limit-req action = "iptables-allports";
action = iptables-allports };
''; };
services.fail2ban.jails.postfix = services.fail2ban.jails.postfix = {
'' settings = {
enabled = true filter = "postfix";
filter = postfix action = "iptables-allports";
action = iptables-allports };
''; };
services.fail2ban.jails.dovecot = services.fail2ban.jails.dovecot = {
'' settings = {
enabled = true filter = "dovecot";
filter = dovecot action = "iptables-allports";
action = iptables-allports };
''; };
networking = { networking = {
hostName = "nixbld"; hostName = "nixbld";
@ -362,19 +362,16 @@ in
services.hostapd = { services.hostapd = {
enable = true; enable = true;
interface = netifWifi; radios.${netifWifi} = {
hwMode = "g"; band = "2g";
countryCode = "HK";
networks.${netifWifi} = {
ssid = "M-Labs"; ssid = "M-Labs";
wpaPassphrase = (import /etc/nixos/secret/wifi_password.nix); authentication.saePasswords = [
extraConfig = '' { password = (import /etc/nixos/secret/wifi_password.nix); }
ieee80211d=1 ];
country_code=HK };
ieee80211n=1 };
wmm_enabled=1
auth_algs=1
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
'';
}; };
services.dnsmasq = { services.dnsmasq = {
enable = true; enable = true;
@ -753,7 +750,7 @@ in
siteUrl = "https://chat.m-labs.hk/"; siteUrl = "https://chat.m-labs.hk/";
mutableConfig = true; mutableConfig = true;
}; };
services.postgresql.package = pkgs.postgresql_11; services.postgresql.package = pkgs.postgresql_12;
services.matterbridge = { services.matterbridge = {
enable = true; enable = true;
configPath = "/etc/nixos/secret/matterbridge.toml"; configPath = "/etc/nixos/secret/matterbridge.toml";
@ -761,7 +758,7 @@ in
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in { nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
nix = super.nix.overrideAttrs(oa: { nix = super.nix.overrideAttrs(oa: {
patches = oa.patches or [] ++ [ ./nix-28-networked-derivations.patch ]; patches = oa.patches or [] ++ [ ./nix-networked-derivations.patch ];
}); });
hydra_unstable = super.hydra_unstable.overrideAttrs(oa: { hydra_unstable = super.hydra_unstable.overrideAttrs(oa: {
patches = oa.patches or [] ++ [ patches = oa.patches or [] ++ [
@ -1115,12 +1112,12 @@ in
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
package = pkgs.nextcloud26; package = pkgs.nextcloud27;
hostName = "files.m-labs.hk"; hostName = "files.m-labs.hk";
https = true; https = true;
enableBrokenCiphersForSSE = false;
maxUploadSize = "2G"; maxUploadSize = "2G";
config.adminpassFile = "/etc/nixos/secret/nextcloud_pass.txt"; config.adminpassFile = "/etc/nixos/secret/nextcloud_pass.txt";
config.defaultPhoneRegion = "HK";
}; };
services.hedgedoc = { services.hedgedoc = {

View File

@ -1,80 +1,80 @@
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 61ee5d7aa..f38684973 100644 index 64b55ca6a..9b4e52b8e 100644
--- a/src/libstore/build/local-derivation-goal.cc --- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc
@@ -176,6 +176,8 @@ void LocalDerivationGoal::tryLocalBuild() { @@ -180,6 +180,8 @@ void LocalDerivationGoal::tryLocalBuild()
return;
} assert(derivationType);
+ networked = parsedDrv->getBoolAttr("__networked"); + networked = parsedDrv->getBoolAttr("__networked");
+ +
/* Are we doing a chroot build? */ /* Are we doing a chroot build? */
{ {
auto noChroot = parsedDrv->getBoolAttr("__noChroot"); auto noChroot = parsedDrv->getBoolAttr("__noChroot");
@@ -193,7 +195,7 @@ void LocalDerivationGoal::tryLocalBuild() { @@ -197,7 +199,7 @@ void LocalDerivationGoal::tryLocalBuild()
else if (settings.sandboxMode == smDisabled) else if (settings.sandboxMode == smDisabled)
useChroot = false; useChroot = false;
else if (settings.sandboxMode == smRelaxed) else if (settings.sandboxMode == smRelaxed)
- useChroot = derivationType.isSandboxed() && !noChroot; - useChroot = derivationType->isSandboxed() && !noChroot;
+ useChroot = !networked && derivationType.isSandboxed() && !noChroot; + useChroot = !networked && derivationType->isSandboxed() && !noChroot;
} }
auto & localStore = getLocalStore(); auto & localStore = getLocalStore();
@@ -677,7 +679,7 @@ void LocalDerivationGoal::startBuilder() @@ -691,7 +693,7 @@ void LocalDerivationGoal::startBuilder()
"nogroup:x:65534:\n", sandboxGid())); "nogroup:x:65534:\n", sandboxGid()));
/* Create /etc/hosts with localhost entry. */ /* Create /etc/hosts with localhost entry. */
- if (derivationType.isSandboxed()) - if (derivationType->isSandboxed())
+ if (!networked && derivationType.isSandboxed()) + if (!networked && derivationType->isSandboxed())
writeFile(chrootRootDir + "/etc/hosts", "127.0.0.1 localhost\n::1 localhost\n"); writeFile(chrootRootDir + "/etc/hosts", "127.0.0.1 localhost\n::1 localhost\n");
/* Make the closure of the inputs available in the chroot, /* Make the closure of the inputs available in the chroot,
@@ -884,7 +886,7 @@ void LocalDerivationGoal::startBuilder() @@ -895,7 +897,7 @@ void LocalDerivationGoal::startBuilder()
us. us.
*/ */
- if (derivationType.isSandboxed()) - if (derivationType->isSandboxed())
+ if (!networked && derivationType.isSandboxed()) + if (!networked && derivationType->isSandboxed())
privateNetwork = true; privateNetwork = true;
userNamespaceSync.create(); userNamespaceSync.create();
@@ -1179,7 +1181,7 @@ void LocalDerivationGoal::initEnv() @@ -1134,7 +1136,7 @@ void LocalDerivationGoal::initEnv()
to the builder is generally impure, but the output of to the builder is generally impure, but the output of
fixed-output derivations is by definition pure (since we fixed-output derivations is by definition pure (since we
already know the cryptographic hash of the output). */ already know the cryptographic hash of the output). */
- if (!derivationType.isSandboxed()) { - if (!derivationType->isSandboxed()) {
+ if (networked || !derivationType.isSandboxed()) { + if (networked || !derivationType->isSandboxed()) {
for (auto & i : parsedDrv->getStringsAttr("impureEnvVars").value_or(Strings())) for (auto & i : parsedDrv->getStringsAttr("impureEnvVars").value_or(Strings()))
env[i] = getEnv(i).value_or(""); env[i] = getEnv(i).value_or("");
} }
@@ -1811,7 +1813,7 @@ void LocalDerivationGoal::runChild() @@ -1799,7 +1801,7 @@ void LocalDerivationGoal::runChild()
/* Fixed-output derivations typically need to access the /* Fixed-output derivations typically need to access the
network, so give them access to /etc/resolv.conf and so network, so give them access to /etc/resolv.conf and so
on. */ on. */
- if (!derivationType.isSandboxed()) { - if (!derivationType->isSandboxed()) {
+ if (networked || !derivationType.isSandboxed()) { + if (networked || !derivationType->isSandboxed()) {
// Only use nss functions to resolve hosts and // Only use nss functions to resolve hosts and
// services. Dont use it for anything else that may // services. Dont use it for anything else that may
// be configured for this system. This limits the // be configured for this system. This limits the
@@ -2059,7 +2061,7 @@ void LocalDerivationGoal::runChild() @@ -2050,7 +2052,7 @@ void LocalDerivationGoal::runChild()
#include "sandbox-defaults.sb" #include "sandbox-defaults.sb"
; ;
- if (!derivationType.isSandboxed()) - if (!derivationType->isSandboxed())
+ if (networked || !derivationType.isSandboxed()) + if (networked || !derivationType->isSandboxed())
sandboxProfile += sandboxProfile +=
#include "sandbox-network.sb" #include "sandbox-network.sb"
; ;
diff --git a/src/libstore/build/local-derivation-goal.hh b/src/libstore/build/local-derivation-goal.hh diff --git a/src/libstore/build/local-derivation-goal.hh b/src/libstore/build/local-derivation-goal.hh
index 34c4e9187..c4c26fd6f 100644 index 0a05081c7..4c251718c 100644
--- a/src/libstore/build/local-derivation-goal.hh --- a/src/libstore/build/local-derivation-goal.hh
+++ b/src/libstore/build/local-derivation-goal.hh +++ b/src/libstore/build/local-derivation-goal.hh
@@ -44,6 +44,8 @@ struct LocalDerivationGoal : public DerivationGoal @@ -66,6 +66,8 @@ struct LocalDerivationGoal : public DerivationGoal
Path chrootRootDir; Path chrootRootDir;
+ bool networked; + bool networked;
+ +
/* RAII object to delete the chroot directory. */ /**
std::shared_ptr<AutoDelete> autoDelChroot; * RAII object to delete the chroot directory.
*/