diff options
author | Peter Simons <simons@cryp.to> | 2014-10-31 11:14:24 +0100 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2014-10-31 11:14:24 +0100 |
commit | b11060d8db2f856f3feaaa9d84df36606504d071 (patch) | |
tree | 74d8e01a5d7eb246dd25819a1b7f926082700732 /nixos | |
parent | c04e49289871232ff3c2fd1239b64c2513f18fd1 (diff) | |
parent | e18e77fbcdebc5bf1768157747b7e6d1ae7d9379 (diff) | |
download | nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.tar nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.tar.gz nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.tar.bz2 nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.tar.lz nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.tar.xz nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.tar.zst nixlib-b11060d8db2f856f3feaaa9d84df36606504d071.zip |
Merge remote-tracking branch 'origin/master' into staging.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix | 3 | ||||
-rwxr-xr-x | nixos/maintainers/scripts/ec2/create-ebs-amis.py | 90 | ||||
-rw-r--r-- | nixos/modules/installer/cd-dvd/installation-cd-base.nix | 3 | ||||
-rw-r--r-- | nixos/modules/installer/cd-dvd/installation-cd-graphical.nix | 69 | ||||
-rw-r--r-- | nixos/modules/rename.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/backup/rsnapshot.nix | 11 | ||||
-rw-r--r-- | nixos/modules/services/logging/logstash.nix | 14 | ||||
-rw-r--r-- | nixos/modules/services/logging/syslog-ng.nix | 18 | ||||
-rw-r--r-- | nixos/modules/services/x11/desktop-managers/kde4.nix | 14 | ||||
-rw-r--r-- | nixos/modules/services/x11/display-managers/default.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/x11/hardware/synaptics.nix | 20 | ||||
-rw-r--r-- | nixos/release-small.nix | 1 |
12 files changed, 172 insertions, 78 deletions
diff --git a/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix index d9feba164a76..530769cec5b7 100644 --- a/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix +++ b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix @@ -19,7 +19,8 @@ in { imports = [ ./amazon-base-config.nix ]; ec2.hvm = true; - boot.loader.grub.device = lib.mkOverride 0 "nodev"; + boot.loader.grub.device = lib.mkOverride 0 "/dev/xvdg"; + boot.kernelParams = [ "console=ttyS0" ]; boot.initrd.extraUtilsCommands = '' cp -v ${pkgs.gawk}/bin/gawk $out/bin/gawk diff --git a/nixos/maintainers/scripts/ec2/create-ebs-amis.py b/nixos/maintainers/scripts/ec2/create-ebs-amis.py index 14607b9a3678..62525651ae03 100755 --- a/nixos/maintainers/scripts/ec2/create-ebs-amis.py +++ b/nixos/maintainers/scripts/ec2/create-ebs-amis.py @@ -19,8 +19,17 @@ parser.add_argument('--key', dest='key_name', action='store_true', help='Keypair args = parser.parse_args() instance_type = "m3.medium" if args.hvm else "m1.small" -ebs_size = 8 if args.hvm else 20 +if args.hvm: + virtualization_type = "hvm" + root_block = "/dev/sda1" + image_type = 'hvm' +else: + virtualization_type = "paravirtual" + root_block = "/dev/sda" + image_type = 'ebs' + +ebs_size = 20 # Start a NixOS machine in the given region. f = open("ebs-creator-config.nix", "w") @@ -76,10 +85,6 @@ if args.hvm: m.upload_file("./amazon-hvm-config.nix", "/mnt/etc/nixos/configuration.nix") m.upload_file("./amazon-hvm-install-config.nix", "/mnt/etc/nixos/amazon-hvm-install-config.nix") m.run_command("NIXOS_CONFIG=/etc/nixos/amazon-hvm-install-config.nix nixos-install") - m.run_command('nix-env -iA nixos.pkgs.grub') - m.run_command('cp /nix/store/*-grub-0.97*/lib/grub/i386-pc/* /mnt/boot/grub') - m.run_command('echo "(hd1) /dev/xvdg" > device.map') - m.run_command('echo -e "root (hd1,0)\nsetup (hd1)" | grub --device-map=device.map --batch') else: m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/configuration.nix") m.run_command("nixos-install") @@ -87,7 +92,7 @@ else: m.run_command("umount /mnt") if args.hvm: - ami_name = "nixos-{0}-x86_64-ebs-hvm".format(version) + ami_name = "nixos-{0}-x86_64-hvm".format(version) description = "NixOS {0} (x86_64; EBS root; hvm)".format(version) else: ami_name = "nixos-{0}-x86_64-ebs".format(version) @@ -102,58 +107,40 @@ def check(): m.connect() volume = m._conn.get_all_volumes([], filters={'attachment.instance-id': m.resource_id, 'attachment.device': "/dev/sdg"})[0] -if args.hvm: - instance = m._conn.run_instances( image_id="ami-5f491f36" - , instance_type=instance_type - , key_name=args.key_name - , placement=m.zone - , security_groups=["eelco-test"]).instances[0] - nixops.util.check_wait(lambda: instance.update() == 'running', max_tries=120) - instance.stop() - nixops.util.check_wait(lambda: instance.update() == 'stopped', max_tries=120) - old_root_volume = m._conn.get_all_volumes([], filters={'attachment.instance-id': instance.id, 'attachment.device': "/dev/sda1"})[0] - old_root_volume.detach() - volume.detach() - nixops.util.check_wait(lambda: volume.update() == 'available', max_tries=120) - nixops.util.check_wait(lambda: old_root_volume.update() == 'available', max_tries=120) - volume.attach(instance.id, '/dev/sda1') - nixops.util.check_wait(lambda: volume.update() == 'in-use', max_tries=120) - - ami_id = m._conn.create_image(instance.id, ami_name, description) - time.sleep(5) - image = m._conn.get_all_images([ami_id])[0] - nixops.util.check_wait(lambda: image.update() == 'available', max_tries=120) - instance.terminate() -else: - # Create a snapshot. - snapshot = volume.create_snapshot(description=description) - print >> sys.stderr, "created snapshot {0}".format(snapshot.id) +# Create a snapshot. +snapshot = volume.create_snapshot(description=description) +print >> sys.stderr, "created snapshot {0}".format(snapshot.id) - nixops.util.check_wait(check, max_tries=120) +nixops.util.check_wait(check, max_tries=120) - m._conn.create_tags([snapshot.id], {'Name': ami_name}) +m._conn.create_tags([snapshot.id], {'Name': ami_name}) - if not args.keep: depl.destroy_resources() +if not args.keep: depl.destroy_resources() - # Register the image. - aki = m._conn.get_all_images(filters={'manifest-location': '*pv-grub-hd0_1.03-x86_64*'})[0] - print >> sys.stderr, "using kernel image {0} - {1}".format(aki.id, aki.location) +# Register the image. +aki = m._conn.get_all_images(filters={'manifest-location': 'ec2*pv-grub-hd0_1.03-x86_64*'})[0] +print >> sys.stderr, "using kernel image {0} - {1}".format(aki.id, aki.location) - block_map = BlockDeviceMapping() - block_map['/dev/sda'] = BlockDeviceType(snapshot_id=snapshot.id, delete_on_termination=True) - block_map['/dev/sdb'] = BlockDeviceType(ephemeral_name="ephemeral0") - block_map['/dev/sdc'] = BlockDeviceType(ephemeral_name="ephemeral1") - block_map['/dev/sdd'] = BlockDeviceType(ephemeral_name="ephemeral2") - block_map['/dev/sde'] = BlockDeviceType(ephemeral_name="ephemeral3") +block_map = BlockDeviceMapping() +block_map[root_block] = BlockDeviceType(snapshot_id=snapshot.id, delete_on_termination=True, size=ebs_size, volume_type="gp2") +block_map['/dev/sdb'] = BlockDeviceType(ephemeral_name="ephemeral0") +block_map['/dev/sdc'] = BlockDeviceType(ephemeral_name="ephemeral1") +block_map['/dev/sdd'] = BlockDeviceType(ephemeral_name="ephemeral2") +block_map['/dev/sde'] = BlockDeviceType(ephemeral_name="ephemeral3") - ami_id = m._conn.register_image( +common_args = dict( name=ami_name, description=description, architecture="x86_64", - root_device_name="/dev/sda", - kernel_id=aki.id, - block_device_map=block_map) + root_device_name=root_block, + block_device_map=block_map, + virtualization_type=virtualization_type, + delete_root_volume_on_termination=True + ) +if not args.hvm: + common_args['kernel_id']=aki.id +ami_id = m._conn.register_image(**common_args) print >> sys.stderr, "registered AMI {0}".format(ami_id) @@ -197,17 +184,12 @@ test_depl.nix_exprs = [os.path.abspath("./ebs-test.nix")] test_depl.deploy(create_only=True) test_depl.machines['machine'].run_command("nixos-version") -if args.hvm: - image_type = 'hvm' -else: - image_type = 'ebs' - # Log the AMI ID. f = open("{0}.{1}.ami-id".format(args.region, image_type), "w") f.write("{0}".format(ami_id)) f.close() -for dest in [ 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'sa-east-1']: +for dest in [ 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'eu-central-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'sa-east-1']: if args.region != dest: print >> sys.stderr, "copying image from region {0} to {1}".format(args.region, dest) conn = boto.ec2.connect_to_region(dest) diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix index 4d87c20559d6..0a39e8dde9de 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix @@ -42,6 +42,9 @@ with lib; # Get a console as soon as the initrd loads fbcon on EFI boot. boot.initrd.kernelModules = [ "fbcon" ]; + # Add support for cow filesystems and their utilities + boot.supportedFilesystems = [ "zfs" "btrfs" ]; + # Allow the user to log in as root without a password. security.initialRootPassword = ""; } diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix index 65aa11670893..b1e1d16c610d 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix @@ -11,6 +11,9 @@ with lib; # Provide wicd for easy wireless configuration. #networking.wicd.enable = true; + # Include gparted for partitioning disks + environment.systemPackages = [ pkgs.gparted ]; + # KDE complains if power management is disabled (to be precise, if # there is no power management backend such as upower). powerManagement.enable = true; @@ -27,4 +30,70 @@ with lib; AutoLoginUser=root AutoLoginPass="" ''; + + # Custom kde-workspace adding some icons on the desktop + + system.activationScripts.installerDesktop = let + openManual = pkgs.writeScript "nixos-manual.sh" '' + #!${pkgs.stdenv.shell} + cd ${config.system.build.manual.manual}/share/doc/nixos/ + konqueror ./index.html + ''; + + desktopFile = pkgs.writeText "nixos-manual.desktop" '' + [Desktop Entry] + Version=1.0 + Type=Application + Name=NixOS Manual + Exec=${openManual} + Icon=konqueror + ''; + + in '' + mkdir -p /root/Desktop + ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop + ln -sfT ${pkgs.kde4.konsole}/share/applications/kde4/konsole.desktop /root/Desktop/konsole.desktop + ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop + ''; + + services.xserver.desktopManager.kde4.kdeWorkspacePackage = let + pkg = pkgs.kde4.kde_workspace; + + plasmaInit = pkgs.writeText "00-defaultLayout.js" '' + loadTemplate("org.kde.plasma-desktop.defaultPanel") + + for (var i = 0; i < screenCount; ++i) { + var desktop = new Activity + desktop.name = i18n("Desktop") + desktop.screen = i + desktop.wallpaperPlugin = 'image' + desktop.wallpaperMode = 'SingleImage' + + var folderview = desktop.addWidget("folderview"); + folderview.writeConfig("url", "desktop:/"); + + //Create more panels for other screens + if (i > 0){ + var panel = new Panel + panel.screen = i + panel.location = 'bottom' + panel.height = screenGeometry(i).height > 1024 ? 35 : 27 + var tasks = panel.addWidget("tasks") + tasks.writeConfig("showOnlyCurrentScreen", true); + } + } + ''; + + in + pkgs.stdenv.mkDerivation { + inherit (pkg) name meta; + + buildCommand = '' + mkdir -p $out + cp -prf ${pkg}/* $out/ + chmod a+w $out/share/apps/plasma-desktop/init + cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js + ''; + }; + } diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 073a22207652..ea7d9763ce64 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -131,5 +131,6 @@ in zipModules ([] ++ obsolete' [ "programs" "bash" "enable" ] ++ obsolete' [ "services" "samba" "defaultShare" ] ++ obsolete' [ "services" "syslog-ng" "serviceName" ] +++ obsolete' [ "services" "syslog-ng" "listenToJournal" ] ) diff --git a/nixos/modules/services/backup/rsnapshot.nix b/nixos/modules/services/backup/rsnapshot.nix index 091b5cfd4d59..fb25bd9dd1e8 100644 --- a/nixos/modules/services/backup/rsnapshot.nix +++ b/nixos/modules/services/backup/rsnapshot.nix @@ -39,11 +39,20 @@ in as retain options. ''; }; + + package = mkOption { + type = types.package; + default = pkgs.rsnapshot; + example = literalExample "pkgs.rsnapshotGit"; + description = '' + RSnapshot package to use. + ''; + }; }; }; config = mkIf cfg.enable (let - myRsnapshot = pkgs.rsnapshot.override { configFile = rsnapshotCfg; }; + myRsnapshot = cfg.package.override { configFile = rsnapshotCfg; }; rsnapshotCfg = with pkgs; writeText "gen-rsnapshot.conf" ('' config_version 1.2 cmd_cp ${coreutils}/bin/cp diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index 41f71be2365c..117ee1c900f5 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -7,6 +7,13 @@ let pluginPath = lib.concatStringsSep ":" cfg.plugins; havePluginPath = lib.length cfg.plugins > 0; ops = lib.optionalString; + verbosityFlag = { + debug = "--debug"; + info = "--verbose"; + warn = ""; # intentionally empty + error = "--quiet"; + fatal = "--silent"; + }."${cfg.logLevel}"; in @@ -37,6 +44,12 @@ in description = "The paths to find other logstash plugins in."; }; + logLevel = mkOption { + type = types.enum [ "debug" "info" "warn" "error" "fatal" ]; + default = "warn"; + description = "Logging verbosity level."; + }; + watchdogTimeout = mkOption { type = types.int; default = 10; @@ -124,6 +137,7 @@ in "${cfg.package}/bin/logstash agent " + "-w ${toString cfg.filterWorkers} " + ops havePluginPath "--pluginpath ${pluginPath} " + + "${verbosityFlag} " + "--watchdog-timeout ${toString cfg.watchdogTimeout} " + "-f ${writeText "logstash.conf" '' input { diff --git a/nixos/modules/services/logging/syslog-ng.nix b/nixos/modules/services/logging/syslog-ng.nix index f3991a411ec4..2bf6d1ff7904 100644 --- a/nixos/modules/services/logging/syslog-ng.nix +++ b/nixos/modules/services/logging/syslog-ng.nix @@ -43,15 +43,6 @@ in { The package providing syslog-ng binaries. ''; }; - listenToJournal = mkOption { - type = types.bool; - default = true; - description = '' - Whether syslog-ng should listen to the syslog socket used - by journald, and therefore receive all logs that journald - produces. - ''; - }; extraModulePaths = mkOption { type = types.listOf types.str; default = []; @@ -74,7 +65,7 @@ in { configHeader = mkOption { type = types.lines; default = '' - @version: 3.5 + @version: 3.6 @include "scl.conf" ''; description = '' @@ -86,18 +77,13 @@ in { }; config = mkIf cfg.enable { - systemd.sockets.syslog = mkIf cfg.listenToJournal { - wantedBy = [ "sockets.target" ]; - socketConfig.Service = "syslog-ng.service"; - }; systemd.services.syslog-ng = { description = "syslog-ng daemon"; preStart = "mkdir -p /{var,run}/syslog-ng"; - wantedBy = optional (!cfg.listenToJournal) "multi-user.target"; + wantedBy = [ "multi-user.target" ]; after = [ "multi-user.target" ]; # makes sure hostname etc is set serviceConfig = { Type = "notify"; - Sockets = if cfg.listenToJournal then "syslog.socket" else null; StandardOutput = "null"; Restart = "on-failure"; ExecStart = "${cfg.package}/sbin/syslog-ng ${concatStringsSep " " syslogngOptions}"; diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix index 2061170a21b5..5c783fdbcedd 100644 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ b/nixos/modules/services/x11/desktop-managers/kde4.nix @@ -7,6 +7,7 @@ let xcfg = config.services.xserver; cfg = xcfg.desktopManager.kde4; xorg = pkgs.xorg; + kde_workspace = config.services.xserver.desktopManager.kde4.kdeWorkspacePackage; # Disable Nepomuk and Strigi by default. As of KDE 4.7, they don't # really work very well (e.g. searching files often fails to find @@ -61,6 +62,13 @@ in example = ["gstreamer" "vlc"]; description = "Which phonon multimedia backend kde should use"; }; + + kdeWorkspacePackage = mkOption { + internal = true; + default = pkgs.kde4.kde_workspace; + type = types.package; + description = "Custom kde-workspace, used for NixOS rebranding."; + }; }; environment.kdePackages = mkOption { @@ -108,13 +116,13 @@ in fi # Start KDE. - exec ${pkgs.kde4.kdebase_workspace}/bin/startkde + exec ${kde_workspace}/bin/startkde ''; }; security.setuidOwners = singleton { program = "kcheckpass"; - source = "${pkgs.kde4.kdebase_workspace}/lib/kde4/libexec/kcheckpass"; + source = "${kde_workspace}/lib/kde4/libexec/kcheckpass"; owner = "root"; group = "root"; setuid = true; @@ -124,7 +132,7 @@ in [ pkgs.kde4.kdelibs pkgs.kde4.kde_baseapps # Splitted kdebase - pkgs.kde4.kde_workspace + kde_workspace pkgs.kde4.kde_runtime pkgs.kde4.konsole pkgs.kde4.kate diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 004ea6ef49ac..899c5a91fb33 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -68,14 +68,14 @@ let # Start PulseAudio if enabled. ${optionalString (config.hardware.pulseaudio.enable) '' ${optionalString (!config.hardware.pulseaudio.systemWide) - "${pkgs.pulseaudio}/bin/pulseaudio --start" + "${config.hardware.pulseaudio.package}/bin/pulseaudio --start" } # Publish access credentials in the root window. - ${pkgs.pulseaudio}/bin/pactl load-module module-x11-publish "display=$DISPLAY" + ${config.hardware.pulseaudio.package}/bin/pactl load-module module-x11-publish "display=$DISPLAY" # Keep track of devices. Mostly useful for Phonon/KDE. - ${pkgs.pulseaudio}/bin/pactl load-module module-device-manager "do_routing=1" + ${config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" ''} # Load X defaults. diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix index f5b394b6d98b..d9e4bd817a51 100644 --- a/nixos/modules/services/x11/hardware/synaptics.nix +++ b/nixos/modules/services/x11/hardware/synaptics.nix @@ -25,12 +25,14 @@ in { services.xserver.synaptics = { enable = mkOption { + type = types.bool; default = false; example = true; description = "Whether to enable touchpad support."; }; dev = mkOption { + type = types.nullOr types.str; default = null; example = "/dev/input/event0"; description = @@ -59,41 +61,56 @@ in { }; twoFingerScroll = mkOption { + type = types.bool; default = false; description = "Whether to enable two-finger drag-scrolling."; }; vertEdgeScroll = mkOption { + type = types.bool; default = ! cfg.twoFingerScroll; description = "Whether to enable vertical edge drag-scrolling."; }; tapButtons = mkOption { + type = types.bool; default = true; example = false; description = "Whether to enable tap buttons."; }; buttonsMap = mkOption { + type = types.listOf types.int; default = [1 2 3]; example = [1 3 2]; description = "Remap touchpad buttons."; apply = map toString; }; + fingersMap = mkOption { + type = types.listOf types.int; + default = [1 2 3]; + example = [1 3 2]; + description = "Remap several-fingers taps."; + apply = map toString; + }; + palmDetect = mkOption { + type = types.bool; default = false; example = true; description = "Whether to enable palm detection (hardware support required)"; }; horizontalScroll = mkOption { + type = types.bool; default = true; example = false; description = "Whether to enable horizontal scrolling (on touchpad)"; }; additionalOptions = mkOption { + type = types.str; default = ""; example = '' Option "RTCornerButton" "2" @@ -130,6 +147,9 @@ in { Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}" Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}" Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}" + Option "TapButton1" "${builtins.elemAt cfg.fingersMap 0}" + Option "TapButton2" "${builtins.elemAt cfg.fingersMap 1}" + Option "TapButton3" "${builtins.elemAt cfg.fingersMap 2}" Option "VertTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}" Option "HorizTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}" Option "VertEdgeScroll" "${if cfg.vertEdgeScroll then "1" else "0"}" diff --git a/nixos/release-small.nix b/nixos/release-small.nix index 4099d9147422..07cd672843ea 100644 --- a/nixos/release-small.nix +++ b/nixos/release-small.nix @@ -65,6 +65,7 @@ in rec { mysql51 mysql55 nginx + nodejs openjdk openssh php |