diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-19 09:00:36 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-19 09:00:36 +0100 |
commit | 9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158 (patch) | |
tree | ec26979beba499c597f55768464697f20729a96e /nixos | |
parent | db0211c6bc16827a7bcc23f807c6b3703b1452a5 (diff) | |
parent | 911d1853ca990a7af6725105e7cda8c24cac025f (diff) | |
download | nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.tar nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.tar.gz nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.tar.bz2 nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.tar.lz nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.tar.xz nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.tar.zst nixlib-9ab61ab8e2c5b7a40f2f0f8a044e6c8d15d10158.zip |
Merge staging-next into staging
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/make-iso9660-image.sh | 5 | ||||
-rw-r--r-- | nixos/lib/testing.nix | 20 | ||||
-rw-r--r-- | nixos/modules/config/appstream.nix | 25 | ||||
-rw-r--r-- | nixos/modules/config/xdg/sounds.nix | 22 | ||||
-rw-r--r-- | nixos/modules/hardware/bladeRF.nix | 28 | ||||
-rw-r--r-- | nixos/modules/installer/cd-dvd/iso-image.nix | 78 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 3 | ||||
-rw-r--r-- | nixos/modules/programs/bash/bash.nix | 7 | ||||
-rw-r--r-- | nixos/modules/programs/zsh/oh-my-zsh.xml | 8 | ||||
-rw-r--r-- | nixos/modules/services/hardware/bluetooth.nix | 7 | ||||
-rw-r--r-- | nixos/modules/services/networking/prosody.nix | 1 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/clamav.nix | 37 |
13 files changed, 167 insertions, 75 deletions
diff --git a/nixos/lib/make-iso9660-image.sh b/nixos/lib/make-iso9660-image.sh index 45cdef1ef4df..b7b1ab52a637 100644 --- a/nixos/lib/make-iso9660-image.sh +++ b/nixos/lib/make-iso9660-image.sh @@ -47,7 +47,8 @@ if test -n "$bootable"; then isoBootFlags="-eltorito-boot ${bootImage} -eltorito-catalog .boot.cat - -no-emul-boot -boot-load-size 4 -boot-info-table" + -no-emul-boot -boot-load-size 4 -boot-info-table + --sort-weight 1 /isolinux" # Make sure isolinux is near the beginning of the ISO fi if test -n "$usbBootable"; then @@ -112,7 +113,7 @@ xorriso="xorriso -r -path-list pathlist --sort-weight 0 / - --sort-weight 1 /isolinux" # Make sure isolinux is near the beginning of the ISO +" $xorriso -output $out/iso/$isoName diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index 05b06ca467e4..ff07cc17f87b 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -156,9 +156,23 @@ in rec { test = passMeta (runTests driver); report = passMeta (releaseTools.gcovReport { coverageRuns = [ test ]; }); - in (if makeCoverageReport then report else test) // { - inherit nodes driver test; - }; + nodeNames = builtins.attrNames nodes; + invalidNodeNames = lib.filter + (node: builtins.match "^[A-z_][A-z0-9_]+$" node == null) nodeNames; + + in + if lib.length invalidNodeNames > 0 then + throw '' + Cannot create machines out of (${lib.concatStringsSep ", " invalidNodeNames})! + All machines are referenced as perl variables in the testing framework which will break the + script when special characters are used. + + Please stick to alphanumeric chars and underscores as separation. + '' + else + (if makeCoverageReport then report else test) // { + inherit nodes driver test; + }; runInMachine = { drv diff --git a/nixos/modules/config/appstream.nix b/nixos/modules/config/appstream.nix new file mode 100644 index 000000000000..483ac9c3cd76 --- /dev/null +++ b/nixos/modules/config/appstream.nix @@ -0,0 +1,25 @@ +{ config, lib, ... }: + +with lib; +{ + options = { + appstream.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install files to support the + <link xlink:href="https://www.freedesktop.org/software/appstream/docs/index.html">AppStream metadata specification</link>. + ''; + }; + }; + + config = mkIf config.appstream.enable { + environment.pathsToLink = [ + # per component metadata + "/share/metainfo" + # legacy path for above + "/share/appdata" + ]; + }; + +} diff --git a/nixos/modules/config/xdg/sounds.nix b/nixos/modules/config/xdg/sounds.nix new file mode 100644 index 000000000000..148240d631cf --- /dev/null +++ b/nixos/modules/config/xdg/sounds.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: + +with lib; +{ + options = { + xdg.sounds.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install files to support the + <link xlink:href="https://www.freedesktop.org/wiki/Specifications/sound-theme-spec/">XDG Sound Theme specification</link>. + ''; + }; + }; + + config = mkIf config.xdg.sounds.enable { + environment.pathsToLink = [ + "/share/sounds" + ]; + }; + +} diff --git a/nixos/modules/hardware/bladeRF.nix b/nixos/modules/hardware/bladeRF.nix new file mode 100644 index 000000000000..925443477143 --- /dev/null +++ b/nixos/modules/hardware/bladeRF.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.hardware.bladeRF; + +in + +{ + options.hardware.bladeRF = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enables udev rules for BladeRF devices. By default grants access + to users in the "bladerf" group. You may want to install the + libbladeRF package. + ''; + }; + + }; + + config = mkIf cfg.enable { + services.udev.packages = [ pkgs.libbladeRF ]; + users.groups.bladerf = {}; + }; +} \ No newline at end of file diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index aa8003fef2c9..9475da23b1ff 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -50,7 +50,7 @@ let finalCfg = { name = "NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}"; params = "init=${config.system.build.toplevel}/init ${additional} ${toString config.boot.kernelParams}"; - image = "/boot/bzImage"; + image = "/boot/${config.system.boot.loader.kernelFile}"; initrd = "/boot/initrd"; }; in @@ -163,7 +163,7 @@ let cp -v ${pkgs.refind}/share/refind/refind_x64.efi $out/EFI/boot/ '' else - "# No refind for ia32" + "# No refind for ${targetArch}" ; grubMenuCfg = '' @@ -222,18 +222,34 @@ let efiDir = pkgs.runCommand "efi-directory" {} '' mkdir -p $out/EFI/boot/ + # ALWAYS required modules. MODULES="fat iso9660 part_gpt part_msdos \ normal boot linux configfile loopback chain halt \ - efifwsetup efi_gop efi_uga \ + efifwsetup efi_gop \ ls search search_label search_fs_uuid search_fs_file \ gfxmenu gfxterm gfxterm_background gfxterm_menu test all_video loadenv \ exfat ext2 ntfs btrfs hfsplus udf \ videoinfo png \ echo serial \ " + + echo "Building GRUB with modules:" + for mod in $MODULES; do + echo " - $mod" + done + + # Modules that may or may not be available per-platform. + echo "Adding additional modules:" + for mod in efi_uga; do + if [ -f ${pkgs.grub2_efi}/lib/grub/${pkgs.grub2_efi.grubTarget}/$mod.mod ]; then + echo " - $mod" + MODULES+=" $mod" + fi + done + # Make our own efi program, we can't rely on "grub-install" since it seems to # probe for devices, even with --skip-fs-probe. - ${pkgs.grub2_efi}/bin/grub-mkimage -o $out/EFI/boot/${if targetArch == "x64" then "bootx64" else "bootia32"}.efi -p /EFI/boot -O ${if targetArch == "x64" then "x86_64" else "i386"}-efi \ + ${pkgs.grub2_efi}/bin/grub-mkimage -o $out/EFI/boot/boot${targetArch}.efi -p /EFI/boot -O ${pkgs.grub2_efi.grubTarget} \ $MODULES cp ${pkgs.grub2_efi}/share/grub/unicode.pf2 $out/EFI/boot/ @@ -344,12 +360,19 @@ let ${pkgs.dosfstools}/sbin/fsck.vfat -vn "$out" ''; # */ - targetArch = if pkgs.stdenv.isi686 then - "ia32" - else if pkgs.stdenv.isx86_64 then - "x64" - else - throw "Unsupported architecture"; + # Name used by UEFI for architectures. + targetArch = + if pkgs.stdenv.isi686 then + "ia32" + else if pkgs.stdenv.isx86_64 then + "x64" + else if pkgs.stdenv.isAarch64 then + "aa64" + else + throw "Unsupported architecture"; + + # Syslinux (and isolinux) only supports x86-based architectures. + canx86BiosBoot = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64; in @@ -483,9 +506,9 @@ in # here and it causes a cyclic dependency. boot.loader.grub.enable = false; - # !!! Hack - attributes expected by other modules. - system.boot.loader.kernelFile = "bzImage"; - environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ]; + environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi ] + ++ optional canx86BiosBoot pkgs.syslinux + ; # In stage 1 of the boot, mount the CD as the root FS by label so # that we don't need to know its device. We pass the label of the @@ -556,13 +579,7 @@ in # Individual files to be included on the CD, outside of the Nix # store on the CD. isoImage.contents = - [ { source = pkgs.substituteAll { - name = "isolinux.cfg"; - src = pkgs.writeText "isolinux.cfg-in" isolinuxCfg; - bootRoot = "/boot"; - }; - target = "/isolinux/isolinux.cfg"; - } + [ { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; target = "/boot/" + config.system.boot.loader.kernelFile; } @@ -572,9 +589,6 @@ in { source = config.system.build.squashfsStore; target = "/nix-store.squashfs"; } - { source = "${pkgs.syslinux}/share/syslinux"; - target = "/isolinux"; - } { source = config.isoImage.efiSplashImage; target = "/EFI/boot/efi-background.png"; } @@ -584,6 +598,17 @@ in { source = pkgs.writeText "version" config.system.nixos.label; target = "/version.txt"; } + ] ++ optionals canx86BiosBoot [ + { source = pkgs.substituteAll { + name = "isolinux.cfg"; + src = pkgs.writeText "isolinux.cfg-in" isolinuxCfg; + bootRoot = "/boot"; + }; + target = "/isolinux/isolinux.cfg"; + } + { source = "${pkgs.syslinux}/share/syslinux"; + target = "/isolinux"; + } ] ++ optionals config.isoImage.makeEfiBootable [ { source = efiImg; target = "/boot/efi.img"; @@ -591,7 +616,7 @@ in { source = "${efiDir}/EFI"; target = "/EFI"; } - ] ++ optionals config.boot.loader.grub.memtest86.enable [ + ] ++ optionals (config.boot.loader.grub.memtest86.enable && canx86BiosBoot) [ { source = "${pkgs.memtest86plus}/memtest.bin"; target = "/boot/memtest.bin"; } @@ -606,9 +631,10 @@ in # Create the ISO image. system.build.isoImage = pkgs.callPackage ../../../lib/make-iso9660-image.nix ({ inherit (config.isoImage) isoName compressImage volumeID contents; - bootable = true; + bootable = canx86BiosBoot; bootImage = "/isolinux/isolinux.bin"; - } // optionalAttrs config.isoImage.makeUsbBootable { + syslinux = if canx86BiosBoot then pkgs.syslinux else null; + } // optionalAttrs (config.isoImage.makeUsbBootable && canx86BiosBoot) { usbBootable = true; isohybridMbrImage = "${pkgs.syslinux}/share/syslinux/isohdpfx.bin"; } // optionalAttrs config.isoImage.makeEfiBootable { diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index d0f0844ba8a3..3cd1ddf82bd9 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -11,6 +11,8 @@ ./config/xdg/icons.nix ./config/xdg/menus.nix ./config/xdg/mime.nix + ./config/appstream.nix + ./config/xdg/sounds.nix ./config/gtk/gtk-icon-cache.nix ./config/gnu.nix ./config/i18n.nix @@ -34,6 +36,7 @@ ./config/vpnc.nix ./config/zram.nix ./hardware/all-firmware.nix + ./hardware/bladeRF.nix ./hardware/brightnessctl.nix ./hardware/ckb-next.nix ./hardware/cpu/amd-microcode.nix diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix index 2b01c9d26c41..d22f9dfa3199 100644 --- a/nixos/modules/programs/bash/bash.nix +++ b/nixos/modules/programs/bash/bash.nix @@ -98,7 +98,12 @@ in if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then PROMPT_COLOR="1;31m" let $UID && PROMPT_COLOR="1;32m" - PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] " + if [ -n "$INSIDE_EMACS" ]; then + # Emacs term mode doesn't support xterm title escape sequence (\e]0;) + PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] " + else + PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] " + fi if test "$TERM" = "xterm"; then PS1="\[\033]2;\h:\u:\w\007\]$PS1" fi diff --git a/nixos/modules/programs/zsh/oh-my-zsh.xml b/nixos/modules/programs/zsh/oh-my-zsh.xml index 5cf690c1a560..b26980daf067 100644 --- a/nixos/modules/programs/zsh/oh-my-zsh.xml +++ b/nixos/modules/programs/zsh/oh-my-zsh.xml @@ -19,7 +19,7 @@ configuration format of <literal>oh-my-zsh</literal>. <programlisting> { - programs.ohMyZsh = { + programs.zsh.ohMyZsh = { enable = true; plugins = [ "git" "python" "man" ]; theme = "agnoster"; @@ -51,7 +51,7 @@ The module can do this as well: <programlisting> { - programs.ohMyZsh.custom = "~/path/to/custom/scripts"; + programs.zsh.ohMyZsh.custom = "~/path/to/custom/scripts"; } </programlisting> </para> @@ -73,7 +73,7 @@ <programlisting> { pkgs, ... }: { - programs.ohMyZsh.customPkgs = with pkgs; [ + programs.zsh.ohMyZsh.customPkgs = with pkgs; [ pkgs.nix-zsh-completions # and even more... ]; @@ -87,7 +87,7 @@ <para> <emphasis>Please keep in mind that this is not compatible with - <literal>programs.ohMyZsh.custom</literal> as it requires an immutable store + <literal>programs.zsh.ohMyZsh.custom</literal> as it requires an immutable store path while <literal>custom</literal> shall remain mutable! An evaluation failure will be thrown if both <literal>custom</literal> and <literal>customPkgs</literal> are set.</emphasis> diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix index d7ca8a431794..2a8dfe4a66c9 100644 --- a/nixos/modules/services/hardware/bluetooth.nix +++ b/nixos/modules/services/hardware/bluetooth.nix @@ -25,9 +25,14 @@ in { type = types.package; default = pkgs.bluez; defaultText = "pkgs.bluez"; - example = "pkgs.bluez.override { enableMidi = true; }"; + example = "pkgs.bluezFull"; description = '' Which BlueZ package to use. + + <note><para> + Use the <literal>pkgs.bluezFull</literal> package to enable all + bluez plugins. + </para></note> ''; }; diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix index a37ef98caec6..25b7d6dbeba2 100644 --- a/nixos/modules/services/networking/prosody.nix +++ b/nixos/modules/services/networking/prosody.nix @@ -228,6 +228,7 @@ let createSSLOptsStr = o: '' ssl = { + cafile = "/etc/ssl/certs/ca-bundle.crt"; key = "${o.key}"; certificate = "${o.cert}"; ${concatStringsSep "\n" (mapAttrsToList (name: value: "${name} = ${toLua value};") o.extraOptions)} diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 0c8520d15dac..4b7f864fde8e 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -39,7 +39,6 @@ in cfssl = handleTestOn ["x86_64-linux"] ./cfssl.nix {}; chromium = (handleTestOn ["x86_64-linux"] ./chromium.nix {}).stable or {}; cjdns = handleTest ./cjdns.nix {}; - clamav = handleTest ./clamav.nix {}; cloud-init = handleTest ./cloud-init.nix {}; codimd = handleTest ./codimd.nix {}; containers-bridge = handleTest ./containers-bridge.nix {}; diff --git a/nixos/tests/clamav.nix b/nixos/tests/clamav.nix deleted file mode 100644 index 84a08bcc49f3..000000000000 --- a/nixos/tests/clamav.nix +++ /dev/null @@ -1,37 +0,0 @@ -import ./make-test.nix ({ pkgs, ... }: let - - eicarTestFile = pkgs.fetchurl { - url = "http://2016.eicar.org/download/eicar.com.txt"; - sha256 = "03zxa7vap2jkqjif4bzcjp33yrnip5yrz2bisia9wj5npwdh4ni7"; - }; - - clamavMain = builtins.fetchurl "http://database.clamav.net/main.cvd"; - clamavDaily = builtins.fetchurl "http://database.clamav.net/daily.cvd"; - clamavBytecode = builtins.fetchurl "http://database.clamav.net/bytecode.cvd"; - -in { - name = "clamav"; - meta = with pkgs.stdenv.lib.maintainers; { - maintainers = [ fpletz ]; - }; - - nodes.machine = { ... }: { - virtualisation.memorySize = 1024; - - services.clamav.daemon.enable = true; - systemd.services.clamav-daemon.preStart = '' - mkdir -p /var/lib/clamav - ln -sf ${clamavMain} /var/lib/clamav/main.cvd - ln -sf ${clamavDaily} /var/lib/clamav/daily.cvd - ln -sf ${clamavBytecode} /var/lib/clamav/bytecode.cvd - ''; - }; - - testScript = '' - startAll; - $machine->waitForUnit("multi-user.target"); - $machine->waitForUnit("clamav-daemon.service"); - $machine->waitForFile("/run/clamav/clamd.ctl"); - $machine->fail("clamdscan ${eicarTestFile}"); - ''; -}) |