summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/release-notes/rl-1909.xml49
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl5
-rw-r--r--nixos/modules/misc/nixops-autoluks.nix44
-rw-r--r--nixos/modules/misc/version.nix1
-rw-r--r--nixos/modules/module-list.nix2
-rw-r--r--nixos/modules/programs/captive-browser.nix122
-rw-r--r--nixos/modules/services/databases/cassandra.nix210
-rw-r--r--nixos/modules/services/hardware/80-net-setup-link.rules13
-rw-r--r--nixos/modules/services/hardware/udev.nix6
-rw-r--r--nixos/modules/services/misc/gitea.nix90
-rw-r--r--nixos/modules/services/networking/ssh/sshd.nix10
-rw-r--r--nixos/modules/services/web-servers/lighttpd/cgit.nix2
-rw-r--r--nixos/modules/system/boot/luksroot.nix1
-rw-r--r--nixos/modules/system/boot/networkd.nix2
-rw-r--r--nixos/modules/system/boot/systemd.nix5
-rw-r--r--nixos/modules/system/boot/timesyncd.nix9
-rw-r--r--nixos/modules/tasks/network-interfaces-systemd.nix11
-rw-r--r--nixos/modules/testing/test-instrumentation.nix3
-rw-r--r--nixos/modules/virtualisation/containers.nix32
-rw-r--r--nixos/tests/all-tests.nix2
-rw-r--r--nixos/tests/cassandra.nix96
-rw-r--r--nixos/tests/containers-imperative.nix21
-rw-r--r--nixos/tests/gitea.nix16
-rw-r--r--nixos/tests/installer.nix2
-rw-r--r--nixos/tests/radicale.nix2
-rw-r--r--nixos/tests/systemd-timesyncd.nix52
26 files changed, 664 insertions, 144 deletions
diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml
index 401778f38b9a..2a3e565a6f6a 100644
--- a/nixos/doc/manual/release-notes/rl-1909.xml
+++ b/nixos/doc/manual/release-notes/rl-1909.xml
@@ -137,6 +137,40 @@
</para>
</listitem>
<listitem>
+ <para>
+ The option <option>systemd.network.networks.&lt;name&gt;.routes.*.routeConfig.GatewayOnlink</option>
+ was renamed to <option>systemd.network.networks.&lt;name&gt;.routes.*.routeConfig.GatewayOnLink</option>
+ (capital <literal>L</literal>). This follows
+ <link xlink:href="https://github.com/systemd/systemd/commit/9cb8c5593443d24c19e40bfd4fc06d672f8c554c">
+ upstreams renaming
+ </link> of the setting.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ As of this release the NixOps feature <literal>autoLuks</literal> is deprecated. It no longer works
+ with our systemd version without manual intervention.
+ </para>
+ <para>
+ Whenever the usage of the module is detected the evaluation will fail with a message
+ explaining why and how to deal with the situation.
+ </para>
+ <para>
+ A new knob named <literal>nixops.enableDeprecatedAutoLuks</literal>
+ has been introduced to disable the eval failure and to acknowledge the notice was received and read.
+ If you plan on using the feature please note that it might break with subsequent updates.
+ </para>
+ <para>
+ Make sure you set the <literal>_netdev</literal> option for each of the file systems referring to block
+ devices provided by the autoLuks module. Not doing this might render the system in a
+ state where it doesn't boot anymore.
+ </para>
+ <para>
+ If you are actively using the <literal>autoLuks</literal> module please let us know in
+ <link xlink:href="https://github.com/NixOS/nixpkgs/issues/62211">issue #62211</link>.
+ </para>
+ </listitem>
+ <listitem>
<para>
The setopt declarations will be evaluated at the end of <literal>/etc/zshrc</literal>, so any code in <xref linkend="opt-programs.zsh.interactiveShellInit" />,
<xref linkend="opt-programs.zsh.loginShellInit" /> and <xref linkend="opt-programs.zsh.promptInit" /> may break if it relies on those options being set.
@@ -211,6 +245,20 @@
RuntimeDirectory and tmpfiles.
</para>
</listitem>
+ <listitem>
+ <para>
+ With the upgrade to systemd version 242 the <literal>systemd-timesyncd</literal>
+ service is no longer using <literal>DynamicUser=yes</literal>. In order for the
+ upgrade to work we rely on an activation script to move the state from the old
+ to the new directory. The older directory (prior <literal>19.09</literal>) was
+ <literal>/var/lib/private/systemd/timesync</literal>.
+ </para>
+ <para>
+ As long as the <literal>system.config.stateVersion</literal> is below
+ <literal>19.09</literal> the state folder will migrated to its proper location
+ (<literal>/var/lib/systemd/timesync</literal>), if required.
+ </para>
+ </listitem>
<listitem>
<para>
Since version 0.1.19, <literal>cargo-vendor</literal> honors package
@@ -221,7 +269,6 @@
vendored files for most Rust packages, the hash that use used to verify
the dependencies, <literal>cargoSha256</literal>, also changes.
</para>
-
<para>
The <literal>cargoSha256</literal> hashes of all in-tree derivations that
use <literal>buildRustPackage</literal> have been updated to reflect this
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index b7e5b99a9e01..0ccdac30d915 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -258,6 +258,11 @@ foreach my $path (glob "/sys/class/{block,mmc_host}/*") {
}
}
+# Add bcache module, if needed.
+my @bcacheDevices = glob("/dev/bcache*");
+if (scalar @bcacheDevices > 0) {
+ push @initrdAvailableKernelModules, "bcache";
+}
my $virt = `systemd-detect-virt`;
chomp $virt;
diff --git a/nixos/modules/misc/nixops-autoluks.nix b/nixos/modules/misc/nixops-autoluks.nix
new file mode 100644
index 000000000000..2153c6f975ad
--- /dev/null
+++ b/nixos/modules/misc/nixops-autoluks.nix
@@ -0,0 +1,44 @@
+{ config, options, lib, ... }:
+let
+ path = [ "deployment" "autoLuks" ];
+ hasAutoLuksOption = lib.hasAttrByPath path options;
+ hasAutoLuksConfig = lib.hasAttrByPath path config && (lib.attrByPath path {} config) != {};
+
+ inherit (config.nixops) enableDeprecatedAutoLuks;
+in {
+ options.nixops.enableDeprecatedAutoLuks = lib.mkEnableOption "Enable the deprecated NixOps AutoLuks module";
+
+ config = {
+ assertions = [
+ {
+ assertion = if hasAutoLuksConfig then hasAutoLuksConfig && enableDeprecatedAutoLuks else true;
+ message = ''
+ ⚠️ !!! WARNING !!! ⚠️
+
+ NixOps autoLuks is deprecated. The feature was never widely used and the maintenance did outgrow the benefit.
+ If you still want to use the module:
+ a) Please raise your voice in the issue tracking usage of the module:
+ https://github.com/NixOS/nixpkgs/issues/62211
+ b) make sure you set the `_netdev` option for each of the file
+ systems referring to block devices provided by the autoLuks module.
+
+ ⚠️ If you do not set the option your system will not boot anymore! ⚠️
+
+ {
+ fileSystems."/secret" = { options = [ "_netdev" ]; };
+ }
+
+ b) set the option >nixops.enableDeprecatedAutoLuks = true< to remove this error.
+
+
+ For more details read through the following resources:
+ - https://github.com/NixOS/nixops/pull/1156
+ - https://github.com/NixOS/nixpkgs/issues/47550
+ - https://github.com/NixOS/nixpkgs/issues/62211
+ - https://github.com/NixOS/nixpkgs/pull/61321
+ '';
+ }
+ ];
+ };
+
+}
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index c576cf4cb925..c9b374b6d7b1 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -95,6 +95,7 @@ in
PRETTY_NAME="NixOS ${cfg.version} (${cfg.codeName})"
LOGO="nix-snowflake"
HOME_URL="https://nixos.org/"
+ DOCUMENTATION_URL="https://nixos.org/nixos/manual/index.html"
SUPPORT_URL="https://nixos.org/nixos/support.html"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
'';
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index e29ba17ba86f..50e3078d9770 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -84,6 +84,7 @@
./misc/nixpkgs.nix
./misc/passthru.nix
./misc/version.nix
+ ./misc/nixops-autoluks.nix
./programs/adb.nix
./programs/atop.nix
./programs/autojump.nix
@@ -91,6 +92,7 @@
./programs/bcc.nix
./programs/blcr.nix
./programs/browserpass.nix
+ ./programs/captive-browser.nix
./programs/ccache.nix
./programs/cdemu.nix
./programs/chromium.nix
diff --git a/nixos/modules/programs/captive-browser.nix b/nixos/modules/programs/captive-browser.nix
new file mode 100644
index 000000000000..55d474e5c9db
--- /dev/null
+++ b/nixos/modules/programs/captive-browser.nix
@@ -0,0 +1,122 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.programs.captive-browser;
+in
+{
+ ###### interface
+
+ options = {
+ programs.captive-browser = {
+ enable = mkEnableOption "captive browser";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.captive-browser;
+ defaultText = "pkgs.captive-browser";
+ description = "Which package to use for captive-browser";
+ };
+
+ interface = mkOption {
+ type = types.str;
+ description = "your public network interface (wlp3s0, wlan0, eth0, ...)";
+ };
+
+ # the options below are the same as in "captive-browser.toml"
+ browser = mkOption {
+ type = types.str;
+ default = concatStringsSep " " [ ''${pkgs.chromium}/bin/chromium''
+ ''--user-data-dir=$HOME/.chromium-captive''
+ ''--proxy-server="socks5://$PROXY"''
+ ''--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"''
+ ''--no-first-run''
+ ''--new-window''
+ ''--incognito''
+ ''http://cache.nixos.org/''
+ ];
+ description = ''
+ The shell (/bin/sh) command executed once the proxy starts.
+ When browser exits, the proxy exits. An extra env var PROXY is available.
+
+ Here, we use a separate Chrome instance in Incognito mode, so that
+ it can run (and be waited for) alongside the default one, and that
+ it maintains no state across runs. To configure this browser open a
+ normal window in it, settings will be preserved.
+
+ @volth: chromium is to open a plain HTTP (not HTTPS nor redirect to HTTPS!) website.
+ upstream uses http://example.com but I have seen captive portals whose DNS server resolves "example.com" to 127.0.0.1
+ '';
+ };
+
+ dhcp-dns = mkOption {
+ type = types.str;
+ description = ''
+ The shell (/bin/sh) command executed to obtain the DHCP
+ DNS server address. The first match of an IPv4 regex is used.
+ IPv4 only, because let's be real, it's a captive portal.
+ '';
+ };
+
+ socks5-addr = mkOption {
+ type = types.str;
+ default = "localhost:1666";
+ description = ''the listen address for the SOCKS5 proxy server'';
+ };
+
+ bindInterface = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Binds <package>captive-browser</package> to the network interface declared in
+ <literal>cfg.interface</literal>. This can be used to avoid collisions
+ with private subnets.
+ '';
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ programs.captive-browser.dhcp-dns = mkOptionDefault (
+ if config.networking.networkmanager.enable then
+ "${pkgs.networkmanager}/bin/nmcli dev show ${escapeShellArg cfg.interface} | ${pkgs.gnugrep}/bin/fgrep IP4.DNS"
+ else if config.networking.dhcpcd.enable then
+ "${pkgs.dhcpcd}/bin/dhcpcd -U ${escapeShellArg cfg.interface} | ${pkgs.gnugrep}/bin/fgrep domain_name_servers"
+ else if config.networking.useNetworkd then
+ "${cfg.package}/bin/systemd-networkd-dns ${escapeShellArg cfg.interface}"
+ else
+ "${config.security.wrapperDir}/udhcpc --quit --now -f -i ${escapeShellArg cfg.interface} -O dns --script ${
+ pkgs.writeScript "udhcp-script" ''
+ #!/bin/sh
+ if [ "$1" = bound ]; then
+ echo "$dns"
+ fi
+ ''}"
+ );
+
+ security.wrappers.udhcpc = {
+ capabilities = "cap_net_raw+p";
+ source = "${pkgs.busybox}/bin/udhcpc";
+ };
+
+ security.wrappers.captive-browser = {
+ capabilities = "cap_net_raw+p";
+ source = pkgs.writeScript "captive-browser" ''
+ #!${pkgs.bash}/bin/bash
+ export XDG_CONFIG_HOME=${pkgs.writeTextDir "captive-browser.toml" ''
+ browser = """${cfg.browser}"""
+ dhcp-dns = """${cfg.dhcp-dns}"""
+ socks5-addr = """${cfg.socks5-addr}"""
+ ${optionalString cfg.bindInterface ''
+ bind-device = """${cfg.interface}"""
+ ''}
+ ''}
+ exec ${cfg.package}/bin/captive-browser
+ '';
+ };
+ };
+}
diff --git a/nixos/modules/services/databases/cassandra.nix b/nixos/modules/services/databases/cassandra.nix
index 688938868020..e2ea9fcda6b0 100644
--- a/nixos/modules/services/databases/cassandra.nix
+++ b/nixos/modules/services/databases/cassandra.nix
@@ -8,18 +8,21 @@ let
cassandraConfig = flip recursiveUpdate cfg.extraConfig
({ commitlog_sync = "batch";
commitlog_sync_batch_window_in_ms = 2;
+ start_native_transport = cfg.allowClients;
+ cluster_name = cfg.clusterName;
partitioner = "org.apache.cassandra.dht.Murmur3Partitioner";
endpoint_snitch = "SimpleSnitch";
- seed_provider =
- [{ class_name = "org.apache.cassandra.locator.SimpleSeedProvider";
- parameters = [ { seeds = "127.0.0.1"; } ];
- }];
data_file_directories = [ "${cfg.homeDir}/data" ];
commitlog_directory = "${cfg.homeDir}/commitlog";
saved_caches_directory = "${cfg.homeDir}/saved_caches";
- } // (if builtins.compareVersions cfg.package.version "3" >= 0
- then { hints_directory = "${cfg.homeDir}/hints"; }
- else {})
+ } // (lib.optionalAttrs (cfg.seedAddresses != []) {
+ seed_provider = [{
+ class_name = "org.apache.cassandra.locator.SimpleSeedProvider";
+ parameters = [ { seeds = concatStringsSep "," cfg.seedAddresses; } ];
+ }];
+ }) // (lib.optionalAttrs (lib.versionAtLeast cfg.package.version "3") {
+ hints_directory = "${cfg.homeDir}/hints";
+ })
);
cassandraConfigWithAddresses = cassandraConfig //
( if cfg.listenAddress == null
@@ -39,15 +42,42 @@ let
mkdir -p "$out"
echo "$cassandraYaml" > "$out/cassandra.yaml"
- ln -s "$cassandraEnvPkg" "$out/cassandra-env.sh"
ln -s "$cassandraLogbackConfig" "$out/logback.xml"
+
+ cp "$cassandraEnvPkg" "$out/cassandra-env.sh"
+
+ # Delete default JMX Port, otherwise we can't set it using env variable
+ sed -i '/JMX_PORT="7199"/d' "$out/cassandra-env.sh"
+
+ # Delete default password file
+ sed -i '/-Dcom.sun.management.jmxremote.password.file=\/etc\/cassandra\/jmxremote.password/d' "$out/cassandra-env.sh"
'';
};
+ defaultJmxRolesFile = builtins.foldl'
+ (left: right: left + right) ""
+ (map (role: "${role.username} ${role.password}") cfg.jmxRoles);
+ fullJvmOptions = cfg.jvmOpts
+ ++ lib.optionals (cfg.jmxRoles != []) [
+ "-Dcom.sun.management.jmxremote.authenticate=true"
+ "-Dcom.sun.management.jmxremote.password.file=${cfg.jmxRolesFile}"
+ ]
+ ++ lib.optionals cfg.remoteJmx [
+ "-Djava.rmi.server.hostname=${cfg.rpcAddress}"
+ ];
in {
options.services.cassandra = {
enable = mkEnableOption ''
Apache Cassandra – Scalable and highly available database.
'';
+ clusterName = mkOption {
+ type = types.str;
+ default = "NixOS Test Cluster";
+ description = ''
+ The name of the cluster.
+ This setting prevents nodes in one logical cluster from joining
+ another. All nodes in a cluster must have the same value.
+ '';
+ };
user = mkOption {
type = types.str;
default = defaultUser;
@@ -162,6 +192,28 @@ in {
XML logback configuration for cassandra
'';
};
+ seedAddresses = mkOption {
+ type = types.listOf types.str;
+ default = [ "127.0.0.1" ];
+ description = ''
+ The addresses of hosts designated as contact points in the cluster. A
+ joining node contacts one of the nodes in the seeds list to learn the
+ topology of the ring.
+ Set to 127.0.0.1 for a single node cluster.
+ '';
+ };
+ allowClients = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Enables or disables the native transport server (CQL binary protocol).
+ This server uses the same address as the <literal>rpcAddress</literal>,
+ but the port it uses is not <literal>rpc_port</literal> but
+ <literal>native_transport_port</literal>. See the official Cassandra
+ docs for more information on these variables and set them using
+ <literal>extraConfig</literal>.
+ '';
+ };
extraConfig = mkOption {
type = types.attrs;
default = {};
@@ -178,11 +230,11 @@ in {
example = literalExample "null";
description = ''
Set the interval how often full repairs are run, i.e.
- `nodetool repair --full` is executed. See
+ <literal>nodetool repair --full</literal> is executed. See
https://cassandra.apache.org/doc/latest/operating/repair.html
for more information.
- Set to `null` to disable full repairs.
+ Set to <literal>null</literal> to disable full repairs.
'';
};
fullRepairOptions = mkOption {
@@ -199,11 +251,11 @@ in {
example = literalExample "null";
description = ''
Set the interval how often incremental repairs are run, i.e.
- `nodetool repair` is executed. See
+ <literal>nodetool repair</literal> is executed. See
https://cassandra.apache.org/doc/latest/operating/repair.html
for more information.
- Set to `null` to disable incremental repairs.
+ Set to <literal>null</literal> to disable incremental repairs.
'';
};
incrementalRepairOptions = mkOption {
@@ -214,20 +266,135 @@ in {
Options passed through to the incremental repair command.
'';
};
+ maxHeapSize = mkOption {
+ type = types.nullOr types.string;
+ default = null;
+ example = "4G";
+ description = ''
+ Must be left blank or set together with heapNewSize.
+ If left blank a sensible value for the available amount of RAM and CPU
+ cores is calculated.
+
+ Override to set the amount of memory to allocate to the JVM at
+ start-up. For production use you may wish to adjust this for your
+ environment. MAX_HEAP_SIZE is the total amount of memory dedicated
+ to the Java heap. HEAP_NEWSIZE refers to the size of the young
+ generation.
+
+ The main trade-off for the young generation is that the larger it
+ is, the longer GC pause times will be. The shorter it is, the more
+ expensive GC will be (usually).
+ '';
+ };
+ heapNewSize = mkOption {
+ type = types.nullOr types.string;
+ default = null;
+ example = "800M";
+ description = ''
+ Must be left blank or set together with heapNewSize.
+ If left blank a sensible value for the available amount of RAM and CPU
+ cores is calculated.
+
+ Override to set the amount of memory to allocate to the JVM at
+ start-up. For production use you may wish to adjust this for your
+ environment. HEAP_NEWSIZE refers to the size of the young
+ generation.
+
+ The main trade-off for the young generation is that the larger it
+ is, the longer GC pause times will be. The shorter it is, the more
+ expensive GC will be (usually).
+
+ The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause
+ times. If in doubt, and if you do not particularly want to tweak, go with
+ 100 MB per physical CPU core.
+ '';
+ };
+ mallocArenaMax = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ example = 4;
+ description = ''
+ Set this to control the amount of arenas per-thread in glibc.
+ '';
+ };
+ remoteJmx = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Cassandra ships with JMX accessible *only* from localhost.
+ To enable remote JMX connections set to true.
+
+ Be sure to also enable authentication and/or TLS.
+ See: https://wiki.apache.org/cassandra/JmxSecurity
+ '';
+ };
+ jmxPort = mkOption {
+ type = types.int;
+ default = 7199;
+ description = ''
+ Specifies the default port over which Cassandra will be available for
+ JMX connections.
+ For security reasons, you should not expose this port to the internet.
+ Firewall it if needed.
+ '';
+ };
+ jmxRoles = mkOption {
+ default = [];
+ description = ''
+ Roles that are allowed to access the JMX (e.g. nodetool)
+ BEWARE: The passwords will be stored world readable in the nix-store.
+ It's recommended to use your own protected file using
+ <literal>jmxRolesFile</literal>
+
+ Doesn't work in versions older than 3.11 because they don't like that
+ it's world readable.
+ '';
+ type = types.listOf (types.submodule {
+ options = {
+ username = mkOption {
+ type = types.string;
+ description = "Username for JMX";
+ };
+ password = mkOption {
+ type = types.string;
+ description = "Password for JMX";
+ };
+ };
+ });
+ };
+ jmxRolesFile = mkOption {
+ type = types.nullOr types.path;
+ default = if (lib.versionAtLeast cfg.package.version "3.11")
+ then pkgs.writeText "jmx-roles-file" defaultJmxRolesFile
+ else null;
+ example = "/var/lib/cassandra/jmx.password";
+ description = ''
+ Specify your own jmx roles file.
+
+ Make sure the permissions forbid "others" from reading the file if
+ you're using Cassandra below version 3.11.
+ '';
+ };
};
config = mkIf cfg.enable {
assertions =
- [ { assertion =
- (cfg.listenAddress == null || cfg.listenInterface == null)
- && !(cfg.listenAddress == null && cfg.listenInterface == null);
+ [ { assertion = (cfg.listenAddress == null) != (cfg.listenInterface == null);
message = "You have to set either listenAddress or listenInterface";
}
- { assertion =
- (cfg.rpcAddress == null || cfg.rpcInterface == null)
- && !(cfg.rpcAddress == null && cfg.rpcInterface == null);
+ { assertion = (cfg.rpcAddress == null) != (cfg.rpcInterface == null);
message = "You have to set either rpcAddress or rpcInterface";
}
+ { assertion = (cfg.maxHeapSize == null) == (cfg.heapNewSize == null);
+ message = "If you set either of maxHeapSize or heapNewSize you have to set both";
+ }
+ { assertion = cfg.remoteJmx -> cfg.jmxRolesFile != null;
+ message = ''
+ If you want JMX available remotely you need to set a password using
+ <literal>jmxRoles</literal> or <literal>jmxRolesFile</literal> if
+ using Cassandra older than v3.11.
+ '';
+ }
];
users = mkIf (cfg.user == defaultUser) {
extraUsers."${defaultUser}" =
@@ -245,7 +412,12 @@ in {
after = [ "network.target" ];
environment =
{ CASSANDRA_CONF = "${cassandraEtc}";
- JVM_OPTS = builtins.concatStringsSep " " cfg.jvmOpts;
+ JVM_OPTS = builtins.concatStringsSep " " fullJvmOptions;
+ MAX_HEAP_SIZE = toString cfg.maxHeapSize;
+ HEAP_NEWSIZE = toString cfg.heapNewSize;
+ MALLOC_ARENA_MAX = toString cfg.mallocArenaMax;
+ LOCAL_JMX = if cfg.remoteJmx then "no" else "yes";
+ JMX_PORT = toString cfg.jmxPort;
};
wantedBy = [ "multi-user.target" ];
serviceConfig =
diff --git a/nixos/modules/services/hardware/80-net-setup-link.rules b/nixos/modules/services/hardware/80-net-setup-link.rules
deleted file mode 100644
index 18547f170a3f..000000000000
--- a/nixos/modules/services/hardware/80-net-setup-link.rules
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copied from systemd 203.
-ACTION=="remove", GOTO="net_name_slot_end"
-SUBSYSTEM!="net", GOTO="net_name_slot_end"
-NAME!="", GOTO="net_name_slot_end"
-
-IMPORT{cmdline}="net.ifnames"
-ENV{net.ifnames}=="0", GOTO="net_name_slot_end"
-
-NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
-NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
-NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
-
-LABEL="net_name_slot_end"
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 0266286aaacf..cb2f1e6621ae 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -116,10 +116,6 @@ let
exit 1
fi
- ${optionalString config.networking.usePredictableInterfaceNames ''
- cp ${./80-net-setup-link.rules} $out/80-net-setup-link.rules
- ''}
-
# If auto-configuration is disabled, then remove
# udev's 80-drivers.rules file, which contains rules for
# automatically calling modprobe.
@@ -282,6 +278,8 @@ in
services.udev.path = [ pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.utillinux udev ];
+ boot.kernelParams = mkIf (!config.networking.usePredictableInterfaceNames) [ "net.ifnames=0" ];
+
environment.etc =
[ { source = udevRules;
target = "udev/rules.d";
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index 6fd4183bd6b4..7daa2dd0d4cc 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -159,7 +159,8 @@ in
socket = mkOption {
type = types.nullOr types.path;
- default = null;
+ default = if (cfg.database.createDatabase && usePostgresql) then "/run/postgresql" else if (cfg.database.createDatabase && useMysql) then "/run/mysqld/mysqld.sock" else null;
+ defaultText = "null";
example = "/run/mysqld/mysqld.sock";
description = "Path to the unix socket file to use for authentication.";
};
@@ -173,10 +174,7 @@ in
createDatabase = mkOption {
type = types.bool;
default = true;
- description = ''
- Whether to create a local postgresql database automatically.
- This only applies if database type "postgres" is selected.
- '';
+ description = "Whether to create a local database automatically.";
};
};
@@ -277,7 +275,46 @@ in
};
config = mkIf cfg.enable {
- services.postgresql.enable = mkIf usePostgresql (mkDefault true);
+ assertions = [
+ { assertion = cfg.database.createDatabase -> cfg.database.user == cfg.user;
+ message = "services.gitea.database.user must match services.gitea.user if the database is to be automatically provisioned";
+ }
+ ];
+
+ services.postgresql = optionalAttrs (usePostgresql && cfg.database.createDatabase) {
+ enable = mkDefault true;
+
+ ensureDatabases = [ cfg.database.name ];
+ ensureUsers = [
+ { name = cfg.database.user;
+ ensurePermissions = { "DATABASE ${cfg.database.name}" = "ALL PRIVILEGES"; };
+ }
+ ];
+ };
+
+ services.mysql = optionalAttrs (useMysql && cfg.database.createDatabase) {
+ enable = mkDefault true;
+ package = mkDefault pkgs.mariadb;
+
+ ensureDatabases = [ cfg.database.name ];
+ ensureUsers = [
+ { name = cfg.database.user;
+ ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; };
+ }
+ ];
+ };
+