about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/misc/ids.nix1
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/bash/bash.nix4
-rw-r--r--nixos/modules/services/cluster/kubernetes.nix1
-rw-r--r--nixos/modules/services/databases/influxdb.nix239
-rw-r--r--nixos/modules/services/misc/devmon.nix8
-rw-r--r--nixos/modules/services/monitoring/bosun.nix28
-rw-r--r--nixos/modules/services/monitoring/grafana.nix193
-rw-r--r--nixos/modules/services/monitoring/heapster.nix57
-rw-r--r--nixos/modules/services/networking/nix-serve.nix2
-rw-r--r--nixos/modules/services/scheduling/cron.nix2
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/wordpress.nix2
-rw-r--r--nixos/modules/services/x11/display-managers/slim.nix5
-rw-r--r--nixos/modules/system/boot/systemd-unit-options.nix9
-rw-r--r--nixos/modules/system/boot/systemd.nix2
-rw-r--r--nixos/modules/tasks/filesystems.nix16
-rw-r--r--nixos/modules/tasks/scsi-link-power-management.nix34
17 files changed, 268 insertions, 336 deletions
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index de9a318fdd24..b1130c2b124b 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -235,6 +235,7 @@
       kibana = 211;
       xtreemfs = 212;
       calibre-server = 213;
+      heapster = 214;
 
       # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
 
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 242571d41baa..ecdf2264d698 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -239,6 +239,7 @@
   ./services/monitoring/dd-agent.nix
   ./services/monitoring/grafana.nix
   ./services/monitoring/graphite.nix
+  ./services/monitoring/heapster.nix
   ./services/monitoring/monit.nix
   ./services/monitoring/munin.nix
   ./services/monitoring/nagios.nix
diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix
index 75efd5e29039..1c3c07a1c210 100644
--- a/nixos/modules/programs/bash/bash.nix
+++ b/nixos/modules/programs/bash/bash.nix
@@ -90,8 +90,8 @@ in
 
       promptInit = mkOption {
         default = ''
-          if test "$TERM" != "dumb"; then
-            # Provide a nice prompt.
+          # Provide a nice prompt if the terminal supports it.
+          if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then
             PROMPT_COLOR="1;31m"
             let $UID && PROMPT_COLOR="1;32m"
             PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
diff --git a/nixos/modules/services/cluster/kubernetes.nix b/nixos/modules/services/cluster/kubernetes.nix
index a06384e27139..42efde36678f 100644
--- a/nixos/modules/services/cluster/kubernetes.nix
+++ b/nixos/modules/services/cluster/kubernetes.nix
@@ -512,6 +512,7 @@ in {
         wantedBy = [ "multi-user.target" ];
         requires = ["kubernetes-setup.service"];
         after = [ "network-interfaces.target" "etcd.service" "docker.service" ];
+        path = [ pkgs.gitMinimal pkgs.openssh ];
         script = ''
           export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH"
           exec ${cfg.package}/bin/kubelet \
diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix
index 08963f7aab7f..8d63f14c67b5 100644
--- a/nixos/modules/services/databases/influxdb.nix
+++ b/nixos/modules/services/databases/influxdb.nix
@@ -5,43 +5,103 @@ with lib;
 let
   cfg = config.services.influxdb;
 
-  influxdbConfig = pkgs.writeText "config.toml" ''
-    bind-address = "${cfg.bindAddress}"
+  configOptions = recursiveUpdate {
+    meta = {
+      bind-address = ":8088";
+      commit-timeout = "50ms";
+      dir = "${cfg.dataDir}/meta";
+      election-timeout = "1s";
+      heartbeat-timeout = "1s";
+      hostname = "localhost";
+      leader-lease-timeout = "500ms";
+      retention-autocreate = true;
+    };
+
+    data = {
+      dir = "${cfg.dataDir}/data";
+      wal-dir = "${cfg.dataDir}/wal";
+      max-wal-size = 104857600;
+      wal-enable-logging = true;
+      wal-flush-interval = "10m";
+      wal-partition-flush-delay = "2s";
+    };
+
+    cluster = {
+      shard-writer-timeout = "5s";
+      write-timeout = "5s";
+    };
 
-    [logging]
-    level  = "info"
-    file   = "stdout"
+    retention = {
+      enabled = true;
+      check-interval = "30m";
+    };
 
-    [admin]
-    port   = ${toString cfg.adminPort}
-    assets = "${pkgs.influxdb}/share/influxdb/admin"
+    http = {
+      enabled = true;
+      auth-enabled = false;
+      bind-address = ":8086";
+      https-enabled = false;
+      log-enabled = true;
+      pprof-enabled = false;
+      write-tracing = false;
+    };
 
-    [api]
-    port   = ${toString cfg.apiPort}
-    ${cfg.apiExtraConfig}
+    monitor = {
+      store-enabled = false;
+      store-database = "_internal";
+      store-interval = "10s";
+    };
 
-    [input_plugins]
-      ${cfg.inputPluginsConfig}
+    admin = {
+      enabled = true;
+      bind-address = ":8083";
+      https-enabled = false;
+    };
 
-    [raft]
-    dir = "${cfg.dataDir}/raft"
-    ${cfg.raftConfig}
+    graphite = [{
+      enabled = false;
+    }];
 
-    [storage]
-    dir = "${cfg.dataDir}/db"
-    ${cfg.storageConfig}
+    udp = [{
+      enabled = false;
+    }];
 
-    [cluster]
-    ${cfg.clusterConfig}
+    collectd = {
+      enabled = false;
+      typesdb = "${pkgs.collectd}/share/collectd/types.db";
+      database = "collectd_db";
+      port = 25826;
+    };
 
-    [sharding]
-      ${cfg.shardingConfig}
+    opentsdb = {
+      enabled = false;
+    };
 
-    [wal]
-    dir = "${cfg.dataDir}/wal"
-    ${cfg.walConfig}
+    continuous_queries = {
+      enabled = true;
+      log-enabled = true;
+      recompute-previous-n = 2;
+      recompute-no-older-than = "10m";
+      compute-runs-per-interval = 10;
+      compute-no-more-than = "2m";
+    };
 
-    ${cfg.extraConfig}
+    hinted-handoff = {
+      enabled = true;
+      dir = "${cfg.dataDir}/hh";
+      max-size = 1073741824;
+      max-age = "168h";
+      retry-rate-limit = 0;
+      retry-interval = "1s";
+    };
+  } cfg.extraConfig;
+
+  configFile = pkgs.runCommand "config.toml" {
+    buildInputs = [ pkgs.remarshal ];
+  } ''
+    remarshal -if json -of toml \
+      < ${pkgs.writeText "config.json" (builtins.toJSON configOptions)} \
+      > $out
   '';
 in
 {
@@ -82,124 +142,10 @@ in
         type = types.path;
       };
 
-      bindAddress = mkOption {
-        default = "127.0.0.1";
-        description = "Address where influxdb listens";
-        type = types.str;
-      };
-
-      adminPort = mkOption {
-        default = 8083;
-        description = "The port where influxdb admin listens";
-        type = types.int;
-      };
-
-      apiPort = mkOption {
-        default = 8086;
-        description = "The port where influxdb api listens";
-        type = types.int;
-      };
-
-      apiExtraConfig = mkOption {
-        default = ''
-          read-timeout = "5s"
-        '';
-        description = "Extra influxdb api configuration";
-        example = ''
-          ssl-port = 8084
-          ssl-cert = /path/to/cert.pem
-          read-timeout = "5s"
-        '';
-        type = types.lines;
-      };
-
-      inputPluginsConfig = mkOption {
-        default = "";
-        description = "Configuration of influxdb extra plugins";
-        example = ''
-          [input_plugins.graphite]
-          enabled = true
-          port = 2003
-          database = "graphite"
-        '';
-      };
-
-      raftConfig = mkOption {
-        default = ''
-          port = 8090
-        '';
-        description = "Influxdb raft configuration";
-        type = types.lines;
-      };
-
-      storageConfig = mkOption {
-        default = ''
-          write-buffer-size = 10000
-        '';
-        description = "Influxdb raft configuration";
-        type = types.lines;
-      };
-
-      clusterConfig = mkOption {
-        default = ''
-          protobuf_port = 8099
-          protobuf_timeout = "2s"
-          protobuf_heartbeat = "200ms"
-          protobuf_min_backoff = "1s"
-          protobuf_max_backoff = "10s"
-
-          write-buffer-size = 10000
-          max-response-buffer-size = 100
-
-          concurrent-shard-query-limit = 10
-        '';
-        description = "Influxdb cluster configuration";
-        type = types.lines;
-      };
-
-      leveldbConfig = mkOption {
-        default = ''
-          max-open-files = 40
-          lru-cache-size = "200m"
-          max-open-shards = 0
-          point-batch-size = 100
-          write-batch-size = 5000000
-        '';
-        description = "Influxdb leveldb configuration";
-        type = types.lines;
-      };
-
-      shardingConfig = mkOption {
-        default = ''
-          replication-factor = 1
-
-          [sharding.short-term]
-          duration = "7d"
-          split = 1
-
-          [sharding.long-term]
-          duration = "30d"
-          split = 1
-        '';
-        description = "Influxdb sharding configuration";
-        type = types.lines;
-      };
-
-      walConfig = mkOption {
-        default = ''
-          flush-after = 1000
-          bookmark-after = 1000
-          index-after = 1000
-          requests-per-logfile = 10000
-        '';
-        description = "Influxdb write-ahead log configuration";
-        type = types.lines;
-      };
-
       extraConfig = mkOption {
-        default = "";
+        default = {};
         description = "Extra configuration options for influxdb";
-        type = types.string;
+        type = types.attrs;
       };
     };
 
@@ -215,7 +161,7 @@ in
       wantedBy = [ "multi-user.target" ];
       after = [ "network-interfaces.target" ];
       serviceConfig = {
-        ExecStart = ''${cfg.package}/bin/influxdb -config "${influxdbConfig}"'';
+        ExecStart = ''${cfg.package}/bin/influxd -config "${configFile}"'';
         User = "${cfg.user}";
         Group = "${cfg.group}";
         PermissionsStartOnly = true;
@@ -224,11 +170,6 @@ in
         mkdir -m 0770 -p ${cfg.dataDir}
         if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi
       '';
-      postStart = mkBefore ''
-        until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.bindAddress}:${toString cfg.apiPort}/'; do
-          sleep 1;
-        done
-      '';
     };
 
     users.extraUsers = optional (cfg.user == "influxdb") {
diff --git a/nixos/modules/services/misc/devmon.nix b/nixos/modules/services/misc/devmon.nix
index 7a1f7c2e079e..9dc8fee2964b 100644
--- a/nixos/modules/services/misc/devmon.nix
+++ b/nixos/modules/services/misc/devmon.nix
@@ -18,11 +18,13 @@ in {
   };
 
   config = mkIf cfg.enable {
-    systemd.services.devmon = {
+    systemd.user.services.devmon = {
       description = "devmon automatic device mounting daemon";
-      wantedBy = [ "multi-user.target" ];
-      path = [ pkgs.udevil ];
+      wantedBy = [ "default.target" ];
+      path = [ pkgs.udevil pkgs.procps pkgs.udisks2 pkgs.which ];
       serviceConfig.ExecStart = "${pkgs.udevil}/bin/devmon";
     };
+
+    services.udisks2.enable = true;
   };
 }
diff --git a/nixos/modules/services/monitoring/bosun.nix b/nixos/modules/services/monitoring/bosun.nix
index ebe4741f01bd..214a19d9483f 100644
--- a/nixos/modules/services/monitoring/bosun.nix
+++ b/nixos/modules/services/monitoring/bosun.nix
@@ -6,9 +6,11 @@ let
   cfg = config.services.bosun;
 
   configFile = pkgs.writeText "bosun.conf" ''
-    tsdbHost = ${cfg.opentsdbHost}
+    ${optionalString (cfg.opentsdbHost !=null) "tsdbHost = ${cfg.opentsdbHost}"}
+    ${optionalString (cfg.influxHost !=null) "influxHost = ${cfg.influxHost}"}
     httpListen = ${cfg.listenAddress}
     stateFile = ${cfg.stateFile}
+    ledisDir = ${cfg.ledisDir}
     checkFrequency = ${cfg.checkFrequency}
 
     ${cfg.extraConfig}
@@ -54,10 +56,20 @@ in {
       };
 
       opentsdbHost = mkOption {
-        type = types.string;
+        type = types.nullOr types.string;
         default = "localhost:4242";
         description = ''
           Host and port of the OpenTSDB database that stores bosun data.
+          To disable opentsdb you can pass null as parameter.
+        '';
+      };
+
+      influxHost = mkOption {
+        type = types.nullOr types.string;
+        default = null;
+        example = "localhost:8086";
+        description = ''
+           Host and port of the influxdb database.
         '';
       };
 
@@ -70,13 +82,21 @@ in {
       };
 
       stateFile = mkOption {
-        type = types.string;
+        type = types.path;
         default = "/var/lib/bosun/bosun.state";
         description = ''
           Path to bosun's state file.
         '';
       };
 
+      ledisDir = mkOption {
+        type = types.path;
+        default = "/var/lib/bosun/ledis_data";
+        description = ''
+          Path to bosun's ledis data dir
+        '';
+      };
+
       checkFrequency = mkOption {
         type = types.str;
         default = "5m";
@@ -103,7 +123,7 @@ in {
   };
 
   config = mkIf cfg.enable {
-  
+
     systemd.services.bosun = {
       description = "bosun metrics collector (part of Bosun)";
       wantedBy = [ "multi-user.target" ];
diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix
index 5302728eae91..6053990e8d3b 100644
--- a/nixos/modules/services/monitoring/grafana.nix
+++ b/nixos/modules/services/monitoring/grafana.nix
@@ -7,150 +7,37 @@ let
 
   b2s = val: if val then "true" else "false";
 
-  cfgFile = pkgs.writeText "grafana.ini" ''
-    app_name = grafana
-    app_mode = production
-
-    [server]
-    ; protocol (http or https)
-    protocol = ${cfg.protocol}
-    ; the ip address to bind to, empty will bind to all interfaces
-    http_addr = ${cfg.addr}
-    ; the http port  to use
-    http_port = ${toString cfg.port}
-    ; The public facing domain name used to access grafana from a browser
-    domain = ${cfg.domain}
-    ; the full public facing url
-    root_url = ${cfg.rootUrl}
-    router_logging = false
-    ; the path relative to the binary where the static (html/js/css) files are placed
-    static_root_path = ${cfg.staticRootPath}
-    ; enable gzip
-    enable_gzip = false
-    ; https certs & key file
-    cert_file = ${cfg.certFile}
-    cert_key = ${cfg.certKey}
-
-    [analytics]
-    # Server reporting, sends usage counters to stats.grafana.org every 24 hours.
-    # No ip addresses are being tracked, only simple counters to track
-    # running instances, dashboard and error counts. It is very helpful to us.
-    # Change this option to false to disable reporting.
-    reporting_enabled = true
-    ; Google Analytics universal tracking code, only enabled if you specify an id here
-    google_analytics_ua_id =
-
-    [database]
-    ; Either "mysql", "postgres" or "sqlite3", it's your choice
-    type = ${cfg.database.type}
-    host = ${cfg.database.host}
-    name = ${cfg.database.name}
-    user = ${cfg.database.user}
-    password = ${cfg.database.password}
-    ; For "postgres" only, either "disable", "require" or "verify-full"
-    ssl_mode = disable
-    ; For "sqlite3" only
-    path = ${cfg.database.path}
-
-    [session]
-    ; Either "memory", "file", "redis", "mysql", default is "memory"
-    provider = file
-    ; Provider config options
-    ; memory: not have any config yet
-    ; file: session file path, e.g. `data/sessions`
-    ; redis: config like redis server addr, poolSize, password, e.g. `127.0.0.1:6379,100,grafana`
-    ; mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1)/database_name`
-    provider_config = data/sessions
-    ; Session cookie name
-    cookie_name = grafana_sess
-    ; If you use session in https only, default is false
-    cookie_secure = false
-    ; Session life time, default is 86400
-    session_life_time = 86400
-    ; session id hash func, Either "sha1", "sha256" or "md5" default is sha1
-    session_id_hashfunc = sha1
-    ; Session hash key, default is use random string
-    session_id_hashkey =
-
-    [security]
-    ; default admin user, created on startup
-    admin_user = ${cfg.security.adminUser}
-    ; default admin password, can be changed before first start of grafana,  or in profile settings
-    admin_password = ${cfg.security.adminPassword}
-    ; used for signing
-    secret_key = ${cfg.security.secretKey}
-    ; Auto-login remember days
-    login_remember_days = 7
-    cookie_username = grafana_user
-    cookie_remember_name = grafana_remember
-
-    [users]
-    ; disable user signup / registration
-    allow_sign_up = ${b2s cfg.users.allowSignUp}
-    ; Allow non admin users to create organizations
-    allow_org_create = ${b2s cfg.users.allowOrgCreate}
-    # Set to true to automatically assign new users to the default organization (id 1)
-    auto_assign_org = ${b2s cfg.users.autoAssignOrg}
-    ; Default role new users will be automatically assigned (if disabled above is set to true)
-    auto_assign_org_role = ${cfg.users.autoAssignOrgRole}
-
-    [auth.anonymous]
-    ; enable anonymous access
-    enabled = ${b2s cfg.auth.anonymous.enable}
-    ; specify organization name that should be used for unauthenticated users
-    org_name = Main Org.
-    ; specify role for unauthenticated users
-    org_role = Viewer
-
-    [auth.github]
-    enabled = false
-    client_id = some_id
-    client_secret = some_secret
-    scopes = user:email
-    auth_url = https://github.com/login/oauth/authorize
-    token_url = https://github.com/login/oauth/access_token
-
-    [auth.google]
-    enabled = false
-    client_id = some_client_id
-    client_secret = some_client_secret
-    scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
-    auth_url = https://accounts.google.com/o/oauth2/auth
-    token_url = https://accounts.google.com/o/oauth2/token
-
-    [log]
-    root_path = data/log
-    ; Either "console", "file", default is "console"
-    ; Use comma to separate multiple modes, e.g. "console, file"
-    mode = console
-    ; Buffer length of channel, keep it as it is if you don't know what it is.
-    buffer_len = 10000
-    ; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
-    level = Info
-
-    ; For "console" mode only
-    [log.console]
-    level =
-
-    ; For "file" mode only
-    [log.file]
-    level =
-    ; This enables automated log rotate(switch of following options), default is true
-    log_rotate = true
-    ; Max line number of single file, default is 1000000
-    max_lines = 1000000
-    ; Max size shift of single file, default is 28 means 1 << 28, 256MB
-    max_lines_shift = 28
-    ; Segment log daily, default is true
-    daily_rotate = true
-    ; Expired days of log file(delete after max days), default is 7
-    max_days = 7
-
-    [event_publisher]
-    enabled = false
-    rabbitmq_url = amqp://localhost/
-    exchange = grafana_events
-  '';
+  envOptions = {
+    PATHS_DATA = cfg.dataDir;
+    PATHS_LOGS = "${cfg.dataDir}/log";
+
+    SERVER_PROTOCOL = cfg.protocol;
+    SERVER_HTTP_ADDR = cfg.addr;
+    SERVER_HTTP_PORT = cfg.port;
+    SERVER_DOMAIN = cfg.domain;
+    SERVER_ROOT_URL = cfg.rootUrl;
+    SERVER_STATIC_ROOT_PATH = cfg.staticRootPath;
+    SERVER_CERT_FILE = cfg.certFile;
+    SERVER_CERT_KEY = cfg.certKey;
+
+    DATABASE_TYPE = cfg.database.type;
+    DATABASE_HOST = cfg.database.host;
+    DATABASE_NAME = cfg.database.name;
+    DATABASE_USER = cfg.database.user;
+    DATABASE_PASSWORD = cfg.database.password;
+    DATABASE_PATH = cfg.database.path;
+
+    SECURITY_ADMIN_USER = cfg.security.adminUser;
+    SECURITY_ADMIN_PASSWORD = cfg.security.adminPassword;
+    SECURITY_SECRET_KEY = cfg.security.secretKey;
+
+    USERS_ALLOW_SIGN_UP = b2s cfg.users.allowSignUp;
+    USERS_ALLOW_ORG_CREATE = b2s cfg.users.allowOrgCreate;
+    USERS_AUTO_ASSIGN_ORG = b2s cfg.users.autoAssignOrg;
+    USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole;
+
+    AUTH_ANONYMOUS_ENABLE = b2s cfg.auth.anonymous.enable;
+  } // cfg.extraOptions;
 
 in {
   options.services.grafana = {
@@ -306,6 +193,16 @@ in {
         type = types.bool;
       };
     };
+
+    extraOptions = mkOption {
+      description = ''
+        Extra configuration options passed as env variables as specified in
+        <link xlink:href="http://docs.grafana.org/installation/configuration/">documentation</link>,
+        but without GF_ prefix
+      '';
+      default = {};
+      type = types.attrsOf types.str;
+    };
   };
 
   config = mkIf cfg.enable {
@@ -317,11 +214,15 @@ in {
       description = "Grafana Service Daemon";
       wantedBy = ["multi-user.target"];
       after = ["networking.target"];
+      environment = mapAttrs' (n: v: nameValuePair "GF_${n}" (toString v)) envOptions;
       serviceConfig = {
-        ExecStart = "${cfg.package}/bin/grafana --config ${cfgFile} web";
+        ExecStart = "${cfg.package}/bin/grafana -homepath ${cfg.dataDir}";
         WorkingDirectory = cfg.dataDir;
         User = "grafana";
       };
+      preStart = ''
+        ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir}
+      '';
     };
 
     users.extraUsers.grafana = {
@@ -331,7 +232,7 @@ in {
       createHome = true;
     };
 
-    services.grafana.staticRootPath = mkDefault "${cfg.package.out}/share/go/src/github.com/grafana/grafana/public";
+    services.grafana.staticRootPath = mkDefault "${cfg.package}/share/grafana/public";
 
   };
 }
diff --git a/nixos/modules/services/monitoring/heapster.nix b/nixos/modules/services/monitoring/heapster.nix
new file mode 100644
index 000000000000..74b8c9ccd3ed
--- /dev/null
+++ b/nixos/modules/services/monitoring/heapster.nix
@@ -0,0 +1,57 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.heapster;
+in {
+  options.services.heapster = {
+    enable = mkOption {
+      description = "Whether to enable heapster monitoring";
+      default = false;
+      type = types.bool;
+    };
+
+    source = mkOption {
+      description = "Heapster metric source";
+      example = "kubernetes:https://kubernetes.default";
+      type = types.string;
+    };
+
+    sink = mkOption {
+      description = "Heapster metic sink";
+      example = "influxdb:http://localhost:8086";
+      type = types.string;
+    };
+
+    extraOpts = mkOption {
+      description = "Heapster extra options";
+      default = "";
+      type = types.string;
+    };
+
+    package = mkOption {
+      description = "Package to use by heapster";
+      default = pkgs.heapster;
+      type = types.package;
+    };
+  };
+
+  config = mkIf cfg.enable {
+    systemd.services.heapster = {
+      wantedBy = ["multi-user.target"];
+      after = ["cadvisor.service" "kube-apiserver.service"];
+
+      serviceConfig = {
+        ExecStart = "${cfg.package}/bin/heapster --source=${cfg.source} --sink=${cfg.sink} ${cfg.extraOpts}";
+        User = "heapster";
+      };
+    };
+
+    users.extraUsers = singleton {
+      name = "heapster";
+      uid = config.ids.uids.heapster;
+      description = "Heapster user";
+    };
+  };
+}
diff --git a/nixos/modules/services/networking/nix-serve.nix b/nixos/modules/services/networking/nix-serve.nix
index 4f8b9357a828..880a1d361dfe 100644
--- a/nixos/modules/services/networking/nix-serve.nix
+++ b/nixos/modules/services/networking/nix-serve.nix
@@ -56,7 +56,7 @@ in
 
       serviceConfig = {
         ExecStart = "${pkgs.nix-serve}/bin/nix-serve " +
-          "--port ${cfg.bindAddress}:${toString cfg.port} ${cfg.extraParams}";
+          "--listen ${cfg.bindAddress}:${toString cfg.port} ${cfg.extraParams}";
         User = "nix-serve";
         Group = "nogroup";
       };
diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix
index 1b5e83173e8f..f5e132fd77d8 100644
--- a/nixos/modules/services/scheduling/cron.nix
+++ b/nixos/modules/services/scheduling/cron.nix
@@ -39,7 +39,7 @@ in
 
       enable = mkOption {
         type = types.bool;
-        default = true;
+        example = true;
         description = "Whether to enable the Vixie cron daemon.";
       };
 
diff --git a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix
index 921f774bcaa0..7a0314027a3d 100644
--- a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix
@@ -17,10 +17,10 @@ let
     define('DB_HOST',     '${config.dbHost}');
     define('DB_CHARSET',  'utf8');
     $table_prefix  = '${config.tablePrefix}';
+    ${config.extraConfig}
     if ( !defined('ABSPATH') )
     	define('ABSPATH', dirname(__FILE__) . '/');
     require_once(ABSPATH . 'wp-settings.php');
-    ${config.extraConfig}
   '';
 
   # .htaccess to support pretty URLs
diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix
index 545f4283828a..e3db0230d3b7 100644
--- a/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixos/modules/services/x11/display-managers/slim.nix
@@ -18,6 +18,7 @@ let
       halt_cmd ${config.systemd.package}/sbin/shutdown -h now
       reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
       ${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)}
+      ${optionalString (cfg.defaultUser != null) ("focus_password yes")}
       ${optionalString cfg.autoLogin "auto_login yes"}
       ${cfg.extraConfig}
     '';
@@ -57,8 +58,8 @@ in
       theme = mkOption {
         type = types.nullOr types.path;
         default = pkgs.fetchurl {
-          url    = https://github.com/jagajaga/nixos-slim-theme/archive/1.1.tar.gz;
-          sha256 = "66c3020a6716130a20c3898567339b990fbd7888a3b7bbcb688f6544d1c05c31";
+          url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
+          sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
         };
         example = literalExample ''
           pkgs.fetchurl {
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index a7a334dec285..d4cab93b26b8 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -170,6 +170,15 @@ in rec {
       '';
     };
 
+    onFailure = mkOption {
+      default = [];
+      type = types.listOf types.str;
+      description = ''
+        A list of one or more units that are activated when
+        this unit enters the "failed" state.
+      '';
+    };
+
   };
 
 
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 0b7647093e0f..d145baeebe93 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -199,6 +199,8 @@ let
           { X-Restart-Triggers = toString config.restartTriggers; }
         // optionalAttrs (config.description != "") {
           Description = config.description;
+        } // optionalAttrs (config.onFailure != []) {
+          OnFailure = toString config.onFailure;
         };
     };
   };
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index dbe0c9c6e03a..d0dd7670157e 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -58,6 +58,15 @@ let
         '';
       };
 
+      formatOptions = mkOption {
+        default = "";
+        type = types.str;
+        description = ''
+          If <option>autoFormat</option> option is set specifies
+          extra options passed to mkfs.
+        '';
+      };
+
       autoResize = mkOption {
         default = false;
         type = types.bool;
@@ -81,6 +90,9 @@ let
       mountPoint = mkDefault name;
       device = mkIf (config.fsType == "tmpfs") (mkDefault config.fsType);
       options = mkIf config.autoResize "x-nixos.autoresize";
+
+      # -F needed to allow bare block device without partitions
+      formatOptions = mkIf ((builtins.substring 0 3 config.fsType) == "ext") (mkDefault "-F");
     };
 
   };
@@ -192,8 +204,6 @@ in
           let
             mountPoint' = escapeSystemdPath fs.mountPoint;
             device' = escapeSystemdPath fs.device;
-            # -F needed to allow bare block device without partitions
-            mkfsOpts = optional ((builtins.substring 0 3 fs.fsType) == "ext") "-F";
           in nameValuePair "mkfs-${device'}"
           { description = "Initialisation of Filesystem ${fs.device}";
             wantedBy = [ "${mountPoint'}.mount" ];
@@ -208,7 +218,7 @@ in
                 type=$(blkid -p -s TYPE -o value "${fs.device}" || true)
                 if [ -z "$type" ]; then
                   echo "creating ${fs.fsType} filesystem on ${fs.device}..."
-                  mkfs.${fs.fsType} ${concatStringsSep " " mkfsOpts} "${fs.device}"
+                  mkfs.${fs.fsType} ${fs.formatOptions} "${fs.device}"
                 fi
               '';
             unitConfig.RequiresMountsFor = [ "${dirOf fs.device}" ];
diff --git a/nixos/modules/tasks/scsi-link-power-management.nix b/nixos/modules/tasks/scsi-link-power-management.nix
index a74023dec21a..484c0a0186d7 100644
--- a/nixos/modules/tasks/scsi-link-power-management.nix
+++ b/nixos/modules/tasks/scsi-link-power-management.nix
@@ -2,18 +2,19 @@
 
 with lib;
 
+let cfg = config.powerManagement.scsiLinkPolicy; in
+
 {
   ###### interface
 
   options = {
 
     powerManagement.scsiLinkPolicy = mkOption {
-      default = "";
-      example = "min_power";
-      type = types.str;
+      default = null;
+      type = types.nullOr (types.enum [ "min_power" "max_performance" "medium_power" ]);
       description = ''
-        Configure the SCSI link power management policy. By default,
-        the kernel configures "max_performance".
+        SCSI link power management policy. The kernel default is
+        "max_performance".
       '';
     };
 
@@ -22,25 +23,10 @@ with lib;
 
   ###### implementation
 
-  config = mkIf (config.powerManagement.scsiLinkPolicy != "") {
-
-    jobs."scsi-link-pm" =
-      { description = "SCSI Link Power Management Policy";
-
-        startOn = "stopped udevtrigger";
-
-        task = true;
-
-        unitConfig.ConditionPathIsReadWrite = "/sys/class/scsi_host";
-
-        script = ''
-          shopt -s nullglob
-          for x in /sys/class/scsi_host/host*/link_power_management_policy; do
-            echo ${config.powerManagement.scsiLinkPolicy} > $x
-          done
-        '';
-      };
-
+  config = mkIf (cfg != null) {
+    services.udev.extraRules = ''
+      SUBSYSTEM=="scsi_host", ACTION=="add", KERNEL=="host*", ATTR{link_power_management_policy}="${cfg}"
+    '';
   };
 
 }