blob: 0632a9bc952792baf44df5eb8492a0e561086a51 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
{ config, lib, pkgs, ...} :
with lib;
let
cfg = config.services.orangefs.client;
in {
###### interface
options = {
services.orangefs.client = {
enable = mkEnableOption "OrangeFS client daemon";
extraOptions = mkOption {
type = with types; listOf str;
default = [];
description = "Extra command line options for pvfs2-client.";
};
fileSystems = mkOption {
description = ''
The orangefs file systems to be mounted.
This option is preferred over using {option}`fileSystems` directly since
the pvfs client service needs to be running for it to be mounted.
'';
example = [{
mountPoint = "/orangefs";
target = "tcp://server:3334/orangefs";
}];
type = with types; listOf (submodule ({ ... } : {
options = {
mountPoint = mkOption {
type = types.str;
default = "/orangefs";
description = "Mount point.";
};
options = mkOption {
type = with types; listOf str;
default = [];
description = "Mount options";
};
target = mkOption {
type = types.str;
example = "tcp://server:3334/orangefs";
description = "Target URL";
};
};
}));
};
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.orangefs ];
boot.supportedFilesystems = [ "pvfs2" ];
boot.kernelModules = [ "orangefs" ];
systemd.services.orangefs-client = {
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "simple";
ExecStart = ''
${pkgs.orangefs}/bin/pvfs2-client-core \
--logtype=syslog ${concatStringsSep " " cfg.extraOptions}
'';
TimeoutStopSec = "120";
};
};
systemd.mounts = map (fs: {
requires = [ "orangefs-client.service" ];
after = [ "orangefs-client.service" ];
bindsTo = [ "orangefs-client.service" ];
wantedBy = [ "remote-fs.target" ];
type = "pvfs2";
options = concatStringsSep "," fs.options;
what = fs.target;
where = fs.mountPoint;
}) cfg.fileSystems;
};
}
|