diff options
author | Thomas Tuegel <ttuegel@gmail.com> | 2015-04-29 11:33:28 -0500 |
---|---|---|
committer | Thomas Tuegel <ttuegel@gmail.com> | 2015-04-29 11:33:28 -0500 |
commit | 1fe28a11327ad7695ee9f023c74bd47894494bcb (patch) | |
tree | e9709816cebecf2e31a36ffcb3e1f0e607175bdc /nixos | |
parent | 85aafda509b626e68595facba1aeb7da336ce537 (diff) | |
parent | 182acabbae644182ee6dafc9779e63abd7991f8c (diff) | |
download | nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.tar nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.tar.gz nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.tar.bz2 nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.tar.lz nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.tar.xz nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.tar.zst nixlib-1fe28a11327ad7695ee9f023c74bd47894494bcb.zip |
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/installer/cd-dvd/installation-cd-base.nix | 3 | ||||
-rw-r--r-- | nixos/modules/installer/tools/nixos-install.sh | 12 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 2 | ||||
-rw-r--r-- | nixos/modules/profiles/base.nix | 2 | ||||
-rw-r--r-- | nixos/modules/profiles/installation-device.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/audio/alsa.nix | 27 | ||||
-rw-r--r-- | nixos/modules/services/cluster/kubernetes.nix | 12 | ||||
-rw-r--r-- | nixos/modules/services/hardware/actkbd.nix | 130 | ||||
-rw-r--r-- | nixos/modules/services/misc/ripple-data-api.nix | 30 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/apache-httpd/mediawiki.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/apache-httpd/per-server-options.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/nginx/default.nix | 1 | ||||
-rw-r--r-- | nixos/modules/virtualisation/google-compute-config.nix | 4 |
13 files changed, 217 insertions, 20 deletions
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix index fde9989e1f97..446d79ce2200 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix @@ -45,9 +45,6 @@ with lib; # Get a console as soon as the initrd loads fbcon on EFI boot. boot.initrd.kernelModules = [ "fbcon" ]; - # Configure host id for ZFS to work - networking.hostId = "8425e349"; - # Allow the user to log in as root without a password. users.extraUsers.root.initialHashedPassword = ""; } diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index 14ae3daace0b..097631eda9c9 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -45,7 +45,9 @@ while [ "$#" -gt 0 ]; do ;; --chroot) runChroot=1 - chrootCommand=("$@") + if [[ "$@" != "" ]]; then + chrootCommand=("$@") + fi break ;; --help) @@ -254,8 +256,14 @@ NIXOS_INSTALL_GRUB=1 chroot $mountPoint \ chroot $mountPoint /nix/var/nix/profiles/system/activate +# Some systems may not be prepared to use NixOS' paths. +export PATH=/run/current-system/sw/bin:/run/current-system/sw/sbin:$PATH +export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos:nixpkgs=/etc/nixos/nixpkgs +export NIX_PATH=$NIX_PATH:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels + + # Ask the user to set a root password. -if [ "$(chroot $mountPoint nix-instantiate --eval '<nixos>' -A config.users.mutableUsers)" = true ] && [ -t 0 ] ; then +if [ "$(chroot $mountPoint nix-instantiate --eval '<nixpkgs/nixos>' -A config.users.mutableUsers)" = true ] && [ -t 1 ] ; then echo "setting root password..." chroot $mountPoint /var/setuid-wrappers/passwd fi diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index f67d5aad63d8..61cc551f4358 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -149,6 +149,7 @@ ./services/games/minecraft-server.nix ./services/games/minetest-server.nix ./services/hardware/acpid.nix + ./services/hardware/actkbd.nix ./services/hardware/amd-hybrid-graphics.nix ./services/hardware/bluetooth.nix ./services/hardware/freefall.nix @@ -271,6 +272,7 @@ ./services/networking/haproxy.nix ./services/networking/hostapd.nix ./services/networking/i2pd.nix + ./services/networking/i2p.nix ./services/networking/ifplugd.nix ./services/networking/iodined.nix ./services/networking/ircd-hybrid/default.nix diff --git a/nixos/modules/profiles/base.nix b/nixos/modules/profiles/base.nix index 0d40b7112df7..6c8e99943797 100644 --- a/nixos/modules/profiles/base.nix +++ b/nixos/modules/profiles/base.nix @@ -54,4 +54,6 @@ # Include support for various filesystems. boot.supportedFilesystems = [ "btrfs" "reiserfs" "vfat" "f2fs" "zfs" "ntfs" "cifs" ]; + # Configure host id for ZFS to work + networking.hostId = "8425e349"; } diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix index f1e733080573..a41d17e51821 100644 --- a/nixos/modules/profiles/installation-device.nix +++ b/nixos/modules/profiles/installation-device.nix @@ -26,10 +26,6 @@ with lib; # Disable some other stuff we don't need. security.sudo.enable = false; - # Include only the en_US locale. This saves 75 MiB or so compared to - # the full glibcLocales package. - i18n.supportedLocales = ["en_US.UTF-8/UTF-8" "en_US/ISO-8859-1"]; - # Automatically log in at the virtual consoles. services.mingetty.autologinUser = "root"; diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index 653c0ed5d70b..c63f4dc8d7f1 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -33,6 +33,16 @@ in ''; }; + enableMediaKeys = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable volume and capture control with keyboard media keys. + + Enabling this will turn on <option>services.actkbd</option>. + ''; + }; + extraConfig = mkOption { type = types.lines; default = ""; @@ -80,6 +90,23 @@ in }; }; + services.actkbd = mkIf config.sound.enableMediaKeys { + enable = true; + bindings = [ + # "Mute" media key + { keys = [ 113 ]; events = [ "key" ]; command = "${alsaUtils}/bin/amixer -q set Master toggle"; } + + # "Lower Volume" media key + { keys = [ 114 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1- unmute"; } + + # "Raise Volume" media key + { keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1+ unmute"; } + + # "Mic Mute" media key + { keys = [ 190 ]; events = [ "key" ]; command = "${alsaUtils}/bin/amixer -q set Capture toggle"; } + ]; + }; + }; } diff --git a/nixos/modules/services/cluster/kubernetes.nix b/nixos/modules/services/cluster/kubernetes.nix index d9ae0454ba5e..6a775bb159fc 100644 --- a/nixos/modules/services/cluster/kubernetes.nix +++ b/nixos/modules/services/cluster/kubernetes.nix @@ -224,7 +224,7 @@ in { machines = mkOption { description = "Kubernetes controller list of machines to schedule to schedule onto"; - default = []; + default = [config.networking.hostName]; type = types.listOf types.str; }; @@ -310,6 +310,12 @@ in { type = types.str; }; + master = mkOption { + description = "Kubernetes apiserver address"; + default = "${cfg.apiserver.address}:${toString cfg.apiserver.port}"; + type = types.str; + }; + extraOpts = mkOption { description = "Kubernetes proxy extra command line options."; default = ""; @@ -355,6 +361,7 @@ in { --secure_port=${toString cfg.apiserver.securePort} \ --portal_net=${cfg.apiserver.portalNet} \ --logtostderr=true \ + --runtime_config=api/v1beta3 \ ${optionalString cfg.verbose "--v=6 --log_flush_frequency=1s"} \ ${cfg.apiserver.extraOpts} ''; @@ -416,7 +423,6 @@ in { script = '' export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH" exec ${cfg.package}/bin/kubelet \ - --etcd_servers=${concatMapStringsSep "," (f: "http://${f}") cfg.etcdServers} \ --api_servers=${concatMapStringsSep "," (f: "http://${f}") cfg.kubelet.apiServers} \ --address=${cfg.kubelet.address} \ --port=${toString cfg.kubelet.port} \ @@ -443,7 +449,7 @@ in { after = [ "network-interfaces.target" "etcd.service" ]; serviceConfig = { ExecStart = ''${cfg.package}/bin/kube-proxy \ - --etcd_servers=${concatMapStringsSep "," (s: "http://${s}") cfg.etcdServers} \ + --master=${cfg.proxy.master} \ --bind_address=${cfg.proxy.address} \ --logtostderr=true \ ${optionalString cfg.verbose "--v=6 --log_flush_frequency=1s"} \ diff --git a/nixos/modules/services/hardware/actkbd.nix b/nixos/modules/services/hardware/actkbd.nix new file mode 100644 index 000000000000..82de362c371b --- /dev/null +++ b/nixos/modules/services/hardware/actkbd.nix @@ -0,0 +1,130 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.actkbd; + + configFile = pkgs.writeText "actkbd.conf" '' + ${concatMapStringsSep "\n" + ({ keys, events, attributes, command, ... }: + ''${concatMapStringsSep "+" toString keys}:${concatStringsSep "," events}:${concatStringsSep "," attributes}:${command}'' + ) + cfg.bindings} + ${cfg.extraConfig} + ''; + + bindingCfg = { config, ... }: { + options = { + + keys = mkOption { + type = types.listOf types.int; + description = "List of keycodes to match."; + }; + + events = mkOption { + type = types.listOf (types.enum ["key" "rep" "rel"]); + default = [ "key" ]; + description = "List of events to match."; + }; + + attributes = mkOption { + type = types.listOf types.str; + default = [ "exec" ]; + description = "List of attributes."; + }; + + command = mkOption { + type = types.str; + default = ""; + description = "What to run."; + }; + + }; + }; + +in + +{ + + ###### interface + + options = { + + services.actkbd = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable the <command>actkbd</command> key mapping daemon. + + Turning this on will start an <command>actkbd</command> + instance for every evdev input that has at least one key + (which is okay even for systems with tiny memory footprint, + since actkbd normally uses <100 bytes of memory per + instance). + + This allows binding keys globally without the need for e.g. + X11. + ''; + }; + + bindings = mkOption { + type = types.listOf (types.submodule bindingCfg); + default = []; + example = lib.literalExample '' + [ { keys = [ 113 ]; events = [ "key" ]; command = "''${pkgs.alsaUtils}/bin/amixer -q set Master toggle"; } + ] + ''; + description = '' + Key bindings for <command>actkbd</command>. + + See <command>actkbd</command> <filename>README</filename> for documentation. + + The example shows a piece of what <option>sound.enableMediaKeys</option> does when enabled. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Literal contents to append to the end of actkbd configuration file. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + services.udev.packages = lib.singleton (pkgs.writeTextFile { + name = "actkbd-udev-rules"; + destination = "/etc/udev/rules.d/61-actkbd.rules"; + text = '' + ACTION=="add", SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_KEY}=="1", TAG+="systemd", ENV{SYSTEMD_WANTS}+="actkbd@$env{DEVNAME}.service" + ''; + }); + + systemd.services."actkbd@" = { + enable = true; + restartIfChanged = true; + unitConfig = { + Description = "actkbd on %I"; + ConditionPathExists = "%I"; + }; + serviceConfig = { + Type = "forking"; + ExecStart = "${pkgs.actkbd}/bin/actkbd -D -c ${configFile} -d %I"; + }; + }; + + }; + +} diff --git a/nixos/modules/services/misc/ripple-data-api.nix b/nixos/modules/services/misc/ripple-data-api.nix index 6e5ac7ab00bd..3b281449a256 100644 --- a/nixos/modules/services/misc/ripple-data-api.nix +++ b/nixos/modules/services/misc/ripple-data-api.nix @@ -43,6 +43,24 @@ in { type = types.int; }; + importMode = mkOption { + description = "Ripple data api import mode."; + default = "liveOnly"; + type = types.enum ["live" "liveOnly"]; + }; + + minLedger = mkOption { + description = "Ripple data api minimal ledger to fetch."; + default = null; + type = types.nullOr types.int; + }; + + maxLedger = mkOption { + description = "Ripple data api maximal ledger to fetch."; + default = null; + type = types.nullOr types.int; + }; + redis = { enable = mkOption { description = "Whether to enable caching of ripple data to redis."; @@ -129,6 +147,7 @@ in { serviceConfig = { ExecStart = "${pkgs.ripple-data-api}/bin/api"; + Restart = "always"; User = "ripple-data-api"; }; }; @@ -145,8 +164,15 @@ in { LOG_FILE = "/dev/null"; }; - serviceConfig = { - ExecStart = "${pkgs.ripple-data-api}/bin/importer live debug2"; + serviceConfig = let + importMode = + if cfg.minLedger != null && cfg.maxLedger != null then + "${toString cfg.minLedger} ${toString cfg.maxLedger}" + else + cfg.importMode; + in { + ExecStart = "${pkgs.ripple-data-api}/bin/importer ${importMode} debug"; + Restart = "always"; User = "ripple-data-api"; }; diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix index c0ed20416397..52d8c89baff2 100644 --- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix +++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix @@ -83,11 +83,11 @@ let # Unpack Mediawiki and put the config file in its root directory. mediawikiRoot = pkgs.stdenv.mkDerivation rec { - name= "mediawiki-1.23.3"; + name= "mediawiki-1.23.9"; src = pkgs.fetchurl { url = "http://download.wikimedia.org/mediawiki/1.23/${name}.tar.gz"; - sha256 = "0l6798jwjwk2khfnm84mgc65ij53a8pnv30wdnn15ys4ivia4bpf"; + sha256 = "1l7k4g0pgz92yvrfr52w26x740s4362v0gc95pk0i30vn2sp5bql"; }; skins = config.skins; @@ -142,6 +142,7 @@ in RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d ${concatMapStringsSep "\n" (u: "RewriteCond %{REQUEST_URI} !^${u.urlPath}") serverInfo.vhostConfig.servedDirs} + ${concatMapStringsSep "\n" (u: "RewriteCond %{REQUEST_URI} !^${u.urlPath}") serverInfo.vhostConfig.servedFiles} RewriteRule ${if config.enableUploads then "!^/images" else "^.*\$" diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix index 9fb25c37f5b1..5abcc5e74900 100644 --- a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix +++ b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix @@ -57,7 +57,8 @@ with lib; }; sslServerChain = mkOption { - type = types.path; + type = types.nullOr types.path; + default = null; example = "/var/ca.pem"; description = "Path to server SSL chain file."; }; @@ -96,7 +97,7 @@ with lib; default = []; example = [ { urlPath = "/foo/bar.png"; - dir = "/home/eelco/some-file.png"; + files = "/home/eelco/some-file.png"; } ]; description = '' diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index 0f21ef012639..fe50c182bfe5 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -102,6 +102,7 @@ in ''; serviceConfig = { ExecStart = "${nginx}/bin/nginx -c ${configFile} -p ${cfg.stateDir}"; + ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; Restart = "on-failure"; RestartSec = "10s"; StartLimitInterval = "1min"; diff --git a/nixos/modules/virtualisation/google-compute-config.nix b/nixos/modules/virtualisation/google-compute-config.nix index 9e6be93b6d98..f6bca1aa8579 100644 --- a/nixos/modules/virtualisation/google-compute-config.nix +++ b/nixos/modules/virtualisation/google-compute-config.nix @@ -1,5 +1,5 @@ -{ config, pkgs, modulesPath, ... }: +{ config, pkgs, ... }: { - imports = [ "${modulesPath}/virtualisation/google-compute-image.nix" ]; + imports = [ <nixpkgs/nixos/modules/virtualisation/google-compute-image.nix> ]; } |