From 346c744530cc6362a9093421466064eebee30965 Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Sun, 13 Sep 2015 14:48:16 +0200 Subject: [PATCH 1/4] xtreemfs: repackage and update --- pkgs/tools/filesystems/xtreemfs/default.nix | 119 +++++++++----------- 1 file changed, 52 insertions(+), 67 deletions(-) diff --git a/pkgs/tools/filesystems/xtreemfs/default.nix b/pkgs/tools/filesystems/xtreemfs/default.nix index 81be62b5159..8f090c29781 100644 --- a/pkgs/tools/filesystems/xtreemfs/default.nix +++ b/pkgs/tools/filesystems/xtreemfs/default.nix @@ -1,80 +1,65 @@ -x@{builderDefsPackage - , boost, fuse, openssl, cmake, attr, jdk, ant, which, python, file - , ...}: -builderDefsPackage -(a : -let - helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ - []; +{ stdenv, boost, fuse, openssl, cmake, attr, jdk, ant, which, file, python +, fetchurl, lib, valgrind, makeWrapper, fetchFromGitHub }: - buildInputs = map (n: builtins.getAttr n x) - (builtins.attrNames (builtins.removeAttrs x helperArgNames)); - sourceInfo = rec { - baseName="XtreemFS"; - version="1.4"; - name="${baseName}-${version}"; - url="http://xtreemfs.googlecode.com/files/${name}.tar.gz"; - hash="1hzd6anplxdcl4cg6xwriqk9b34541r7ah1ab2xavv149a2ll25s"; - }; -in -rec { - src = a.fetchurl { - url = sourceInfo.url; - sha256 = sourceInfo.hash; +stdenv.mkDerivation rec { + src = fetchFromGitHub { + # using unstable release because stable (v1.5.1) has broken repl java plugin + rev = "7ddcb081aa125b0cfb008dc98addd260b8353ab3"; + owner = "xtreemfs"; + repo = "xtreemfs"; + sha256 = "1hjmd32pla27zf98ghzz6r5ml8ry86m9dsryv1z01kxv5l95b3m0"; }; - inherit (sourceInfo) name version; - inherit buildInputs; + name = "XtreemFS-${version}"; + version = "1.5.1.81"; - /* doConfigure should be removed if not needed */ - phaseNames = ["setVars" "fixMakefile" "doMakeInstall" "fixInterpreterBin" - "fixInterpreterEtc" - "usrIsOut"]; + buildInputs = [ which attr makeWrapper python ]; - setVars = a.noDepEntry '' - export JAVA_HOME="${jdk}" - export ANT_HOME="${ant}" - export CMAKE_HOME=${cmake} + preConfigure = '' + export JAVA_HOME=${jdk} + export ANT_HOME=${ant} + + export BOOST_INCLUDEDIR=${boost.dev}/include + export BOOST_LIBRARYDIR=${boost.lib}/lib + export OPENSSL_ROOT_DIR=${openssl} + + substituteInPlace cpp/cmake/FindValgrind.cmake \ + --replace "/usr/local" "${valgrind}" + + substituteInPlace cpp/CMakeLists.txt \ + --replace '"/lib64" "/usr/lib64"' '"${attr}/lib" "${fuse}/lib"' + + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${fuse}/include" + export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L${fuse}/lib" + + export DESTDIR=$out + + substituteInPlace Makefile \ + --replace "/usr/share/" "/share/" \ + --replace 'BIN_DIR=$(DESTDIR)/usr/bin' "BIN_DIR=$out/bin" + + substituteInPlace etc/init.d/generate_initd_scripts.sh \ + --replace "/bin/bash" "${stdenv.shell}" + + # do not put cmake into buildInputs + export PATH="$PATH:${cmake}/bin" ''; - fixMakefile = a.fullDepEntry '' - sed -e 's@DESTDIR)/usr@DESTDIR)@g' -i Makefile + preBuild = '' + substituteInPlace configure \ + --replace "/usr/bin/file" "${file}/bin/file" + ''; - sed -e 's@/usr/bin/@@g' -i cpp/thirdparty/protobuf-*/configure - sed -e 's@/usr/bin/@@g' -i cpp/thirdparty/protobuf-*/gtest/configure - sed -e 's@/usr/bin/@@g' -i cpp/thirdparty/gtest-*/configure - '' ["doUnpack" "minInit"]; + doCheck = false; - fixInterpreterBin = a.doPatchShebangs "$out/bin"; - fixInterpreterEtc = a.doPatchShebangs "$out/etc/xos/xtreemfs"; + postInstall = '' + rm -r $out/sbin + ''; - usrIsOut = a.fullDepEntry '' - sed -e "s@/usr/@$out/@g" -i \ - "$out"/{bin/xtfs_*,etc/xos/xtreemfs/*.*,etc/xos/xtreemfs/*/*,etc/init.d/*} - sed -e "s@JAVA_HOME=/usr@JAVA_HOME=${jdk}@g" -i \ - "$out"/{bin/xtfs_*,etc/init.d/*} - '' ["minInit"]; - - makeFlags = [ - ''DESTDIR="$out"'' - ''SHELL="${a.stdenv.shell}"'' - ]; - meta = { description = "A distributed filesystem"; - maintainers = with a.lib.maintainers; - [ - raskin - ]; - platforms = with a.lib.platforms; - linux; - license = a.lib.licenses.bsd3; - broken = true; + maintainers = with lib.maintainers; [ raskin matejc ]; + platforms = lib.platforms.linux; + license = lib.licenses.bsd3; }; - passthru = { - updateInfo = { - downloadPage = "http://xtreemfs.org/download_sources.php"; - }; - }; -}) x - +} From d31cc0d19ae058b15095296d435a722d6afd87fa Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Sun, 13 Sep 2015 14:49:19 +0200 Subject: [PATCH 2/4] xtreemfs: add nixos module --- nixos/modules/misc/ids.nix | 2 + nixos/modules/module-list.nix | 1 + .../services/network-filesystems/xtreemfs.nix | 481 ++++++++++++++++++ 3 files changed, 484 insertions(+) create mode 100644 nixos/modules/services/network-filesystems/xtreemfs.nix diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index b0e9ceea10b..0d2700a126f 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -233,6 +233,7 @@ dnschain = 209; #lxd = 210; # unused kibana = 211; + xtreemfs = 212; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -444,6 +445,7 @@ #dnschain = 209; #unused lxd = 210; # unused #kibana = 211; + xtreemfs = 212; # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 1d6ddcbe941..c890eac4991 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -257,6 +257,7 @@ ./services/network-filesystems/diod.nix ./services/network-filesystems/u9fs.nix ./services/network-filesystems/yandex-disk.nix + ./services/network-filesystems/xtreemfs.nix ./services/networking/aiccu.nix ./services/networking/amuled.nix ./services/networking/asterisk.nix diff --git a/nixos/modules/services/network-filesystems/xtreemfs.nix b/nixos/modules/services/network-filesystems/xtreemfs.nix new file mode 100644 index 00000000000..215b76bb470 --- /dev/null +++ b/nixos/modules/services/network-filesystems/xtreemfs.nix @@ -0,0 +1,481 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.xtreemfs; + + xtreemfs = pkgs.xtreemfs; + + home = cfg.homeDir; + + startupScript = class: configPath: pkgs.writeScript "xtreemfs-osd.sh" '' + #! ${pkgs.stdenv.shell} + JAVA_HOME="${pkgs.jdk}" + JAVADIR="${xtreemfs}/share/java" + JAVA_CALL="$JAVA_HOME/bin/java -ea -cp $JAVADIR/XtreemFS.jar:$JAVADIR/BabuDB.jar:$JAVADIR/Flease.jar:$JAVADIR/protobuf-java-2.5.0.jar:$JAVADIR/Foundation.jar:$JAVADIR/jdmkrt.jar:$JAVADIR/jdmktk.jar:$JAVADIR/commons-codec-1.3.jar" + $JAVA_CALL ${class} ${configPath} + ''; + + dirReplicationConfig = pkgs.writeText "xtreemfs-dir-replication-plugin.properties" '' + babudb.repl.backupDir = ${home}/server-repl-dir + plugin.jar = ${xtreemfs}/share/java/BabuDB_replication_plugin.jar + babudb.repl.dependency.0 = ${xtreemfs}/share/java/Flease.jar + + ${cfg.dir.replication.extraConfig} + ''; + + dirConfig = pkgs.writeText "xtreemfs-dir-config.properties" '' + uuid = ${cfg.dir.uuid} + listen.port = ${toString cfg.dir.port} + ${optionalString (cfg.dir.address != "") "listen.address = ${cfg.dir.address}"} + http_port = ${toString cfg.dir.httpPort} + babudb.baseDir = ${home}/dir/database + babudb.logDir = ${home}/dir/db-log + babudb.sync = ${if cfg.dir.replication.enable then "FDATASYNC" else cfg.dir.syncMode} + + ${optionalString cfg.dir.replication.enable "babudb.plugin.0 = ${dirReplicationConfig}"} + + ${cfg.dir.extraConfig} + ''; + + mrcReplicationConfig = pkgs.writeText "xtreemfs-mrc-replication-plugin.properties" '' + babudb.repl.backupDir = ${home}/server-repl-mrc + plugin.jar = ${xtreemfs}/share/java/BabuDB_replication_plugin.jar + babudb.repl.dependency.0 = ${xtreemfs}/share/java/Flease.jar + + ${cfg.mrc.replication.extraConfig} + ''; + + mrcConfig = pkgs.writeText "xtreemfs-mrc-config.properties" '' + uuid = ${cfg.mrc.uuid} + listen.port = ${toString cfg.mrc.port} + ${optionalString (cfg.mrc.address != "") "listen.address = ${cfg.mrc.address}"} + http_port = ${toString cfg.mrc.httpPort} + babudb.baseDir = ${home}/mrc/database + babudb.logDir = ${home}/mrc/db-log + babudb.sync = ${if cfg.mrc.replication.enable then "FDATASYNC" else cfg.mrc.syncMode} + + ${optionalString cfg.mrc.replication.enable "babudb.plugin.0 = ${mrcReplicationConfig}"} + + ${cfg.mrc.extraConfig} + ''; + + osdConfig = pkgs.writeText "xtreemfs-osd-config.properties" '' + uuid = ${cfg.osd.uuid} + listen.port = ${toString cfg.osd.port} + ${optionalString (cfg.osd.address != "") "listen.address = ${cfg.osd.address}"} + http_port = ${toString cfg.osd.httpPort} + object_dir = ${home}/osd/ + + ${cfg.osd.extraConfig} + ''; + +in + +{ + + ###### interface + + options = { + + services.xtreemfs = { + + enable = mkOption { + default = false; + description = '' + Whether to enable XtreemFS. + ''; + }; + + homeDir = mkOption { + default = "/var/lib/xtreemfs"; + description = '' + XtreemFS home dir for the xtreemfs user. + ''; + }; + + dir = { + enable = mkOption { + default = true; + description = '' + Whether to enable XtreemFS DIR service. + ''; + }; + uuid = mkOption { + example = "eacb6bab-f444-4ebf-a06a-3f72d7465e40"; + description = '' + Must be set to a unique identifier, preferably a UUID according to + RFC 4122. UUIDs can be generated with `uuidgen` command, found in + the `utillinux` package. + ''; + }; + port = mkOption { + default = 32638; + description = '' + The port to listen on for incoming connections (TCP). + ''; + }; + address = mkOption { + example = "127.0.0.1"; + default = ""; + description = '' + If specified, it defines the interface to listen on. If not + specified, the service will listen on all interfaces (any). + ''; + }; + httpPort = mkOption { + default = 30638; + description = '' + Specifies the listen port for the HTTP service that returns the + status page. + ''; + }; + syncMode = mkOption { + default = "FSYNC"; + example = "FDATASYNC"; + description = '' + The sync mode influences how operations are committed to the disk + log before the operation is acknowledged to the caller. + + -ASYNC mode the writes to the disk log are buffered in memory by the operating system. This is the fastest mode but will lead to data loss in case of a crash, kernel panic or power failure. + -SYNC_WRITE_METADATA opens the file with O_SYNC, the system will not buffer any writes. The operation will be acknowledged when data has been safely written to disk. This mode is slow but offers maximum data safety. However, BabuDB cannot influence the disk drive caches, this depends on the OS and hard disk model. + -SYNC_WRITE similar to SYNC_WRITE_METADATA but opens file with O_DSYNC which means that only the data is commit to disk. This can lead to some data loss depending on the implementation of the underlying file system. Linux does not implement this mode. + -FDATASYNC is similar to SYNC_WRITE but opens the file in asynchronous mode and calls fdatasync() after writing the data to disk. + -FSYNC is similar to SYNC_WRITE_METADATA but opens the file in asynchronous mode and calls fsync() after writing the data to disk. + + For best throughput use ASYNC, for maximum data safety use FSYNC. + + (If xtreemfs.dir.replication.enable is true then FDATASYNC is forced) + ''; + }; + extraConfig = mkOption { + default = ""; + example = '' + # specify whether SSL is required + ssl.enabled = true + ssl.service_creds.pw = passphrase + ssl.service_creds.container = pkcs12 + ssl.service_creds = /etc/xos/xtreemfs/truststore/certs/dir.p12 + ssl.trusted_certs = /etc/xos/xtreemfs/truststore/certs/trusted.jks + ssl.trusted_certs.pw = jks_passphrase + ssl.trusted_certs.container = jks + ''; + description = '' + Configuration of XtreemFS DIR service. + WARNING: configuration is saved as plaintext inside nix store. + For more options: http://www.xtreemfs.org/xtfs-guide-1.5.1/index.html + ''; + }; + replication = { + enable = mkOption { + default = false; + description = '' + Whether to enable XtreemFS DIR replication plugin. + ''; + }; + extraConfig = mkOption { + example = '' + # participants of the replication including this replica + babudb.repl.participant.0 = 192.168.0.10 + babudb.repl.participant.0.port = 35676 + babudb.repl.participant.1 = 192.168.0.11 + babudb.repl.participant.1.port = 35676 + babudb.repl.participant.2 = 192.168.0.12 + babudb.repl.participant.2.port = 35676 + + # number of servers that at least have to be up to date + # To have a fault-tolerant system, this value has to be set to the + # majority of nodes i.e., if you have three replicas, set this to 2 + # Please note that a setup with two nodes provides no fault-tolerance. + babudb.repl.sync.n = 2 + + # specify whether SSL is required + babudb.ssl.enabled = true + + babudb.ssl.protocol = tlsv12 + + # server credentials for SSL handshakes + babudb.ssl.service_creds = /etc/xos/xtreemfs/truststore/certs/osd.p12 + babudb.ssl.service_creds.pw = passphrase + babudb.ssl.service_creds.container = pkcs12 + + # trusted certificates for SSL handshakes + babudb.ssl.trusted_certs = /etc/xos/xtreemfs/truststore/certs/trusted.jks + babudb.ssl.trusted_certs.pw = jks_passphrase + babudb.ssl.trusted_certs.container = jks + + babudb.ssl.authenticationWithoutEncryption = false + ''; + description = '' + Configuration of XtreemFS DIR replication plugin. + WARNING: configuration is saved as plaintext inside nix store. + For more options: http://www.xtreemfs.org/xtfs-guide-1.5.1/index.html + ''; + }; + }; + }; + + mrc = { + enable = mkOption { + default = true; + description = '' + Whether to enable XtreemFS MRC service. + ''; + }; + uuid = mkOption { + example = "eacb6bab-f444-4ebf-a06a-3f72d7465e41"; + description = '' + Must be set to a unique identifier, preferably a UUID according to + RFC 4122. UUIDs can be generated with `uuidgen` command, found in + the `utillinux` package. + ''; + }; + port = mkOption { + default = 32636; + description = '' + The port to listen on for incoming connections (TCP). + ''; + }; + address = mkOption { + example = "127.0.0.1"; + default = ""; + description = '' + If specified, it defines the interface to listen on. If not + specified, the service will listen on all interfaces (any). + ''; + }; + httpPort = mkOption { + default = 30636; + description = '' + Specifies the listen port for the HTTP service that returns the + status page. + ''; + }; + syncMode = mkOption { + default = "FSYNC"; + example = "FDATASYNC"; + description = '' + The sync mode influences how operations are committed to the disk + log before the operation is acknowledged to the caller. + + -ASYNC mode the writes to the disk log are buffered in memory by the operating system. This is the fastest mode but will lead to data loss in case of a crash, kernel panic or power failure. + -SYNC_WRITE_METADATA opens the file with O_SYNC, the system will not buffer any writes. The operation will be acknowledged when data has been safely written to disk. This mode is slow but offers maximum data safety. However, BabuDB cannot influence the disk drive caches, this depends on the OS and hard disk model. + -SYNC_WRITE similar to SYNC_WRITE_METADATA but opens file with O_DSYNC which means that only the data is commit to disk. This can lead to some data loss depending on the implementation of the underlying file system. Linux does not implement this mode. + -FDATASYNC is similar to SYNC_WRITE but opens the file in asynchronous mode and calls fdatasync() after writing the data to disk. + -FSYNC is similar to SYNC_WRITE_METADATA but opens the file in asynchronous mode and calls fsync() after writing the data to disk. + + For best throughput use ASYNC, for maximum data safety use FSYNC. + + (If xtreemfs.mrc.replication.enable is true then FDATASYNC is forced) + ''; + }; + extraConfig = mkOption { + example = '' + osd_check_interval = 300 + no_atime = true + local_clock_renewal = 0 + remote_time_sync = 30000 + authentication_provider = org.xtreemfs.common.auth.NullAuthProvider + + # shared secret between the MRC and all OSDs + capability_secret = iNG8UuQJrJ6XVDTe + + dir_service.host = 192.168.0.10 + dir_service.port = 32638 + + # if replication is enabled + dir_service.1.host = 192.168.0.11 + dir_service.1.port = 32638 + dir_service.2.host = 192.168.0.12 + dir_service.2.port = 32638 + + # specify whether SSL is required + ssl.enabled = true + ssl.protocol = tlsv12 + ssl.service_creds.pw = passphrase + ssl.service_creds.container = pkcs12 + ssl.service_creds = /etc/xos/xtreemfs/truststore/certs/mrc.p12 + ssl.trusted_certs = /etc/xos/xtreemfs/truststore/certs/trusted.jks + ssl.trusted_certs.pw = jks_passphrase + ssl.trusted_certs.container = jks + ''; + description = '' + Configuration of XtreemFS MRC service. + WARNING: configuration is saved as plaintext inside nix store. + For more options: http://www.xtreemfs.org/xtfs-guide-1.5.1/index.html + ''; + }; + replication = { + enable = mkOption { + default = false; + description = '' + Whether to enable XtreemFS MRC replication plugin. + ''; + }; + extraConfig = mkOption { + example = '' + # participants of the replication including this replica + babudb.repl.participant.0 = 192.168.0.10 + babudb.repl.participant.0.port = 35678 + babudb.repl.participant.1 = 192.168.0.11 + babudb.repl.participant.1.port = 35678 + babudb.repl.participant.2 = 192.168.0.12 + babudb.repl.participant.2.port = 35678 + + # number of servers that at least have to be up to date + # To have a fault-tolerant system, this value has to be set to the + # majority of nodes i.e., if you have three replicas, set this to 2 + # Please note that a setup with two nodes provides no fault-tolerance. + babudb.repl.sync.n = 2 + + # specify whether SSL is required + babudb.ssl.enabled = true + + babudb.ssl.protocol = tlsv12 + + # server credentials for SSL handshakes + babudb.ssl.service_creds = /etc/xos/xtreemfs/truststore/certs/osd.p12 + babudb.ssl.service_creds.pw = passphrase + babudb.ssl.service_creds.container = pkcs12 + + # trusted certificates for SSL handshakes + babudb.ssl.trusted_certs = /etc/xos/xtreemfs/truststore/certs/trusted.jks + babudb.ssl.trusted_certs.pw = jks_passphrase + babudb.ssl.trusted_certs.container = jks + + babudb.ssl.authenticationWithoutEncryption = false + ''; + description = '' + Configuration of XtreemFS MRC replication plugin. + WARNING: configuration is saved as plaintext inside nix store. + For more options: http://www.xtreemfs.org/xtfs-guide-1.5.1/index.html + ''; + }; + }; + }; + + osd = { + enable = mkOption { + default = true; + description = '' + Whether to enable XtreemFS OSD service. + ''; + }; + uuid = mkOption { + example = "eacb6bab-f444-4ebf-a06a-3f72d7465e42"; + description = '' + Must be set to a unique identifier, preferably a UUID according to + RFC 4122. UUIDs can be generated with `uuidgen` command, found in + the `utillinux` package. + ''; + }; + port = mkOption { + default = 32640; + description = '' + The port to listen on for incoming connections (TCP and UDP). + ''; + }; + address = mkOption { + example = "127.0.0.1"; + default = ""; + description = '' + If specified, it defines the interface to listen on. If not + specified, the service will listen on all interfaces (any). + ''; + }; + httpPort = mkOption { + default = 30640; + description = '' + Specifies the listen port for the HTTP service that returns the + status page. + ''; + }; + extraConfig = mkOption { + example = '' + local_clock_renewal = 0 + remote_time_sync = 30000 + report_free_space = true + capability_secret = iNG8UuQJrJ6XVDTe + + dir_service.host = 192.168.0.10 + dir_service.port = 32638 + + # if replication is used + dir_service.1.host = 192.168.0.11 + dir_service.1.port = 32638 + dir_service.2.host = 192.168.0.12 + dir_service.2.port = 32638 + + # specify whether SSL is required + ssl.enabled = true + ssl.service_creds.pw = passphrase + ssl.service_creds.container = pkcs12 + ssl.service_creds = /etc/xos/xtreemfs/truststore/certs/osd.p12 + ssl.trusted_certs = /etc/xos/xtreemfs/truststore/certs/trusted.jks + ssl.trusted_certs.pw = jks_passphrase + ssl.trusted_certs.container = jks + ''; + description = '' + Configuration of XtreemFS OSD service. + WARNING: configuration is saved as plaintext inside nix store. + For more options: http://www.xtreemfs.org/xtfs-guide-1.5.1/index.html + ''; + }; + }; + }; + + }; + + + ###### implementation + + config = lib.mkIf cfg.enable { + + environment.systemPackages = [ xtreemfs ]; + + users.extraUsers.xtreemfs = + { uid = config.ids.uids.xtreemfs; + description = "XtreemFS user"; + createHome = true; + home = home; + }; + + users.extraGroups.xtreemfs = + { gid = config.ids.gids.xtreemfs; + }; + + systemd.services.xtreemfs-dir = mkIf cfg.dir.enable { + description = "XtreemFS-DIR Server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "xtreemfs"; + ExecStart = "${startupScript "org.xtreemfs.dir.DIR" dirConfig}"; + }; + }; + + systemd.services.xtreemfs-mrc = mkIf cfg.mrc.enable { + description = "XtreemFS-MRC Server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "xtreemfs"; + ExecStart = "${startupScript "org.xtreemfs.mrc.MRC" mrcConfig}"; + }; + }; + + systemd.services.xtreemfs-osd = mkIf cfg.osd.enable { + description = "XtreemFS-OSD Server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "xtreemfs"; + ExecStart = "${startupScript "org.xtreemfs.osd.OSD" osdConfig}"; + }; + }; + + }; + +} From a35cebb3b1789797e4e0102bc8da9d694b55abef Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Mon, 14 Sep 2015 02:21:10 +0200 Subject: [PATCH 3/4] xtreemfs: use mkEnableOption instead of mkOption --- .../services/network-filesystems/xtreemfs.nix | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/nixos/modules/services/network-filesystems/xtreemfs.nix b/nixos/modules/services/network-filesystems/xtreemfs.nix index 215b76bb470..2d57464ce04 100644 --- a/nixos/modules/services/network-filesystems/xtreemfs.nix +++ b/nixos/modules/services/network-filesystems/xtreemfs.nix @@ -82,12 +82,7 @@ in services.xtreemfs = { - enable = mkOption { - default = false; - description = '' - Whether to enable XtreemFS. - ''; - }; + enable = mkEnableOption "XtreemFS"; homeDir = mkOption { default = "/var/lib/xtreemfs"; @@ -169,12 +164,7 @@ in ''; }; replication = { - enable = mkOption { - default = false; - description = '' - Whether to enable XtreemFS DIR replication plugin. - ''; - }; + enable = mkEnableOption "XtreemFS DIR replication plugin"; extraConfig = mkOption { example = '' # participants of the replication including this replica @@ -308,12 +298,7 @@ in ''; }; replication = { - enable = mkOption { - default = false; - description = '' - Whether to enable XtreemFS MRC replication plugin. - ''; - }; + enable = mkEnableOption "XtreemFS MRC replication plugin"; extraConfig = mkOption { example = '' # participants of the replication including this replica From c666955b7599c0db6d856c2f11f76c28299313cb Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Tue, 22 Sep 2015 21:10:36 +0200 Subject: [PATCH 4/4] xtreemfs: set mrc and osd as dir dependencies --- .../services/network-filesystems/xtreemfs.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nixos/modules/services/network-filesystems/xtreemfs.nix b/nixos/modules/services/network-filesystems/xtreemfs.nix index 2d57464ce04..b051214e1d0 100644 --- a/nixos/modules/services/network-filesystems/xtreemfs.nix +++ b/nixos/modules/services/network-filesystems/xtreemfs.nix @@ -72,6 +72,13 @@ let ${cfg.osd.extraConfig} ''; + optionalDir = optionals cfg.dir.enable ["xtreemfs-dir.service"]; + + systemdOptionalDependencies = { + after = [ "network.target" ] ++ optionalDir; + wantedBy = [ "multi-user.target" ] ++ optionalDir; + }; + in { @@ -441,25 +448,21 @@ in }; }; - systemd.services.xtreemfs-mrc = mkIf cfg.mrc.enable { + systemd.services.xtreemfs-mrc = mkIf cfg.mrc.enable ({ description = "XtreemFS-MRC Server"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; serviceConfig = { User = "xtreemfs"; ExecStart = "${startupScript "org.xtreemfs.mrc.MRC" mrcConfig}"; }; - }; + } // systemdOptionalDependencies); - systemd.services.xtreemfs-osd = mkIf cfg.osd.enable { + systemd.services.xtreemfs-osd = mkIf cfg.osd.enable ({ description = "XtreemFS-OSD Server"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; serviceConfig = { User = "xtreemfs"; ExecStart = "${startupScript "org.xtreemfs.osd.OSD" osdConfig}"; }; - }; + } // systemdOptionalDependencies); };