git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #22225 from bachp/glusterfs-service

glusterfs: add service

commit17cc22a619849d2ab763c0772dac266a97a3af1d authorJoachim F <joachifm@users.noreply.github.com> dateSat 4 Feb 2017, 15:15 (10 years ago) parent7f69dc4ff3f339
4 files changed+97−1
nixos/modules/module-list.nix+1 nixos/modules/services/network-filesystems/glusterfs.nix+84 nixos/modules/tasks/filesystems.nix+1−1 nixos/modules/tasks/filesystems/glusterfs.nix+11
nixos/modules/module-list.nix+1
@@ -339,6 +339,7 @@
339339 ./services/monitoring/zabbix-server.nix
340340 ./services/network-filesystems/cachefilesd.nix
341341 ./services/network-filesystems/drbd.nix
342+ ./services/network-filesystems/glusterfs.nix
342343 ./services/network-filesystems/ipfs.nix
343344 ./services/network-filesystems/netatalk.nix
344345 ./services/network-filesystems/nfsd.nix
nixos/modules/services/network-filesystems/glusterfs.nixnew file+84
@@ -0,0 +1,84 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ inherit (pkgs) glusterfs;
7+
8+ cfg = config.services.glusterfs;
9+
10+in
11+
12+{
13+
14+ ###### interface
15+
16+ options = {
17+
18+ services.glusterfs = {
19+
20+ enable = mkEnableOption "GlusterFS Daemon";
21+
22+ logLevel = mkOption {
23+ type = types.enum ["DEBUG" "INFO" "WARNING" "ERROR" "CRITICAL" "TRACE" "NONE"];
24+ description = "Log level used by the GlusterFS daemon";
25+ default = "INFO";
26+ };
27+
28+ extraFlags = mkOption {
29+ type = types.listOf types.str;
30+ description = "Extra flags passed to the GlusterFS daemon";
31+ default = [];
32+ };
33+ };
34+ };
35+
36+ ###### implementation
37+
38+ config = mkIf cfg.enable {
39+ environment.systemPackages = [ pkgs.glusterfs ];
40+
41+ services.rpcbind.enable = true;
42+
43+ systemd.services.glusterd = {
44+
45+ description = "GlusterFS, a clustered file-system server";
46+
47+ wantedBy = [ "multi-user.target" ];
48+
49+ requires = [ "rpcbind.service" ];
50+ after = [ "rpcbind.service" "network.target" "local-fs.target" ];
51+ before = [ "network-online.target" ];
52+
53+ preStart = ''
54+ install -m 0755 -d /var/log/glusterfs
55+ '';
56+
57+ serviceConfig = {
58+ Type="forking";
59+ PIDFile="/run/glusterd.pid";
60+ LimitNOFILE=65536;
61+ ExecStart="${glusterfs}/sbin/glusterd -p /run/glusterd.pid --log-level=${cfg.logLevel} ${toString cfg.extraFlags}";
62+ KillMode="process";
63+ };
64+ };
65+
66+ systemd.services.glustereventsd = {
67+
68+ description = "Gluster Events Notifier";
69+
70+ wantedBy = [ "multi-user.target" ];
71+
72+ after = [ "syslog.target" "network.target" ];
73+
74+ serviceConfig = {
75+ Type="simple";
76+ Environment="PYTHONPATH=${glusterfs}/usr/lib/python2.7/site-packages";
77+ PIDFile="/run/glustereventsd.pid";
78+ ExecStart="${glusterfs}/sbin/glustereventsd --pid-file /run/glustereventsd.pid";
79+ ExecReload="/bin/kill -SIGUSR2 $MAINPID";
80+ KillMode="control-group";
81+ };
82+ };
83+ };
84+}
nixos/modules/tasks/filesystems.nix+1−1
@@ -216,7 +216,7 @@ in
216216
217217 environment.etc.fstab.text =
218218 let
219− fsToSkipCheck = [ "none" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" ];
219+ fsToSkipCheck = [ "none" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" ];
220220 skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck;
221221 in ''
222222 # This is a generated file. Do not edit!
nixos/modules/tasks/filesystems/glusterfs.nixnew file+11
@@ -0,0 +1,11 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+{
6+ config = mkIf (any (fs: fs == "glusterfs") config.boot.supportedFilesystems) {
7+
8+ system.fsPackages = [ pkgs.glusterfs ];
9+
10+ };
11+}