Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
FRidh committed Jan 22, 2018
2 parents 8b49697 + 4c88132 commit 6b08734
Show file tree
Hide file tree
Showing 67 changed files with 459 additions and 244 deletions.
2 changes: 2 additions & 0 deletions lib/maintainers.nix
Expand Up @@ -118,6 +118,7 @@
chaoflow = "Florian Friesdorf <flo@chaoflow.net>";
chattered = "Phil Scott <me@philscotted.com>";
ChengCat = "Yucheng Zhang <yu@cheng.cat>";
chiiruno = "Okina Matara <okinan@protonmail.com>";
choochootrain = "Hurshal Patel <hurshal@imap.cc>";
chpatrick = "Patrick Chilton <chpatrick@gmail.com>";
chreekat = "Bryan Richter <b@chreekat.net>";
Expand Down Expand Up @@ -485,6 +486,7 @@
nico202 = "Nicolò Balzarotti <anothersms@gmail.com>";
NikolaMandic = "Ratko Mladic <nikola@mandic.email>";
nixy = "Andrew R. M. <nixy@nixy.moe>";
nmattia = "Nicolas Mattia <nicolas@nmattia.com>";
nocoolnametom = "Tom Doggett <nocoolnametom@gmail.com>";
notthemessiah = "Brian Cohen <brian.cohen.88@gmail.com>";
np = "Nicolas Pouillard <np.nix@nicolaspouillard.fr>";
Expand Down
10 changes: 5 additions & 5 deletions nixos/doc/manual/installation/installing-virtualbox-guest.xml
Expand Up @@ -4,18 +4,18 @@
version="5.0"
xml:id="sec-instaling-virtualbox-guest">

<title>Installing in a Virtualbox guest</title>
<title>Installing in a VirtualBox guest</title>
<para>
Installing NixOS into a Virtualbox guest is convenient for users who want to
Installing NixOS into a VirtualBox guest is convenient for users who want to
try NixOS without installing it on bare metal. If you want to use a pre-made
Virtualbox appliance, it is available at <link
VirtualBox appliance, it is available at <link
xlink:href="https://nixos.org/nixos/download.html">the downloads page</link>.
If you want to set up a Virtualbox guest manually, follow these instructions:
If you want to set up a VirtualBox guest manually, follow these instructions:
</para>

<orderedlist>

<listitem><para>Add a New Machine in Virtualbox with OS Type "Linux / Other
<listitem><para>Add a New Machine in VirtualBox with OS Type "Linux / Other
Linux"</para></listitem>

<listitem><para>Base Memory Size: 768 MB or higher.</para></listitem>
Expand Down
5 changes: 4 additions & 1 deletion nixos/doc/manual/installation/installing.xml
Expand Up @@ -45,7 +45,10 @@ for a UEFI installation is by and large the same as a BIOS installation. The dif
using <command>ifconfig</command>.</para>
<para>To manually configure the network on the graphical installer,
first disable network-manager with
<command>systemctl stop network-manager</command>.</para></listitem>
<command>systemctl stop network-manager</command>.</para>
<para>To manually configure the wifi on the minimal installer, run
<command>wpa_supplicant -B -i interface -c &lt;(wpa_passphrase 'SSID' 'key')</command>.</para></listitem>


<listitem><para>If you would like to continue the installation from a different
machine you need to activate the SSH daemon via <literal>systemctl start sshd</literal>.
Expand Down
82 changes: 64 additions & 18 deletions nixos/lib/make-disk-image.nix
Expand Up @@ -13,10 +13,16 @@
# grafted in the file system at path `target'.
, contents ? []

, # Whether the disk should be partitioned (with a single partition
# containing the root filesystem) or contain the root filesystem
# directly.
partitioned ? true
, # Type of partition table to use; either "legacy", "efi", or "none".
# For "efi" images, the GPT partition table is used and a mandatory ESP
# partition of reasonable size is created in addition to the root partition.
# If `installBootLoader` is true, GRUB will be installed in EFI mode.
# For "legacy", the msdos partition table is used and a single large root
# partition is created. If `installBootLoader` is true, GRUB will be
# installed in legacy mode.
# For "none", no partition table is created. Enabling `installBootLoader`
# most likely fails as GRUB will probably refuse to install.
partitionTableType ? "legacy"

# Whether to invoke switch-to-configuration boot during image creation
, installBootLoader ? true
Expand All @@ -37,6 +43,10 @@
format ? "raw"
}:

assert partitionTableType == "legacy" || partitionTableType == "efi" || partitionTableType == "none";
# We use -E offset=X below, which is only supported by e2fsprogs
assert partitionTableType != "none" -> fsType == "ext4";

with lib;

let format' = format; in let
Expand All @@ -51,6 +61,27 @@ let format' = format; in let
raw = "img";
}.${format};

rootPartition = { # switch-case
legacy = "1";
efi = "2";
}.${partitionTableType};

partitionDiskScript = { # switch-case
legacy = ''
parted --script $diskImage -- \
mklabel msdos \
mkpart primary ext4 1MiB -1
'';
efi = ''
parted --script $diskImage -- \
mklabel gpt \
mkpart ESP fat32 8MiB 256MiB \
set 1 boot on \
mkpart primary ext4 256MiB -1
'';
none = "";
}.${partitionTableType};

nixpkgs = cleanSource pkgs.path;

channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}" {} ''
Expand Down Expand Up @@ -79,21 +110,32 @@ let format' = format; in let
targets = map (x: x.target) contents;

prepareImage = ''
export PATH=${makeSearchPathOutput "bin" "bin" prepareImageInputs}
export PATH=${makeBinPath prepareImageInputs}
# Yes, mkfs.ext4 takes different units in different contexts. Fun.
sectorsToKilobytes() {
echo $(( ( "$1" * 512 ) / 1024 ))
}
sectorsToBytes() {
echo $(( "$1" * 512 ))
}
mkdir $out
diskImage=nixos.raw
truncate -s ${toString diskSize}M $diskImage
${if partitioned then ''
parted --script $diskImage -- mklabel msdos mkpart primary ext4 1M -1s
offset=$((2048*512))
${partitionDiskScript}
${if partitionTableType != "none" then ''
# Get start & length of the root partition in sectors to $START and $SECTORS.
eval $(partx $diskImage -o START,SECTORS --nr ${rootPartition} --pairs)
mkfs.${fsType} -F -L nixos $diskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K
'' else ''
offset=0
mkfs.${fsType} -F -L nixos $diskImage
''}
mkfs.${fsType} -F -L nixos -E offset=$offset $diskImage
root="$PWD/root"
mkdir -p $root
Expand Down Expand Up @@ -133,12 +175,12 @@ let format' = format; in let
find $root/nix/store -mindepth 1 -maxdepth 1 -type f -o -type d | xargs chmod -R a-w
echo "copying staging root to image..."
cptofs ${optionalString partitioned "-P 1"} -t ${fsType} -i $diskImage $root/* /
cptofs -p ${optionalString (partitionTableType != "none") "-P ${rootPartition}"} -t ${fsType} -i $diskImage $root/* /
'';
in pkgs.vmTools.runInLinuxVM (
pkgs.runCommand name
{ preVM = prepareImage;
buildInputs = with pkgs; [ utillinux e2fsprogs ];
buildInputs = with pkgs; [ utillinux e2fsprogs dosfstools ];
exportReferencesGraph = [ "closure" metaClosure ];
postVM = ''
${if format == "raw" then ''
Expand All @@ -152,11 +194,7 @@ in pkgs.vmTools.runInLinuxVM (
memSize = 1024;
}
''
${if partitioned then ''
rootDisk=/dev/vda1
'' else ''
rootDisk=/dev/vda
''}
rootDisk=${if partitionTableType != "none" then "/dev/vda${rootPartition}" else "/dev/vda"}
# Some tools assume these exist
ln -s vda /dev/xvda
Expand All @@ -166,6 +204,14 @@ in pkgs.vmTools.runInLinuxVM (
mkdir $mountPoint
mount $rootDisk $mountPoint
# Create the ESP and mount it. Unlike e2fsprogs, mkfs.vfat doesn't support an
# '-E offset=X' option, so we can't do this outside the VM.
${optionalString (partitionTableType == "efi") ''
mkdir -p /mnt/boot
mkfs.vfat -n ESP /dev/vda1
mount /dev/vda1 /mnt/boot
''}
# Install a configuration.nix
mkdir -p /mnt/etc/nixos
${optionalString (configFile != null) ''
Expand Down
2 changes: 1 addition & 1 deletion nixos/maintainers/scripts/ec2/amazon-image.nix
Expand Up @@ -46,7 +46,7 @@ in {
inherit lib config;
inherit (cfg) contents format name;
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
partitioned = config.ec2.hvm;
partitionTableType = if config.ec2.hvm then "legacy" else "none";
diskSize = cfg.sizeMB;
configFile = pkgs.writeText "configuration.nix"
''
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/config/shells-environment.nix
Expand Up @@ -36,7 +36,7 @@ in
default = {};
description = ''
A set of environment variables used in the global environment.
These variables will be set on shell initialisation.
These variables will be set on shell initialisation (e.g. in /etc/profile).
The value of each variable can be either a string or a list of
strings. The latter is concatenated, interspersed with colon
characters.
Expand Down
5 changes: 3 additions & 2 deletions nixos/modules/programs/zsh/zsh.nix
Expand Up @@ -36,8 +36,9 @@ in
shellAliases = mkOption {
default = config.environment.shellAliases;
description = ''
Set of aliases for zsh shell. See <option>environment.shellAliases</option>
for an option format description.
Set of aliases for zsh shell. Overrides the default value taken from
<option>environment.shellAliases</option>.
See <option>environment.shellAliases</option> for an option format description.
'';
type = types.attrs; # types.attrsOf types.stringOrPath;
};
Expand Down
4 changes: 4 additions & 0 deletions nixos/modules/system/boot/initrd-network.nix
Expand Up @@ -40,6 +40,10 @@ in
kernel documentation</link>. Otherwise, if
<option>networking.useDHCP</option> is enabled, an IP address
is acquired using DHCP.
You should add the module(s) required for your network card to
boot.initrd.availableKernelModules. lspci -v -s &lt;ethernet controller&gt;
will tell you which.
'';
};

Expand Down
5 changes: 3 additions & 2 deletions nixos/modules/system/boot/kernel.nix
Expand Up @@ -208,10 +208,11 @@ in
"usbhid"
"hid_generic" "hid_lenovo" "hid_apple" "hid_roccat" "hid_logitech_hidpp"

# Misc. keyboard stuff.
] ++ optionals (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) [
# Misc. x86 keyboard stuff.
"pcips2" "atkbd" "i8042"

# Needed by the stage 2 init script.
# x86 RTC needed by the stage 2 init script.
"rtc_cmos"
];

Expand Down
1 change: 1 addition & 0 deletions nixos/modules/virtualisation/libvirtd.nix
Expand Up @@ -128,6 +128,7 @@ in {
dmidecode
dnsmasq
ebtables
cfg.qemuPackage # libvirtd requires qemu-img to manage disk images
]
++ optional vswitch.enable vswitch.package;

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/virtualisation/virtualbox-image.nix
Expand Up @@ -25,7 +25,7 @@ in {
name = "nixos-ova-${config.system.nixosLabel}-${pkgs.stdenv.system}";

inherit pkgs lib config;
partitioned = true;
partitionTableType = "legacy";
diskSize = cfg.baseImageSize;

postVM =
Expand Down
11 changes: 10 additions & 1 deletion pkgs/applications/audio/cantata/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, vlc
{ stdenv, fetchFromGitHub, fetchpatch, cmake, pkgconfig, vlc
, qtbase, qtmultimedia, qtsvg, qttools

# Cantata doesn't build with cdparanoia enabled so we disable that
Expand Down Expand Up @@ -45,6 +45,15 @@ in stdenv.mkDerivation rec {
sha256 = "1b633chgfs8rya78bzzck5zijna15d1y4nmrz4dcjp862ks5y5q6";
};

patches = [
# patch is needed for 2.2.0 with qt 5.10 (doesn't harm earlier versions)
(fetchpatch {
url = "https://github.com/CDrummond/cantata/commit/4da7a9128f2c5eaf23ae2a5006d300dc4f21fc6a.patch";
sha256 = "1z21ax3542z7hm628xv110lmplaspb407jzgfk16xkphww5qyphj";
name = "fix_qt_510.patch";
})

];
buildInputs = [ vlc qtbase qtmultimedia qtsvg ]
++ stdenv.lib.optionals withTaglib [ taglib taglib_extras ]
++ stdenv.lib.optionals withReplaygain [ ffmpeg speex mpg123 ]
Expand Down

0 comments on commit 6b08734

Please sign in to comment.