Skip to content

Commit

Permalink
Merge staging-next into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Apr 14, 2022
2 parents 003eb48 + f3803e3 commit 999a16c
Show file tree
Hide file tree
Showing 63 changed files with 971 additions and 448 deletions.
10 changes: 5 additions & 5 deletions doc/contributing/coding-conventions.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ Most of the time, these are the same. For instance, the package `e2fsprogs` has

There are a few naming guidelines:

- The `name` attribute _should_ be identical to the upstream package name.
- The `pname` attribute _should_ be identical to the upstream package name.

- The `name` attribute _must not_ contain uppercase letters — e.g., `"mplayer-1.0rc2"` instead of `"MPlayer-1.0rc2"`.
- The `pname` and the `version` attribute _must not_ contain uppercase letters — e.g., `"mplayer" instead of `"MPlayer"`.

- The version part of the `name` attribute _must_ start with a digit (following a dash) — e.g., `"hello-0.3.1rc2"`.
- The `version` attribute _must_ start with a digit e.g`"0.3.1rc2".

- If a package is not a release but a commit from a repository, then the version part of the name _must_ be the date of that (fetched) commit. The date _must_ be in `"YYYY-MM-DD"` format. Also append `"unstable"` to the name - e.g., `"pkgname-unstable-2014-09-23"`.
- If a package is not a release but a commit from a repository, then the `version` attribute _must_ be the date of that (fetched) commit. The date _must_ be in `"unstable-YYYY-MM-DD"` format.

- Dashes in the package name _should_ be preserved in new variable names, rather than converted to underscores or camel cased — e.g., `http-parser` instead of `http_parser` or `httpParser`. The hyphenated style is preferred in all three package names.
- Dashes in the package `pname` _should_ be preserved in new variable names, rather than converted to underscores or camel cased — e.g., `http-parser` instead of `http_parser` or `httpParser`. The hyphenated style is preferred in all three package names.

- If there are multiple versions of a package, this _should_ be reflected in the variable names in `all-packages.nix`, e.g. `json-c_0_9` and `json-c_0_11`. If there is an obvious “default” version, make an attribute like `json-c = json-c_0_9;`. See also [](#sec-versioning)

Expand Down
8 changes: 8 additions & 0 deletions nixos/doc/manual/man-nixos-rebuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,14 @@
(<replaceable>user@host</replaceable>). You can also set ssh options by
defining the <envar>NIX_SSHOPTS</envar> environment variable.
</para>

<para>
Note that <command>nixos-rebuild</command> honors the
<literal>nixpkgs.crossSystem</literal> setting of the given configuration
but disregards the true architecture of the target host. Hence the
<literal>nixpkgs.crossSystem</literal> setting has to match the target
platform or else activation will fail.
</para>
</listitem>
</varlistentry>

Expand Down
2 changes: 1 addition & 1 deletion nixos/lib/test-driver/test_driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __exit__(self, *_: Any) -> None:

def subtest(self, name: str) -> Iterator[None]:
"""Group logs under a given test name"""
with rootlog.nested(name):
with rootlog.nested("subtest: " + name):
try:
yield
return True
Expand Down
8 changes: 6 additions & 2 deletions nixos/lib/test-driver/test_driver/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from colorama import Style
from colorama import Style, Fore
from contextlib import contextmanager
from typing import Any, Dict, Iterator
from queue import Queue, Empty
Expand Down Expand Up @@ -81,7 +81,11 @@ def drain_log_queue(self) -> None:

@contextmanager
def nested(self, message: str, attributes: Dict[str, str] = {}) -> Iterator[None]:
self._eprint(self.maybe_prefix(message, attributes))
self._eprint(
self.maybe_prefix(
Style.BRIGHT + Fore.GREEN + message + Style.RESET_ALL, attributes
)
)

self.xml.startElement("nest", attrs={})
self.xml.startElement("head", attributes)
Expand Down
12 changes: 12 additions & 0 deletions nixos/modules/system/activation/switch-to-configuration.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#! @perl@/bin/perl

# Issue #166838 uncovered a situation in which a configuration not suitable
# for the target architecture caused a cryptic error message instead of
# a clean failure. Due to this mismatch, the perl interpreter in the shebang
# line wasn't able to be executed, causing this script to be misinterpreted
# as a shell script.
#
# Let's detect this situation to give a more meaningful error
# message. The following two lines are carefully written to be both valid Perl
# and Bash.
printf "Perl script erroneously interpreted as shell script,\ndoes target platform match nixpkgs.crossSystem platform?\n" && exit 1
if 0;

use strict;
use warnings;
use Config::IniFiles;
Expand Down
5 changes: 4 additions & 1 deletion nixos/modules/system/activation/top-level.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ let
${if config.boot.initrd.systemd.enable then ''
cp ${config.system.build.bootStage2} $out/prepare-root
substituteInPlace $out/prepare-root --subst-var-by systemConfig $out
ln -s "$systemd/lib/systemd/systemd" $out/init
# This must not be a symlink or the abs_path of the grub builder for the tests
# will resolve the symlink and we end up with a path that doesn't point to a
# system closure.
cp "$systemd/lib/systemd/systemd" $out/init
'' else ''
cp ${config.system.build.bootStage2} $out/init
substituteInPlace $out/init --subst-var-by systemConfig $out
Expand Down
3 changes: 3 additions & 0 deletions nixos/modules/system/boot/systemd/initrd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,8 @@ in {
];
};
};

boot.kernelParams = lib.mkIf (config.boot.resumeDevice != "") [ "resume=${config.boot.resumeDevice}" ];

};
}
33 changes: 27 additions & 6 deletions nixos/modules/tasks/lvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ in {
boot.vdo.enable = mkEnableOption "support for booting from VDOLVs";
};

options.boot.initrd.services.lvm.enable = (mkEnableOption "enable booting from LVM2 in the initrd") // {
visible = false;
};

config = mkMerge [
({
# minimal configuration file to make lvmconfig/lvm2-activation-generator happy
Expand All @@ -31,8 +35,13 @@ in {
environment.systemPackages = [ cfg.package ];
systemd.packages = [ cfg.package ];

# TODO: update once https://github.com/NixOS/nixpkgs/pull/93006 was merged
services.udev.packages = [ cfg.package.out ];

# We need lvm2 for the device-mapper rules
boot.initrd.services.udev.packages = lib.mkIf config.boot.initrd.services.lvm.enable [ cfg.package ];
# The device-mapper rules want to call tools from lvm2
boot.initrd.systemd.initrdBin = lib.mkIf config.boot.initrd.services.lvm.enable [ cfg.package ];
boot.initrd.services.udev.binPackages = lib.mkIf config.boot.initrd.services.lvm.enable [ cfg.package ];
})
(mkIf cfg.dmeventd.enable {
systemd.sockets."dm-event".wantedBy = [ "sockets.target" ];
Expand All @@ -47,13 +56,15 @@ in {
boot.initrd = {
kernelModules = [ "dm-snapshot" "dm-thin-pool" ];

extraUtilsCommands = ''
systemd.initrdBin = lib.mkIf config.boot.initrd.services.lvm.enable [ pkgs.thin-provisioning-tools ];

extraUtilsCommands = mkIf (!config.boot.initrd.systemd.enable) ''
for BIN in ${pkgs.thin-provisioning-tools}/bin/*; do
copy_bin_and_libs $BIN
done
'';

extraUtilsCommandsTest = ''
extraUtilsCommandsTest = mkIf (!config.boot.initrd.systemd.enable) ''
ls ${pkgs.thin-provisioning-tools}/bin/ | grep -v pdata_tools | while read BIN; do
$out/bin/$(basename $BIN) --help > /dev/null
done
Expand All @@ -71,13 +82,15 @@ in {
initrd = {
kernelModules = [ "kvdo" ];

extraUtilsCommands = ''
systemd.initrdBin = lib.mkIf config.boot.initrd.services.lvm.enable [ pkgs.vdo ];

extraUtilsCommands = mkIf (!config.boot.initrd.systemd.enable)''
ls ${pkgs.vdo}/bin/ | grep -v adaptLVMVDO | while read BIN; do
copy_bin_and_libs ${pkgs.vdo}/bin/$BIN
done
'';

extraUtilsCommandsTest = ''
extraUtilsCommandsTest = mkIf (!config.boot.initrd.systemd.enable)''
ls ${pkgs.vdo}/bin/ | grep -v adaptLVMVDO | while read BIN; do
$out/bin/$(basename $BIN) --help > /dev/null
done
Expand All @@ -91,7 +104,15 @@ in {
environment.systemPackages = [ pkgs.vdo ];
})
(mkIf (cfg.dmeventd.enable || cfg.boot.thin.enable) {
boot.initrd.preLVMCommands = ''
boot.initrd.systemd.contents."/etc/lvm/lvm.conf".text = optionalString (config.boot.initrd.services.lvm.enable && cfg.boot.thin.enable) (concatMapStringsSep "\n"
(bin: "global/${bin}_executable = /bin/${bin}")
[ "thin_check" "thin_dump" "thin_repair" "cache_check" "cache_dump" "cache_repair" ]
) + "\n" + optionalString cfg.dmeventd.enable ''
dmeventd/executable = /bin/false
activation/monitoring = 0
'';

boot.initrd.preLVMCommands = mkIf (!config.boot.initrd.systemd.enable) ''
mkdir -p /etc/lvm
cat << EOF >> /etc/lvm/lvm.conf
${optionalString cfg.boot.thin.enable (
Expand Down
3 changes: 2 additions & 1 deletion nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ in
# hibernation. This test happens to work on x86_64-linux but
# not on other platforms.
hibernate = handleTestOn ["x86_64-linux"] ./hibernate.nix {};
hibernate-systemd-stage-1 = handleTestOn ["x86_64-linux"] ./hibernate.nix { systemdStage1 = true; };
hitch = handleTest ./hitch {};
hledger-web = handleTest ./hledger-web.nix {};
hocker-fetchdocker = handleTest ./hocker-fetchdocker {};
Expand Down Expand Up @@ -365,7 +366,7 @@ in
nginx-variants = handleTest ./nginx-variants.nix {};
nifi = handleTestOn ["x86_64-linux"] ./web-apps/nifi.nix {};
nitter = handleTest ./nitter.nix {};
nix-ld = handleTest ./nix-ld {};
nix-ld = handleTest ./nix-ld.nix {};
nix-serve = handleTest ./nix-serve.nix {};
nix-serve-ssh = handleTest ./nix-serve-ssh.nix {};
nixops = handleTest ./nixops/default.nix {};
Expand Down
6 changes: 6 additions & 0 deletions nixos/tests/hibernate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{ system ? builtins.currentSystem
, config ? {}
, pkgs ? import ../.. { inherit system config; }
, systemdStage1 ? false
}:

with import ../lib/testing-python.nix { inherit system pkgs; };
Expand All @@ -29,6 +30,11 @@ let
"/".device = "/dev/vda2";
};
swapDevices = mkOverride 0 [ { device = "/dev/vda1"; } ];
boot.resumeDevice = mkIf systemdStage1 "/dev/vda1";
boot.initrd.systemd = mkIf systemdStage1 {
enable = true;
emergencyAccess = true;
};
};
installedSystem = (import ../lib/eval-config.nix {
inherit system;
Expand Down
20 changes: 19 additions & 1 deletion nixos/tests/lvm2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ let
thinpool = { test = callTest ./thinpool.nix; kernelFilter = lib.id; };
# we would like to test all versions, but the kernel module currently does not compile against the other versions
vdo = { test = callTest ./vdo.nix; kernelFilter = lib.filter (v: v == "5.15"); };


# systemd in stage 1
raid-sd-stage-1 = {
test = callTest ./systemd-stage-1.nix;
kernelFilter = lib.id;
flavour = "raid";
};
thinpool-sd-stage-1 = {
test = callTest ./systemd-stage-1.nix;
kernelFilter = lib.id;
flavour = "thinpool";
};
vdo-sd-stage-1 = {
test = callTest ./systemd-stage-1.nix;
kernelFilter = lib.filter (v: v == "5.15");
flavour = "vdo";
};
};
in
lib.listToAttrs (
Expand All @@ -20,7 +38,7 @@ lib.listToAttrs (
v' = lib.replaceStrings [ "." ] [ "_" ] version;
in
lib.flip lib.mapAttrsToList tests (name: t:
lib.nameValuePair "lvm-${name}-linux-${v'}" (lib.optionalAttrs (builtins.elem version (t.kernelFilter kernelVersionsToTest)) (t.test { kernelPackages = pkgs."linuxPackages_${v'}"; }))
lib.nameValuePair "lvm-${name}-linux-${v'}" (lib.optionalAttrs (builtins.elem version (t.kernelFilter kernelVersionsToTest)) (t.test ({ kernelPackages = pkgs."linuxPackages_${v'}"; } // builtins.removeAttrs t [ "test" "kernelFilter" ])))
)
)
)
Expand Down
104 changes: 104 additions & 0 deletions nixos/tests/lvm2/systemd-stage-1.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{ kernelPackages ? null, flavour }: let
preparationCode = {
raid = ''
machine.succeed("vgcreate test_vg /dev/vdc /dev/vdd")
machine.succeed("lvcreate -L 512M --type raid0 test_vg -n test_lv")
'';

thinpool = ''
machine.succeed("vgcreate test_vg /dev/vdc")
machine.succeed("lvcreate -L 512M -T test_vg/test_thin_pool")
machine.succeed("lvcreate -n test_lv -V 16G --thinpool test_thin_pool test_vg")
'';

vdo = ''
machine.succeed("vgcreate test_vg /dev/vdc")
machine.succeed("lvcreate --type vdo -n test_lv -L 6G -V 12G test_vg/vdo_pool_lv")
'';
}.${flavour};

extraConfig = {
raid = {
boot.initrd.kernelModules = [
"dm-raid"
"raid0"
];
};

thinpool = {
services.lvm = {
boot.thin.enable = true;
dmeventd.enable = true;
};
};

vdo = {
services.lvm = {
boot.vdo.enable = true;
dmeventd.enable = true;
};
};
}.${flavour};

extraCheck = {
raid = ''
"test_lv" in machine.succeed("lvs --select segtype=raid0")
'';

thinpool = ''
"test_lv" in machine.succeed("lvs --select segtype=thin-pool")
'';

vdo = ''
"test_lv" in machine.succeed("lvs --select segtype=vdo")
'';
}.${flavour};

in import ../make-test-python.nix ({ pkgs, ... }: {
name = "lvm2-${flavour}-systemd-stage-1";
meta.maintainers = with pkgs.lib.maintainers; [ das_j ];

nodes.machine = { pkgs, lib, ... }: {
imports = [ extraConfig ];
# Use systemd-boot
virtualisation = {
emptyDiskImages = [ 8192 8192 ];
useBootLoader = true;
useEFIBoot = true;
};
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

environment.systemPackages = with pkgs; [ e2fsprogs ]; # for mkfs.ext4
boot = {
initrd.systemd = {
enable = true;
emergencyAccess = true;
};
initrd.services.lvm.enable = true;
kernelPackages = lib.mkIf (kernelPackages != null) kernelPackages;
};

specialisation.boot-lvm.configuration.virtualisation.bootDevice = "/dev/test_vg/test_lv";
};

testScript = ''
machine.wait_for_unit("multi-user.target")
# Create a VG for the root
${preparationCode}
machine.succeed("mkfs.ext4 /dev/test_vg/test_lv")
machine.succeed("mkdir -p /mnt && mount /dev/test_vg/test_lv /mnt && echo hello > /mnt/test && umount /mnt")
# Boot from LVM
machine.succeed("bootctl set-default nixos-generation-1-specialisation-boot-lvm.conf")
machine.succeed("sync")
machine.crash()
machine.wait_for_unit("multi-user.target")
# Ensure we have successfully booted from LVM
assert "(initrd)" in machine.succeed("systemd-analyze") # booted with systemd in stage 1
assert "/dev/mapper/test_vg-test_lv on / type ext4" in machine.succeed("mount")
assert "hello" in machine.succeed("cat /test")
${extraCheck}
'';
})
4 changes: 4 additions & 0 deletions nixos/tests/mongodb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import ./make-test-python.nix ({ pkgs, ... }:
mongodb-3_6
mongodb-4_0
mongodb-4_2
mongodb-4_4
mongodb-5_0
];
};
};
Expand All @@ -48,6 +50,8 @@ import ./make-test-python.nix ({ pkgs, ... }:
+ runMongoDBTest pkgs.mongodb-3_6
+ runMongoDBTest pkgs.mongodb-4_0
+ runMongoDBTest pkgs.mongodb-4_2
+ runMongoDBTest pkgs.mongodb-4_4
+ runMongoDBTest pkgs.mongodb-5_0
+ ''
node.shutdown()
'';
Expand Down
10 changes: 3 additions & 7 deletions pkgs/applications/audio/ncspot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@

rustPlatform.buildRustPackage rec {
pname = "ncspot";
version = "0.9.5";
version = "0.9.7";

src = fetchFromGitHub {
owner = "hrkfdn";
repo = "ncspot";
rev = "v${version}";
sha256 = "sha256-HnP0dXKkMssDAhrsA99bTCVGdov9t5+1y8fJ+BWTM80=";
sha256 = "sha256-s2rWn6EK+io/yxQiWsWuXpqLOGd0F6ehWqVqgHBGZd0=";
};

# Upstream now only supports rust 1.58+, but this version is not yet available in nixpkgs.
# See https://github.com/hrkfdn/ncspot/issues/714
patches = [ ./rust_1_57_support.patch ];

cargoSha256 = "sha256-g6UMwirsSV+/NtFIfEZrz5h/OitPQcDeSawh7wq4TLI=";
cargoSha256 = "sha256-aorRy5j3VaOIibuHc6gf6HuB3g739T59vzbybehPirc=";

nativeBuildInputs = [ pkg-config ];

Expand Down
Loading

0 comments on commit 999a16c

Please sign in to comment.