Merge branch 'master' into flip-map-foreach

This commit is contained in:
Danylo Hlynskyi
2019-08-05 14:09:28 +03:00
committed by GitHub
1893 changed files with 176030 additions and 219950 deletions
+1
View File
@@ -18,6 +18,7 @@ in
boot.initrd.extraUtilsCommands = mkIf inInitrd
''
copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/fsck.xfs
copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/xfs_repair
'';
# Trick just to set 'sh' after the extraUtils nuke-refs.
+31 -8
View File
@@ -1,8 +1,6 @@
{ config, lib, pkgs, utils, ... }:
#
# todo:
# - crontab for scrubs, etc
# - zfs tunables
# TODO: zfs tunables
with utils;
with lib;
@@ -13,6 +11,7 @@ let
cfgSnapshots = config.services.zfs.autoSnapshot;
cfgSnapFlags = cfgSnapshots.flags;
cfgScrub = config.services.zfs.autoScrub;
cfgTrim = config.services.zfs.trim;
inInitrd = any (fs: fs == "zfs") config.boot.initrd.supportedFilesystems;
inSystem = any (fs: fs == "zfs") config.boot.supportedFilesystems;
@@ -268,14 +267,26 @@ in
};
};
services.zfs.autoScrub = {
enable = mkOption {
default = false;
type = types.bool;
services.zfs.trim = {
enable = mkEnableOption "Enables periodic TRIM on all ZFS pools.";
interval = mkOption {
default = "weekly";
type = types.str;
example = "daily";
description = ''
Enables periodic scrubbing of ZFS pools.
How often we run trim. For most desktop and server systems
a sufficient trimming frequency is once a week.
The format is described in
<citerefentry><refentrytitle>systemd.time</refentrytitle>
<manvolnum>7</manvolnum></citerefentry>.
'';
};
};
services.zfs.autoScrub = {
enable = mkEnableOption "Enables periodic scrubbing of ZFS pools.";
interval = mkOption {
default = "Sun, 02:00";
@@ -535,5 +546,17 @@ in
};
};
})
(mkIf cfgTrim.enable {
systemd.services.zpool-trim = {
description = "ZFS pools trim";
after = [ "zfs-import.target" ];
path = [ packages.zfsUser ];
startAt = cfgTrim.interval;
script = ''
zpool list -H -o name | xargs -n1 zpool trim
'';
};
})
];
}
@@ -103,7 +103,7 @@ let
script =
''
${optionalString (!config.environment.etc?"resolv.conf") ''
${optionalString config.networking.resolvconf.enable ''
# Set the static DNS configuration, if given.
${pkgs.openresolv}/sbin/resolvconf -m 1 -a static <<EOF
${optionalString (cfg.nameservers != [] && cfg.domain != null) ''
+19 -4
View File
@@ -1017,7 +1017,6 @@ in
pkgs.iproute
pkgs.iputils
pkgs.nettools
pkgs.openresolv
]
++ optionals config.networking.wireless.enable [
pkgs.wirelesstools # FIXME: obsolete?
@@ -1087,7 +1086,24 @@ in
virtualisation.vswitch = mkIf (cfg.vswitches != { }) { enable = true; };
services.udev.packages = mkIf (cfg.wlanInterfaces != {}) [
services.udev.packages = [
(pkgs.writeTextFile rec {
name = "ipv6-privacy-extensions.rules";
destination = "/etc/udev/rules.d/98-${name}";
text = ''
# enable and prefer IPv6 privacy addresses by default
ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.procps}/bin/sysctl net.ipv6.conf.%k.use_tempaddr=2"
'';
})
(pkgs.writeTextFile rec {
name = "ipv6-privacy-extensions.rules";
destination = "/etc/udev/rules.d/99-${name}";
text = concatMapStrings (i: ''
# enable IPv6 privacy addresses but prefer EUI-64 addresses for ${i.name}
ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.procps}/bin/sysctl net.ipv6.conf.${i.name}.use_tempaddr=1"
'') (filter (i: !i.preferTempAddress) interfaces);
})
] ++ lib.optional (cfg.wlanInterfaces != {})
(pkgs.writeTextFile {
name = "99-zzz-40-wlanInterfaces.rules";
destination = "/etc/udev/rules.d/99-zzz-40-wlanInterfaces.rules";
@@ -1161,8 +1177,7 @@ in
# Generate the same systemd events for both 'add' and 'move' udev events.
ACTION=="move", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", NAME=="${device}", ${systemdAttrs curInterface._iName}
'');
}) ];
});
};
}