Commit 01e04f8d authored by nicoo's avatar nicoo
Browse files

bees: flatten derivation

The `runCommand` wrapper hid the drv's metadata.
parent 2a545449
Loading
Loading
Loading
Loading
+49 −58
Original line number Diff line number Diff line
{ lib
, stdenv
, runCommand
, fetchFromGitHub
, bash
, btrfs-progs
@@ -10,9 +9,7 @@
, nixosTests
}:

let

  bees = stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
  pname = "bees";
  version = "0.10";

@@ -41,6 +38,14 @@ let
    unset -f git
  '';

  inherit bash bees coreutils;
  utillinux = util-linux;
  btrfsProgs = btrfs-progs;
  postInstall = ''
    substituteAll ${./bees-service-wrapper} "$out"/bin/bees-service-wrapper
    chmod +x "$out"/bin/bees-service-wrapper
  '';

  buildFlags = [
    "ETC_PREFIX=/var/run/bees/configs"
  ];
@@ -53,6 +58,10 @@ let
    "SYSTEMD_SYSTEM_UNIT_DIR=$(out)/etc/systemd/system"
  ];

  passthru.tests = {
    smoke-test = nixosTests.bees;
  };

  meta = with lib; {
    homepage = "https://github.com/Zygo/bees";
    description = "Block-oriented BTRFS deduplication service";
@@ -61,22 +70,4 @@ let
    platforms = platforms.linux;
    maintainers = with maintainers; [ chaduffy ];
  };
  };

in

(runCommand "bees-service"
  {
    inherit bash bees coreutils;
    utillinux = util-linux; # needs to be a valid shell variable name
    btrfsProgs = btrfs-progs; # needs to be a valid shell variable name
  } ''
  mkdir -p -- "$out/bin"
  substituteAll ${./bees-service-wrapper} "$out"/bin/bees-service-wrapper
  chmod +x "$out"/bin/bees-service-wrapper
  ln -s ${bees}/bin/beesd "$out"/bin/beesd
'').overrideAttrs {
  passthru.tests = {
    smoke-test = nixosTests.bees;
  };
}