about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/i18n/input-method/fcitx.nix2
-rw-r--r--nixos/modules/installer/tools/nixos-version.sh3
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/bash/inputrc1
-rw-r--r--nixos/modules/services/games/factorio.nix4
-rw-r--r--nixos/modules/services/networking/offlineimap.nix73
-rw-r--r--nixos/modules/system/boot/coredump.nix4
-rw-r--r--nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix1
-rw-r--r--nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh9
-rw-r--r--nixos/modules/system/boot/systemd.nix2
-rw-r--r--nixos/modules/virtualisation/amazon-image.nix8
-rw-r--r--nixos/modules/virtualisation/ec2-amis.nix80
12 files changed, 140 insertions, 48 deletions
diff --git a/nixos/modules/i18n/input-method/fcitx.nix b/nixos/modules/i18n/input-method/fcitx.nix
index bdefd2d2d596..e97bb9f80eb5 100644
--- a/nixos/modules/i18n/input-method/fcitx.nix
+++ b/nixos/modules/i18n/input-method/fcitx.nix
@@ -4,7 +4,7 @@ with lib;
 
 let
   cfg = config.i18n.inputMethod.fcitx;
-  fcitxPackage = pkgs.fcitx-with-plugins.override { plugins = cfg.engines; };
+  fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; };
   fcitxEngine = types.package // {
     name  = "fcitx-engine";
     check = x: (lib.types.package.check x) && (attrByPath ["meta" "isFcitxEngine"] false x);
diff --git a/nixos/modules/installer/tools/nixos-version.sh b/nixos/modules/installer/tools/nixos-version.sh
index 51aa2dd82321..e4e4f5c446c8 100644
--- a/nixos/modules/installer/tools/nixos-version.sh
+++ b/nixos/modules/installer/tools/nixos-version.sh
@@ -1,6 +1,9 @@
 #! @shell@
 
 case "$1" in
+  --help)
+    exec man nixos-version
+    exit 1
   --hash|--revision)
     echo "@nixosRevision@"
     ;;
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 67178e765c8a..2ed711b79c45 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -368,6 +368,7 @@
   ./services/networking/ntopng.nix
   ./services/networking/ntpd.nix
   ./services/networking/nylon.nix
+  ./services/networking/offlineimap.nix
   ./services/networking/oidentd.nix
   ./services/networking/openfire.nix
   ./services/networking/openntpd.nix
diff --git a/nixos/modules/programs/bash/inputrc b/nixos/modules/programs/bash/inputrc
index e4eabc052c5f..f339eb649ed8 100644
--- a/nixos/modules/programs/bash/inputrc
+++ b/nixos/modules/programs/bash/inputrc
@@ -6,6 +6,7 @@ set meta-flag on
 set input-meta on
 set convert-meta off
 set output-meta on
+set colored-stats on
 
 #set mark-symlinked-directories on
 
diff --git a/nixos/modules/services/games/factorio.nix b/nixos/modules/services/games/factorio.nix
index 10f3daea69e4..90834c5b2605 100644
--- a/nixos/modules/services/games/factorio.nix
+++ b/nixos/modules/services/games/factorio.nix
@@ -78,7 +78,7 @@ in
           test -e ${stateDir}/saves/${cfg.saveName}.zip || \
             ${pkgs.factorio-headless}/bin/factorio         \
               --config=${cfg.configFile}                   \
-              --create=${cfg.saveName}
+              --create=${stateDir}/saves/${cfg.saveName}.zip
       '';
 
       serviceConfig = {
@@ -93,7 +93,7 @@ in
           "${pkgs.factorio-headless}/bin/factorio"
           "--config=${cfg.configFile}"
           "--port=${toString cfg.port}"
-          "--start-server=${cfg.saveName}"
+          "--start-server=${stateDir}/saves/${cfg.saveName}.zip"
         ];
       };
     };
diff --git a/nixos/modules/services/networking/offlineimap.nix b/nixos/modules/services/networking/offlineimap.nix
new file mode 100644
index 000000000000..31ce9280f319
--- /dev/null
+++ b/nixos/modules/services/networking/offlineimap.nix
@@ -0,0 +1,73 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.offlineimap;
+in {
+
+  options.services.offlineimap = {
+    enable = mkEnableOption "Offlineimap, a software to dispose your mailbox(es) as a local Maildir(s).";
+
+    install = mkOption {
+      type = types.bool;
+      default = false;
+      example = true;
+      description = ''
+        Whether to install a user service for Offlineimap. Once
+        the service is started, emails will be fetched automatically.
+
+        The service must be manually started for each user with
+        "systemctl --user start offlineimap" or globally through
+        <varname>services.offlineimap.enable</varname>.
+      '';
+    };
+
+    package = mkOption {
+      type = types.package;
+      default = pkgs.offlineimap;
+      defaultText = "pkgs.offlineimap";
+      description = "Offlineimap derivation to use.";
+    };
+
+    path = mkOption {
+      type = types.listOf types.path;
+      default = [];
+      example = literalExample "[ pkgs.pass pkgs.bash pkgs.notmuch ]";
+      description = "List of derivations to put in Offlineimap's path.";
+    };
+
+    onCalendar = mkOption {
+      type = types.str;
+      default = "*:0/3"; # every 3 minutes
+      description = "How often is offlineimap started. Default is '*:0/3' meaning every 3 minutes. See systemd.time(7) for more information about the format.";
+    };
+
+    timeoutStartSec = mkOption {
+      type = types.str;
+      default = "120sec"; # Kill if still alive after 2 minutes
+      description = "How long waiting for offlineimap before killing it. Default is '120sec' meaning every 2 minutes. See systemd.time(7) for more information about the format.";
+    };
+  };
+  config = mkIf (cfg.enable || cfg.install) {
+    systemd.user.services.offlineimap = {
+      description = "Offlineimap: a software to dispose your mailbox(es) as a local Maildir(s)";
+      serviceConfig = {
+        Type      = "oneshot";
+        ExecStart = "${cfg.package}/bin/offlineimap -u basic -o -1";
+        TimeoutStartSec = cfg.timeoutStartSec;
+      };
+      path = cfg.path;
+    };
+    environment.systemPackages = [ "${cfg.package}" ];
+    systemd.user.timers.offlineimap = {
+      description = "offlineimap timer";
+      timerConfig               = {
+        Unit = "offlineimap.service";
+        OnCalendar = cfg.onCalendar;
+        # start immediately after computer is started:
+        Persistent = "true";
+      };
+    } // optionalAttrs cfg.enable { wantedBy = [ "default.target" ]; };
+  };
+}
diff --git a/nixos/modules/system/boot/coredump.nix b/nixos/modules/system/boot/coredump.nix
index 793c7515c761..b27a35b6257d 100644
--- a/nixos/modules/system/boot/coredump.nix
+++ b/nixos/modules/system/boot/coredump.nix
@@ -36,6 +36,8 @@ with lib;
   config = mkMerge [
     (mkIf config.systemd.coredump.enable {
 
+      systemd.additionalUpstreamSystemUnits = [ "systemd-coredump.socket" "systemd-coredump@.service" ];
+
       environment.etc."systemd/coredump.conf".text =
         ''
           [Coredump]
@@ -45,7 +47,7 @@ with lib;
       # Have the kernel pass core dumps to systemd's coredump helper binary.
       # From systemd's 50-coredump.conf file. See:
       # <https://github.com/systemd/systemd/blob/v218/sysctl.d/50-coredump.conf.in>
-      boot.kernel.sysctl."kernel.core_pattern" = "|${pkgs.systemd}/lib/systemd/systemd-coredump %p %u %g %s %t %e";
+      boot.kernel.sysctl."kernel.core_pattern" = "|${pkgs.systemd}/lib/systemd/systemd-coredump %P %u %g %s %t %c %e";
     })
 
     (mkIf (!config.systemd.coredump.enable) {
diff --git a/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix b/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix
index c5c250c14cea..576a07c1d272 100644
--- a/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix
+++ b/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix
@@ -5,5 +5,4 @@ pkgs.substituteAll {
   isExecutable = true;
   path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
   inherit (pkgs) bash;
-  kernelDTB = pkgs.stdenv.platform.kernelDTB or false;
 }
diff --git a/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh b/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh
index 78a8e8fd658c..c780a89b102c 100644
--- a/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh
+++ b/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh
@@ -75,9 +75,10 @@ addEntry() {
 
     copyToKernelsDir "$path/kernel"; kernel=$result
     copyToKernelsDir "$path/initrd"; initrd=$result
-    if [ -n "@kernelDTB@" ]; then
-        # XXX UGLY: maybe the system config should have a top-level "dtbs" entry?
-        copyToKernelsDir $(readlink -m "$path/kernel/../dtbs"); dtbs=$result
+    # XXX UGLY: maybe the system config should have a top-level "dtbs" entry?
+    dtbDir=$(readlink -m "$path/kernel/../dtbs")
+    if [ -d "$dtbDir" ]; then
+        copyToKernelsDir "$dtbDir"; dtbs=$result
     fi
 
     timestampEpoch=$(stat -L -c '%Z' $path)
@@ -95,7 +96,7 @@ addEntry() {
     fi
     echo "  LINUX ../nixos/$(basename $kernel)"
     echo "  INITRD ../nixos/$(basename $initrd)"
-    if [ -n "@kernelDTB@" ]; then
+    if [ -d "$dtbDir" ]; then
         echo "  FDTDIR ../nixos/$(basename $dtbs)"
     fi
     echo "  APPEND systemConfig=$path init=$path/init $extraParams"
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index b7c09d2e4bfa..5c8cce5066af 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -764,7 +764,7 @@ in
         { wantedBy = [ "timers.target" ];
           timerConfig.OnCalendar = service.startAt;
         })
-        (filterAttrs (name: service: service.startAt != "") cfg.services);
+        (filterAttrs (name: service: service.enable && service.startAt != "") cfg.services);
 
     # Generate timer units for all services that have a ‘startAt’ value.
     systemd.user.timers =
diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix
index da5575f4b6dd..ebf398fa266f 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -20,8 +20,12 @@ let cfg = config.ec2; in
       autoResize = true;
     };
 
-    boot.extraModulePackages = [ config.boot.kernelPackages.ixgbevf ];
-    boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" "ixgbevf" ];
+    boot.extraModulePackages =
+      [ config.boot.kernelPackages.ixgbevf
+        config.boot.kernelPackages.ena
+      ];
+    boot.initrd.kernelModules = [ "xen-blkfront" "xen-netfront" ];
+    boot.initrd.availableKernelModules = [ "ixgbevf" "ena" ];
     boot.kernelParams = mkIf cfg.hvm [ "console=ttyS0" ];
 
     # Prevent the nouveau kernel module from being loaded, as it
diff --git a/nixos/modules/virtualisation/ec2-amis.nix b/nixos/modules/virtualisation/ec2-amis.nix
index 5257aaf62025..bdf6ed4dcd29 100644
--- a/nixos/modules/virtualisation/ec2-amis.nix
+++ b/nixos/modules/virtualisation/ec2-amis.nix
@@ -90,40 +90,48 @@
   "15.09".us-west-2.pv-ebs = "ami-005fb160";
   "15.09".us-west-2.pv-s3 = "ami-cd55bbad";
 
-  "16.03".ap-northeast-1.hvm-ebs = "ami-b6edf5d8";
-  "16.03".ap-northeast-1.hvm-s3 = "ami-b1e3fbdf";
-  "16.03".ap-northeast-1.pv-ebs = "ami-6190880f";
-  "16.03".ap-northeast-1.pv-s3 = "ami-908d95fe";
-  "16.03".ap-southeast-1.hvm-ebs = "ami-35b16656";
-  "16.03".ap-southeast-1.hvm-s3 = "ami-41be6922";
-  "16.03".ap-southeast-1.pv-ebs = "ami-4cb96e2f";
-  "16.03".ap-southeast-1.pv-s3 = "ami-3bb96e58";
-  "16.03".ap-southeast-2.hvm-ebs = "ami-debc91bd";
-  "16.03".ap-southeast-2.hvm-s3 = "ami-55bc9136";
-  "16.03".ap-southeast-2.pv-ebs = "ami-b38ba6d0";
-  "16.03".ap-southeast-2.pv-s3 = "ami-9e8ba6fd";
-  "16.03".eu-central-1.hvm-ebs = "ami-7c967413";
-  "16.03".eu-central-1.hvm-s3 = "ami-b29072dd";
-  "16.03".eu-central-1.pv-ebs = "ami-7a947615";
-  "16.03".eu-central-1.pv-s3 = "ami-729b791d";
-  "16.03".eu-west-1.hvm-ebs = "ami-ff27a98c";
-  "16.03".eu-west-1.hvm-s3 = "ami-6c21af1f";
-  "16.03".eu-west-1.pv-ebs = "ami-a33cb2d0";
-  "16.03".eu-west-1.pv-s3 = "ami-ec38b69f";
-  "16.03".sa-east-1.hvm-ebs = "ami-5bef6637";
-  "16.03".sa-east-1.hvm-s3 = "ami-55f87139";
-  "16.03".sa-east-1.pv-ebs = "ami-76e56c1a";
-  "16.03".sa-east-1.pv-s3 = "ami-e1f8718d";
-  "16.03".us-east-1.hvm-ebs = "ami-4bfd1926";
-  "16.03".us-east-1.hvm-s3 = "ami-60c5210d";
-  "16.03".us-east-1.pv-ebs = "ami-c0c92dad";
-  "16.03".us-east-1.pv-s3 = "ami-f9d63294";
-  "16.03".us-west-1.hvm-ebs = "ami-13aad473";
-  "16.03".us-west-1.hvm-s3 = "ami-e1a8d681";
-  "16.03".us-west-1.pv-ebs = "ami-c0a6d8a0";
-  "16.03".us-west-1.pv-s3 = "ami-6aa9d70a";
-  "16.03".us-west-2.hvm-ebs = "ami-265dad46";
-  "16.03".us-west-2.hvm-s3 = "ami-cd40b0ad";
-  "16.03".us-west-2.pv-ebs = "ami-7b4aba1b";
-  "16.03".us-west-2.pv-s3 = "ami-0849b968";
+  "16.03".ap-northeast-1.hvm-ebs = "ami-40619d21";
+  "16.03".ap-northeast-1.hvm-s3 = "ami-ce629eaf";
+  "16.03".ap-northeast-1.pv-ebs = "ami-ef639f8e";
+  "16.03".ap-northeast-1.pv-s3 = "ami-a1609cc0";
+  "16.03".ap-northeast-2.hvm-ebs = "ami-deca00b0";
+  "16.03".ap-northeast-2.hvm-s3 = "ami-a3b77dcd";
+  "16.03".ap-northeast-2.pv-ebs = "ami-7bcb0115";
+  "16.03".ap-northeast-2.pv-s3 = "ami-a2b77dcc";
+  "16.03".ap-south-1.hvm-ebs = "ami-0dff9562";
+  "16.03".ap-south-1.hvm-s3 = "ami-13f69c7c";
+  "16.03".ap-south-1.pv-ebs = "ami-0ef39961";
+  "16.03".ap-south-1.pv-s3 = "ami-e0c8a28f";
+  "16.03".ap-southeast-1.hvm-ebs = "ami-5e964a3d";
+  "16.03".ap-southeast-1.hvm-s3 = "ami-4d964a2e";
+  "16.03".ap-southeast-1.pv-ebs = "ami-ec9b478f";
+  "16.03".ap-southeast-1.pv-s3 = "ami-999b47fa";
+  "16.03".ap-southeast-2.hvm-ebs = "ami-9f7359fc";
+  "16.03".ap-southeast-2.hvm-s3 = "ami-987359fb";
+  "16.03".ap-southeast-2.pv-ebs = "ami-a2705ac1";
+  "16.03".ap-southeast-2.pv-s3 = "ami-a3705ac0";
+  "16.03".eu-central-1.hvm-ebs = "ami-17a45178";
+  "16.03".eu-central-1.hvm-s3 = "ami-f9a55096";
+  "16.03".eu-central-1.pv-ebs = "ami-c8a550a7";
+  "16.03".eu-central-1.pv-s3 = "ami-6ea45101";
+  "16.03".eu-west-1.hvm-ebs = "ami-b5b3d5c6";
+  "16.03".eu-west-1.hvm-s3 = "ami-c986e0ba";
+  "16.03".eu-west-1.pv-ebs = "ami-b083e5c3";
+  "16.03".eu-west-1.pv-s3 = "ami-3c83e54f";
+  "16.03".sa-east-1.hvm-ebs = "ami-f6eb7f9a";
+  "16.03".sa-east-1.hvm-s3 = "ami-93e773ff";
+  "16.03".sa-east-1.pv-ebs = "ami-cbb82ca7";
+  "16.03".sa-east-1.pv-s3 = "ami-abb82cc7";
+  "16.03".us-east-1.hvm-ebs = "ami-c123a3d6";
+  "16.03".us-east-1.hvm-s3 = "ami-bc25a5ab";
+  "16.03".us-east-1.pv-ebs = "ami-bd25a5aa";
+  "16.03".us-east-1.pv-s3 = "ami-a325a5b4";
+  "16.03".us-west-1.hvm-ebs = "ami-748bcd14";
+  "16.03".us-west-1.hvm-s3 = "ami-a68dcbc6";
+  "16.03".us-west-1.pv-ebs = "ami-048acc64";
+  "16.03".us-west-1.pv-s3 = "ami-208dcb40";
+  "16.03".us-west-2.hvm-ebs = "ami-8263a0e2";
+  "16.03".us-west-2.hvm-s3 = "ami-925c9ff2";
+  "16.03".us-west-2.pv-ebs = "ami-5e61a23e";
+  "16.03".us-west-2.pv-s3 = "ami-734c8f13";
 }