nixbld: NixOS 22.05
This commit is contained in:
parent
cb75072f15
commit
5354daf585
@ -21,7 +21,7 @@ in
|
||||
Group = "afws";
|
||||
ExecStart = "${afws}/bin/afws_server";
|
||||
};
|
||||
path = [ pkgs.nix_2_4 pkgs.git ];
|
||||
path = [ pkgs.git ];
|
||||
};
|
||||
|
||||
users.users.afws = {
|
||||
|
@ -218,7 +218,7 @@ in
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget vim git file lm_sensors acpi pciutils psmisc telnet nixopsUnstable
|
||||
wget vim git file lm_sensors acpi pciutils psmisc nixopsUnstable
|
||||
irssi tmux usbutils imagemagick jq zip unzip
|
||||
iw
|
||||
nvme-cli
|
||||
@ -329,13 +329,11 @@ in
|
||||
boot.kernel.sysctl."kernel.dmesg_restrict" = true;
|
||||
services.udev.packages = [ pkgs.sane-backends ];
|
||||
|
||||
nix.package = pkgs.nix_2_4;
|
||||
nix.maxJobs = 10;
|
||||
nix.nrBuildUsers = 64;
|
||||
nix.trustedUsers = ["sb"];
|
||||
services.hydra = {
|
||||
enable = true;
|
||||
package = pkgs.hydra-unstable;
|
||||
useSubstitutes = true;
|
||||
hydraURL = "https://nixbld.m-labs.hk";
|
||||
notificationSender = "hydra@m-labs.hk";
|
||||
@ -438,6 +436,7 @@ in
|
||||
|
||||
nix.extraOptions = ''
|
||||
secret-key-files = /etc/nixos/secret/nixbld.m-labs.hk-1
|
||||
experimental-features = nix-command flakes ca-derivations impure-derivations
|
||||
'';
|
||||
nix.sandboxPaths = ["/opt"];
|
||||
|
||||
@ -498,13 +497,7 @@ in
|
||||
};
|
||||
|
||||
nixpkgs.config.packageOverrides = super: let self = super.pkgs; in {
|
||||
nix_2_4 = super.nix_2_4.overrideAttrs(oa: {
|
||||
patches = oa.patches or [] ++ [ ./nix-3-networked-derivations.patch ];
|
||||
});
|
||||
nixUnstable = super.nixUnstable.overrideAttrs(oa: {
|
||||
patches = oa.patches or [] ++ [ ./nix-3-networked-derivations.patch ];
|
||||
});
|
||||
hydra-unstable = super.hydra-unstable.overrideAttrs(oa: {
|
||||
hydra_unstable = super.hydra_unstable.overrideAttrs(oa: {
|
||||
patches = oa.patches or [] ++ [
|
||||
./hydra-conda.patch
|
||||
./hydra-msys2.patch
|
||||
@ -512,6 +505,7 @@ in
|
||||
./hydra-hack-allowed-uris.patch # work around https://github.com/NixOS/nix/issues/5039
|
||||
];
|
||||
hydraPath = oa.hydraPath + ":" + super.lib.makeBinPath [ super.jq ];
|
||||
doCheck = false; # FIXME: ldap tests fail on hydra rebuild, seems unrelated to patches above.
|
||||
});
|
||||
matterbridge = super.matterbridge.overrideAttrs(oa: {
|
||||
patches = oa.patches or [] ++ [ ./matterbridge-disable-github.patch ];
|
||||
@ -527,7 +521,7 @@ in
|
||||
};
|
||||
|
||||
security.acme.acceptTerms = true;
|
||||
security.acme.email = "sb" + "@m-labs.hk";
|
||||
security.acme.defaults.email = "sb" + "@m-labs.hk";
|
||||
security.acme.certs = {
|
||||
"nixbld.m-labs.hk" = {
|
||||
group = "nginx";
|
||||
|
@ -1,82 +0,0 @@
|
||||
diff -Naur /nix/store/32wd1lrf55ymaz1aysrqffpxfgkwl6m4-source/src/libstore/build/local-derivation-goal.cc nix3/src/libstore/build/local-derivation-goal.cc
|
||||
--- /nix/store/32wd1lrf55ymaz1aysrqffpxfgkwl6m4-source/src/libstore/build/local-derivation-goal.cc 1970-01-01 08:00:01.000000000 +0800
|
||||
+++ nix3/src/libstore/build/local-derivation-goal.cc 2021-04-24 16:29:52.493166702 +0800
|
||||
@@ -395,6 +395,8 @@
|
||||
additionalSandboxProfile = parsedDrv->getStringAttr("__sandboxProfile").value_or("");
|
||||
#endif
|
||||
|
||||
+ networked = parsedDrv->getBoolAttr("__networked");
|
||||
+
|
||||
/* Are we doing a chroot build? */
|
||||
{
|
||||
auto noChroot = parsedDrv->getBoolAttr("__noChroot");
|
||||
@@ -412,7 +414,7 @@
|
||||
else if (settings.sandboxMode == smDisabled)
|
||||
useChroot = false;
|
||||
else if (settings.sandboxMode == smRelaxed)
|
||||
- useChroot = !(derivationIsImpure(derivationType)) && !noChroot;
|
||||
+ useChroot = !allowNetwork() && !(derivationIsImpure(derivationType)) && !noChroot;
|
||||
}
|
||||
|
||||
auto & localStore = getLocalStore();
|
||||
@@ -623,7 +625,7 @@
|
||||
"nogroup:x:65534:\n", sandboxGid()));
|
||||
|
||||
/* Create /etc/hosts with localhost entry. */
|
||||
- if (!(derivationIsImpure(derivationType)))
|
||||
+ if (!allowNetwork() && !(derivationIsImpure(derivationType)))
|
||||
writeFile(chrootRootDir + "/etc/hosts", "127.0.0.1 localhost\n::1 localhost\n");
|
||||
|
||||
/* Make the closure of the inputs available in the chroot,
|
||||
@@ -810,7 +812,7 @@
|
||||
us.
|
||||
*/
|
||||
|
||||
- if (!(derivationIsImpure(derivationType)))
|
||||
+ if (!allowNetwork() && !(derivationIsImpure(derivationType)))
|
||||
privateNetwork = true;
|
||||
|
||||
userNamespaceSync.create();
|
||||
@@ -1066,7 +1068,7 @@
|
||||
to the builder is generally impure, but the output of
|
||||
fixed-output derivations is by definition pure (since we
|
||||
already know the cryptographic hash of the output). */
|
||||
- if (derivationIsImpure(derivationType)) {
|
||||
+ if (allowNetwork() || derivationIsImpure(derivationType)) {
|
||||
for (auto & i : parsedDrv->getStringsAttr("impureEnvVars").value_or(Strings()))
|
||||
env[i] = getEnv(i).value_or("");
|
||||
}
|
||||
@@ -1702,7 +1704,7 @@
|
||||
/* Fixed-output derivations typically need to access the
|
||||
network, so give them access to /etc/resolv.conf and so
|
||||
on. */
|
||||
- if (derivationIsImpure(derivationType)) {
|
||||
+ if (allowNetwork() || derivationIsImpure(derivationType)) {
|
||||
// Only use nss functions to resolve hosts and
|
||||
// services. Don’t use it for anything else that may
|
||||
// be configured for this system. This limits the
|
||||
@@ -1943,7 +1945,7 @@
|
||||
|
||||
sandboxProfile += "(import \"sandbox-defaults.sb\")\n";
|
||||
|
||||
- if (derivationIsImpure(derivationType))
|
||||
+ if (allowNetwork() || derivationIsImpure(derivationType))
|
||||
sandboxProfile += "(import \"sandbox-network.sb\")\n";
|
||||
|
||||
/* Add the output paths we'll use at build-time to the chroot */
|
||||
diff -Naur /nix/store/32wd1lrf55ymaz1aysrqffpxfgkwl6m4-source/src/libstore/build/local-derivation-goal.hh nix3/src/libstore/build/local-derivation-goal.hh
|
||||
--- /nix/store/32wd1lrf55ymaz1aysrqffpxfgkwl6m4-source/src/libstore/build/local-derivation-goal.hh 1970-01-01 08:00:01.000000000 +0800
|
||||
+++ nix3/src/libstore/build/local-derivation-goal.hh 2021-04-24 16:35:23.060968488 +0800
|
||||
@@ -40,6 +40,12 @@
|
||||
|
||||
Path chrootRootDir;
|
||||
|
||||
+ bool networked;
|
||||
+ bool allowNetwork()
|
||||
+ {
|
||||
+ return derivationIsFixed(drv->type()) || networked;
|
||||
+ }
|
||||
+
|
||||
/* RAII object to delete the chroot directory. */
|
||||
std::shared_ptr<AutoDelete> autoDelChroot;
|
||||
|
Loading…
Reference in New Issue
Block a user