Unverified Commit 76833029 authored by Michele Guerini Rocco's avatar Michele Guerini Rocco Committed by GitHub
Browse files

diod: 1.0.24 -> 1.1.0 (#469384)

parents fb812c98 bc3fc179
Loading
Loading
Loading
Loading
+17 −22
Original line number Diff line number Diff line
@@ -9,20 +9,6 @@ let

  diodBool = b: if b then "1" else "0";

  diodConfig = pkgs.writeText "diod.conf" ''
    allsquash = ${diodBool cfg.allsquash}
    auth_required = ${diodBool cfg.authRequired}
    exportall = ${diodBool cfg.exportall}
    exportopts = "${lib.concatStringsSep "," cfg.exportopts}"
    exports = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.exports)} }
    listen = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.listen)} }
    logdest = "${cfg.logdest}"
    nwthreads = ${toString cfg.nwthreads}
    squashuser = "${cfg.squashuser}"
    statfs_passthru = ${diodBool cfg.statfsPassthru}
    userdb = ${diodBool cfg.userdb}
    ${cfg.extraConfig}
  '';
in
{
  options = {
@@ -150,13 +136,22 @@ in
  config = lib.mkIf config.services.diod.enable {
    environment.systemPackages = [ pkgs.diod ];

    systemd.services.diod = {
      description = "diod 9P file server";
      wantedBy = [ "multi-user.target" ];
      after = [ "network.target" ];
      serviceConfig = {
        ExecStart = "${pkgs.diod}/sbin/diod -f -c ${diodConfig}";
      };
    };
    environment.etc."diod.conf".text = ''
      allsquash = ${diodBool cfg.allsquash}
      auth_required = ${diodBool cfg.authRequired}
      exportall = ${diodBool cfg.exportall}
      exportopts = "${lib.concatStringsSep "," cfg.exportopts}"
      exports = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.exports)} }
      listen = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.listen)} }
      logdest = "${cfg.logdest}"
      nwthreads = ${toString cfg.nwthreads}
      squashuser = "${cfg.squashuser}"
      statfs_passthru = ${diodBool cfg.statfsPassthru}
      userdb = ${diodBool cfg.userdb}
      ${cfg.extraConfig}
    '';

    systemd.packages = [ pkgs.diod ];
    systemd.services.diod.wantedBy = [ "multi-user.target" ];
  };
}
+20 −7
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchurl,
  fetchFromGitHub,
  autoreconfHook,
  pkg-config,
  munge,
  lua,
  libcap,
@@ -11,18 +13,24 @@

stdenv.mkDerivation rec {
  pname = "diod";
  version = "1.0.24";
  version = "1.1.0";

  src = fetchurl {
    url = "https://github.com/chaos/diod/releases/download/${version}/${pname}-${version}.tar.gz";
    sha256 = "17wckwfsqj61yixz53nwkc35z66arb1x3napahpi64m7q68jn7gl";
  src = fetchFromGitHub {
    owner = "chaos";
    repo = "diod";
    tag = "v${version}";
    hash = "sha256-Fz+qvgw5ipyAcZlWBGkmSHuGrZ95i5OorLN3dkdsYKU=";
  };

  postPatch = ''
    substituteInPlace diod/xattr.c --replace attr/xattr.h sys/xattr.h
    sed -i -e '/sys\/types\.h>/a #include <sys/sysmacros.h>' diod/ops.c
    sed -i configure.ac -e '/git describe/c ${version})'
  '';

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
  ];

  buildInputs = [
    munge
    lua
@@ -31,6 +39,11 @@ stdenv.mkDerivation rec {
    ncurses
  ];

  configureFlags = [
    "--with-systemdsystemunitdir=$(out)/lib/systemd/system/"
    "--sysconfdir=/etc"
  ];

  meta = {
    description = "I/O forwarding server that implements a variant of the 9P protocol";
    maintainers = with lib.maintainers; [ rnhmjoj ];