mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-10 16:45:51 +03:00
Add support for BLCR: modules/programs/blcr.nix
svn path=/nixos/trunk/; revision=21092
This commit is contained in:
parent
b42c2ecc13
commit
37746e4fb3
@ -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
59
modules/programs/blcr.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user