Add support for BLCR: modules/programs/blcr.nix

svn path=/nixos/trunk/; revision=21092
This commit is contained in:
Marco Maggesi 2010-04-15 12:11:33 +00:00
parent b42c2ecc13
commit 37746e4fb3
2 changed files with 60 additions and 0 deletions

View File

@ -27,6 +27,7 @@
./misc/nixpkgs.nix
./misc/passthru.nix
./programs/bash/bash.nix
./programs/blcr.nix
./programs/info.nix
./programs/pwdutils/pwdutils.nix
./programs/ssh.nix

59
modules/programs/blcr.nix Normal file
View File

@ -0,0 +1,59 @@
{ 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 =
"Wheter to enable support for the BLCR checkpoingint tool.";
};
environment.blcr.autorun = mkOption {
default = true;
description =
"Whether to load BLCR kernel modules automatically at boot.";
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ blcrPkg ];
jobs.openafsClient = {
name = "blcr";
description = "Loads BLCR kernel modules";
task = true;
startOn = if cfg.autorun then "started udev" else null;
stopOn = "shutdown";
preStart = ''
${insmod} ${blcr_imports_ko}
${insmod} ${blcr_ko}
'';
postStop = ''
${rmmod} ${blcr_ko}
${rmmod} ${blcr_imports_ko}
'';
};
};
}