summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorHerwig Hochleitner <herwig@bendlas.net>2018-02-09 23:10:56 +0100
committerHerwig Hochleitner <hhochleitner@gmail.com>2018-02-15 09:10:32 +0100
commit66080ae4d8b0ae5830f2671d5e33cec7649a64ac (patch)
tree147ed9c59162f5502a21069c2981744f49d391fc /nixos
parent0b621321cd8ca2e36790ddff686eb6e8da41ec70 (diff)
downloadnixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.tar
nixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.tar.gz
nixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.tar.bz2
nixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.tar.lz
nixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.tar.xz
nixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.tar.zst
nixlib-66080ae4d8b0ae5830f2671d5e33cec7649a64ac.zip
programs.criu: add nixos option for installing criu + kernel flags
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/criu.nix26
2 files changed, 27 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 4c8da8e12bfe..751465c96937 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -75,6 +75,7 @@
   ./programs/cdemu.nix
   ./programs/chromium.nix
   ./programs/command-not-found/command-not-found.nix
+  ./programs/criu.nix
   ./programs/dconf.nix
   ./programs/environment.nix
   ./programs/fish.nix
diff --git a/nixos/modules/programs/criu.nix b/nixos/modules/programs/criu.nix
new file mode 100644
index 000000000000..48cf5c88a9fc
--- /dev/null
+++ b/nixos/modules/programs/criu.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let cfg = config.programs.criu;
+in {
+
+  options = {
+    programs.criu = {
+      enable = mkOption {
+        default = false;
+        description = ''
+          Install <command>criu</command> along with necessary kernel options.
+        '';
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    system.requiredKernelConfig = with config.lib.kernelConfig; [
+      (isYes "CHECKPOINT_RESTORE")
+    ];
+    boot.kernel.features.criu = true;
+    environment.systemPackages = [ pkgs.criu ];
+  };
+
+}