Unverified Commit 09e565ab authored by nicoo's avatar nicoo Committed by GitHub
Browse files

Merge #335848: expose bees' metadata, simplify wrapper

parents e05baacd 99e93489
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
#!@bash@/bin/bash
PATH=@bash@/bin:@coreutils@/bin:@utillinux@/bin:@btrfsProgs@/bin:$PATH
beesd_bin=@bees@/lib/bees/bees
# PLEASE KEEP NIX-ISMS ABOVE THIS LINE TO EASE UPSTREAM MERGE
#!/usr/bin/env bash

shopt -s extglob
+57 −63
Original line number Diff line number Diff line
{ lib
, stdenv
, runCommand
, fetchFromGitHub
, bash
, makeWrapper
, nixosTests

, stdenv
# Build inputs
, btrfs-progs
, coreutils
, python3Packages
, util-linux
, nixosTests
, python3Packages
# bees-service-wrapper
, bash
, coreutils
}:

let

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

@@ -29,6 +30,7 @@ let
  ];

  nativeBuildInputs = [
    makeWrapper
    python3Packages.markdown # documentation build
  ];

@@ -41,6 +43,12 @@ let
    unset -f git
  '';

  postInstall = ''
    makeWrapper ${./bees-service-wrapper} "$out"/bin/bees-service-wrapper \
      --prefix PATH : ${lib.makeBinPath [ bash coreutils util-linux btrfs-progs ]} \
      --set beesd_bin "$out"/lib/bees/bees
  '';

  buildFlags = [
    "ETC_PREFIX=/var/run/bees/configs"
  ];
@@ -53,6 +61,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 +73,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;
  };
}