From 1d67ea1ce3c6ba27273445dca01418fba044e0bb Mon Sep 17 00:00:00 2001 From: Jaka Kranjc Date: Sun, 24 Aug 2014 15:57:00 +0200 Subject: nixos-install.sh: added --root parameter Previously: - setting the mountpoint was only possible through an environment variable - a discrepancy from nixos-generate-config, which has --root --- nixos/modules/installer/tools/nixos-install.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nixos/modules/installer') diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index a55eda1cb8fd..86952486ade0 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -30,6 +30,9 @@ while [ "$#" -gt 0 ]; do absolute_path=$(readlink -m $given_path) extraBuildFlags+=("$i" "/mnt$absolute_path") ;; + --root) + mountPoint="$1"; shift 1 + ;; --show-trace) extraBuildFlags+=("$i") ;; -- cgit 1.4.1 From 8a56a55bb442cbf2e2126d40df55e67b9aea0361 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 27 Aug 2014 23:41:15 +0200 Subject: nixos/manual: Use literalExample when feasible. Should bring most of the examples into a better consistency regarding syntactic representation in the manual. Thanks to @devhell for reporting. Signed-off-by: aszlig --- nixos/modules/config/fonts/fonts.nix | 2 +- nixos/modules/config/power-management.nix | 8 ++++++-- nixos/modules/config/pulseaudio.nix | 2 +- nixos/modules/config/shells-environment.nix | 4 +++- nixos/modules/installer/cd-dvd/iso-image.nix | 7 ++++--- nixos/modules/installer/cd-dvd/system-tarball.nix | 7 ++++--- nixos/modules/misc/crashdump.nix | 2 +- nixos/modules/services/audio/mopidy.nix | 2 +- nixos/modules/services/backup/rsnapshot.nix | 2 +- nixos/modules/services/logging/syslog-ng.nix | 4 +++- nixos/modules/services/monitoring/smartd.nix | 2 +- nixos/modules/services/networking/ircd-hybrid/default.nix | 4 ++-- nixos/modules/services/networking/znc.nix | 2 +- nixos/modules/services/web-servers/apache-httpd/default.nix | 2 +- nixos/modules/services/x11/desktop-managers/gnome3.nix | 4 ++-- nixos/modules/services/x11/desktop-managers/kde4.nix | 2 +- nixos/modules/services/x11/display-managers/default.nix | 6 ++++-- nixos/modules/services/x11/xserver.nix | 4 ++-- 18 files changed, 39 insertions(+), 27 deletions(-) (limited to 'nixos/modules/installer') diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix index 49b1e1d42a3f..f6060a910a15 100644 --- a/nixos/modules/config/fonts/fonts.nix +++ b/nixos/modules/config/fonts/fonts.nix @@ -11,7 +11,7 @@ with lib; # TODO: find another name for it. fonts = mkOption { type = types.listOf types.path; - example = [ pkgs.dejavu_fonts ]; + example = literalExample "[ pkgs.dejavu_fonts ]"; description = "List of primary font paths."; apply = list: list ++ [ # - the user's current profile diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix index 17f3ed00b9be..32a7987617ad 100644 --- a/nixos/modules/config/power-management.nix +++ b/nixos/modules/config/power-management.nix @@ -35,7 +35,9 @@ in powerUpCommands = mkOption { type = types.lines; default = ""; - example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; + example = literalExample '' + "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda" + ''; description = '' Commands executed when the machine powers up. That is, @@ -47,7 +49,9 @@ in powerDownCommands = mkOption { type = types.lines; default = ""; - example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; + example = literalExample '' + "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda" + ''; description = '' Commands executed when the machine powers down. That is, diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix index 96593885e5b7..1b84bbaf10c5 100644 --- a/nixos/modules/config/pulseaudio.nix +++ b/nixos/modules/config/pulseaudio.nix @@ -81,7 +81,7 @@ in { package = mkOption { type = types.package; default = pulseaudioFull; - example = literalExample "pulseaudioFull"; + example = literalExample "pkgs.pulseaudioFull"; description = '' The PulseAudio derivation to use. This can be used to disable features (such as JACK support, Bluetooth) that are enabled in the diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index cc079cdc5856..2559c53ac163 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -122,7 +122,9 @@ in environment.binsh = mkOption { default = "${config.system.build.binsh}/bin/sh"; - example = "\${pkgs.dash}/bin/dash"; + example = literalExample '' + "''${pkgs.dash}/bin/dash" + ''; type = types.path; description = '' The shell executable that is linked system-wide to diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index d43fa2203818..623cfdedd269 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -113,11 +113,12 @@ in }; isoImage.contents = mkOption { - example = + example = literalExample '' [ { source = pkgs.memtest86 + "/memtest.bin"; target = "boot/memtest.bin"; } - ]; + ] + ''; description = '' This option lists files to be copied to fixed locations in the generated ISO image. @@ -125,7 +126,7 @@ in }; isoImage.storeContents = mkOption { - example = [pkgs.stdenv]; + example = literalExample "[ pkgs.stdenv ]"; description = '' This option lists additional derivations to be included in the Nix store in the generated ISO image. diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix index eaecbe1381f5..c24fe97fba46 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball.nix @@ -15,11 +15,12 @@ in { options = { tarball.contents = mkOption { - example = + example = literalExample '' [ { source = pkgs.memtest86 + "/memtest.bin"; target = "boot/memtest.bin"; } - ]; + ] + ''; description = '' This option lists files to be copied to fixed locations in the generated ISO image. @@ -27,7 +28,7 @@ in }; tarball.storeContents = mkOption { - example = [pkgs.stdenv]; + example = literalExample "[ pkgs.stdenv ]"; description = '' This option lists additional derivations to be included in the Nix store in the generated ISO image. diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix index d68f38bae2f5..773b5ac9da3e 100644 --- a/nixos/modules/misc/crashdump.nix +++ b/nixos/modules/misc/crashdump.nix @@ -28,7 +28,7 @@ in # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. defaultText = "pkgs.linuxPackages"; - example = "pkgs.linuxPackages_2_6_25"; + example = literalExample "pkgs.linuxPackages_2_6_25"; description = '' This will override the boot.kernelPackages, and will add some kernel configuration parameters for the crash dump to work. diff --git a/nixos/modules/services/audio/mopidy.nix b/nixos/modules/services/audio/mopidy.nix index 5b865cf4c1be..a7a7e8ae688b 100644 --- a/nixos/modules/services/audio/mopidy.nix +++ b/nixos/modules/services/audio/mopidy.nix @@ -49,7 +49,7 @@ in { extensionPackages = mkOption { default = []; type = types.listOf types.package; - example = [ mopidy-spotify ]; + example = literalExample "[ pkgs.mopidy-spotify ]"; description = '' Mopidy extensions that should be loaded by the service. ''; diff --git a/nixos/modules/services/backup/rsnapshot.nix b/nixos/modules/services/backup/rsnapshot.nix index 48ad7582b7e6..091b5cfd4d59 100644 --- a/nixos/modules/services/backup/rsnapshot.nix +++ b/nixos/modules/services/backup/rsnapshot.nix @@ -31,7 +31,7 @@ in cronIntervals = mkOption { default = {}; - example = { "hourly" = "0 * * * *"; "daily" = "50 21 * * *"; }; + example = { hourly = "0 * * * *"; daily = "50 21 * * *"; }; type = types.attrsOf types.string; description = '' Periodicity at which intervals should be run by cron. diff --git a/nixos/modules/services/logging/syslog-ng.nix b/nixos/modules/services/logging/syslog-ng.nix index 8b892a33bb7d..0b3f0cabb007 100644 --- a/nixos/modules/services/logging/syslog-ng.nix +++ b/nixos/modules/services/logging/syslog-ng.nix @@ -49,7 +49,9 @@ in { extraModulePaths = mkOption { type = types.listOf types.str; default = []; - example = [ "${pkgs.syslogng_incubator}/lib/syslog-ng" ]; + example = literalExample '' + [ "''${pkgs.syslogng_incubator}/lib/syslog-ng" ] + ''; description = '' A list of paths that should be included in syslog-ng's --module-path option. They should usually diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index 250035fe447f..803bd9e9a65a 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -62,7 +62,7 @@ in enable = mkOption { default = false; type = types.bool; - example = "true"; + example = true; description = '' Run smartd from the smartmontools package. Note that e-mail notifications will not be enabled unless you configure the list of diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix index a3d5b71740f6..2c397f94d230 100644 --- a/nixos/modules/services/networking/ircd-hybrid/default.nix +++ b/nixos/modules/services/networking/ircd-hybrid/default.nix @@ -66,7 +66,7 @@ in rsaKey = mkOption { default = null; - example = /root/certificates/irc.key; + example = literalExample "/root/certificates/irc.key"; description = " IRCD server RSA key. "; @@ -74,7 +74,7 @@ in certificate = mkOption { default = null; - example = /root/certificates/irc.pem; + example = literalExample "/root/certificates/irc.pem"; description = " IRCD server SSL certificate. There are some limitations - read manual. "; diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix index 4d53cd0750fb..2aa63c6e7dfb 100644 --- a/nixos/modules/services/networking/znc.nix +++ b/nixos/modules/services/networking/znc.nix @@ -228,7 +228,7 @@ in modulePackages = mkOption { type = types.listOf types.package; default = [ ]; - example = [ pkgs.zncModules.fish pkgs.zncModules.push ]; + example = literalExample "[ pkgs.zncModules.fish pkgs.zncModules.push ]"; description = '' A list of global znc module packages to add to znc. ''; diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index b83cf276ed52..9ac28373dacb 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -423,7 +423,7 @@ in package = mkOption { type = types.package; default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; - example = "pkgs.apacheHttpd_2_4"; + example = literalExample "pkgs.apacheHttpd_2_4"; description = '' Overridable attribute of the Apache HTTP Server package to use. ''; diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 06bcb6dbb8be..049c96c54e71 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -37,7 +37,7 @@ in { services.xserver.desktopManager.gnome3.sessionPath = mkOption { default = []; - example = "[ pkgs.gnome3.gpaste ]"; + example = literalExample "[ pkgs.gnome3.gpaste ]"; description = "Additional list of packages to be added to the session search path. Useful for gnome shell extensions or gsettings-conditionated autostart."; apply = list: list ++ [ gnome3.gnome_shell ]; @@ -51,7 +51,7 @@ in { environment.gnome3.excludePackages = mkOption { default = []; - example = "[ pkgs.gnome3.totem ]"; + example = literalExample "[ pkgs.gnome3.totem ]"; type = types.listOf types.package; description = "Which packages gnome should exclude from the default environment"; }; diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix index f74dd7e04449..669ddbd904f0 100644 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ b/nixos/modules/services/x11/desktop-managers/kde4.nix @@ -65,7 +65,7 @@ in environment.kdePackages = mkOption { default = []; - example = "[ pkgs.kde4.kdesdk ]"; + example = literalExample "[ pkgs.kde4.kdesdk ]"; type = types.listOf types.package; description = "This option is obsolete. Please use instead."; }; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 3bf18bd58c84..6e61576f501f 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -251,14 +251,16 @@ in execCmd = mkOption { type = types.str; - example = "${pkgs.slim}/bin/slim"; + example = literalExample '' + "''${pkgs.slim}/bin/slim" + ''; description = "Command to start the display manager."; }; environment = mkOption { type = types.attrsOf types.unspecified; default = {}; - example = { SLIM_CFGFILE = /etc/slim.conf; }; + example = { SLIM_CFGFILE = "/etc/slim.conf"; }; description = "Additional environment variables needed by the display manager."; }; diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 5f3e8003b45b..21eaf6bb6b76 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -151,7 +151,7 @@ in modules = mkOption { type = types.listOf types.path; default = []; - example = [ pkgs.xf86_input_wacom ]; + example = literalExample "[ pkgs.xf86_input_wacom ]"; description = "Packages to be added to the module search path of the X server."; }; @@ -201,7 +201,7 @@ in vaapiDrivers = mkOption { type = types.listOf types.path; default = [ ]; - example = "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]"; + example = literalExample "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]"; description = '' Packages providing libva acceleration drivers. ''; -- cgit 1.4.1 From 940c57e4e86f14cbc25bd63949ef27cc96856425 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Fri, 2 May 2014 03:44:07 -0500 Subject: nixos/ova: Grub uuid detection is broken when generating the ova --- nixos/modules/installer/virtualbox-demo.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nixos/modules/installer') diff --git a/nixos/modules/installer/virtualbox-demo.nix b/nixos/modules/installer/virtualbox-demo.nix index f68f8dc40aa8..49ec08996104 100644 --- a/nixos/modules/installer/virtualbox-demo.nix +++ b/nixos/modules/installer/virtualbox-demo.nix @@ -10,6 +10,9 @@ with lib; ../profiles/clone-config.nix ]; + # FIXME: UUID detection is currently broken + boot.loader.grub.fsIdentifier = "provided"; + # Allow mounting of shared folders. users.extraUsers.demo.extraGroups = [ "vboxsf" ]; -- cgit 1.4.1 From 36a47733a264dbfe0d8cb62a1a0d5d4d4b07b715 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Wed, 18 Jun 2014 18:43:00 -0500 Subject: nixos-generate-config: Detect btrfs subvolumes --- .../installer/tools/nixos-generate-config.pl | 21 +++++++++++++++++++++ nixos/modules/installer/tools/tools.nix | 1 + 2 files changed, 22 insertions(+) (limited to 'nixos/modules/installer') diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 66a8152a3a6c..cabdb09ec9c1 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -20,6 +20,13 @@ sub uniq { return @res; } +sub runCommand { + my ($cmd) = @_; + open FILE, "$cmd 2>/dev/null |" or die "Failed to execute: $cmd\n"; + my @ret = ; + close FILE; + return ($?, @ret); +} # Process the command line. my $outDir = "/etc/nixos"; @@ -337,6 +344,20 @@ EOF } } + # Is this a btrfs filesystem? + if ($fsType eq "btrfs") { + my ($status, @info) = runCommand("btrfs subvol show $rootDir$mountPoint"); + if ($status != 0) { + die "Failed to retreive subvolume info for $mountPoint"; + } + my @subvols = join("", @info) =~ m/Name:[ \t\n]*([^ \t\n]*)/; + if ($#subvols > 0) { + die "Btrfs subvol name for $mountPoint listed multiple times in mount\n" + } elsif ($#subvols == 0) { + push @extraOptions, "subvol=$subvols[0]"; + } + } + # Emit the filesystem. $fileSystems .= <