2010-04-15 13:11:33 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption mkIf;
|
|
|
|
|
|
|
|
cfg = config.environment.blcr;
|
|
|
|
|
|
|
|
blcrPkg = config.boot.kernelPackages.blcr;
|
|
|
|
|
|
|
|
insmod = "${pkgs.module_init_tools}/sbin/insmod";
|
|
|
|
rmmod = "${pkgs.module_init_tools}/sbin/rmmod";
|
|
|
|
|
|
|
|
modulesDir = "${blcrPkg}/lib/modules/${pkgs.linux.version}";
|
|
|
|
blcr_imports_ko = "${modulesDir}/blcr_imports.ko";
|
|
|
|
blcr_ko = "${modulesDir}/blcr.ko";
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
environment.blcr.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description =
|
2010-06-02 17:05:09 +01:00
|
|
|
"Wheter to enable support for the BLCR checkpointing tool.";
|
2010-04-15 13:11:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
environment.blcr.autorun = mkOption {
|
|
|
|
default = true;
|
|
|
|
description =
|
|
|
|
"Whether to load BLCR kernel modules automatically at boot.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ blcrPkg ];
|
|
|
|
|
2010-04-15 18:14:44 +01:00
|
|
|
jobs.blcr = {
|
2010-04-15 13:11:33 +01:00
|
|
|
name = "blcr";
|
|
|
|
description = "Loads BLCR kernel modules";
|
|
|
|
task = true;
|
|
|
|
|
|
|
|
startOn = if cfg.autorun then "started udev" else null;
|
|
|
|
|
|
|
|
preStart = ''
|
|
|
|
${insmod} ${blcr_imports_ko}
|
|
|
|
${insmod} ${blcr_ko}
|
|
|
|
'';
|
|
|
|
postStop = ''
|
|
|
|
${rmmod} ${blcr_ko}
|
|
|
|
${rmmod} ${blcr_imports_ko}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|