mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
Merge pull request #125810 from ElXreno/package-bees-0.6.5
This commit is contained in:
commit
c6a306d19e
@ -57,7 +57,7 @@ let
|
|||||||
};
|
};
|
||||||
options.extraOptions = mkOption {
|
options.extraOptions = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Extra command-line options passed to the daemon. See upstream bees documentation.
|
Extra command-line options passed to the daemon. See upstream bees documentation.
|
||||||
'';
|
'';
|
||||||
@ -67,7 +67,8 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.services.beesd = {
|
options.services.beesd = {
|
||||||
filesystems = mkOption {
|
filesystems = mkOption {
|
||||||
@ -87,37 +88,42 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
systemd.services = mapAttrs' (name: fs: nameValuePair "beesd@${name}" {
|
systemd.services = mapAttrs'
|
||||||
description = "Block-level BTRFS deduplication for %i";
|
(name: fs: nameValuePair "beesd@${name}" {
|
||||||
after = [ "sysinit.target" ];
|
description = "Block-level BTRFS deduplication for %i";
|
||||||
|
after = [ "sysinit.target" ];
|
||||||
|
|
||||||
serviceConfig = let
|
serviceConfig =
|
||||||
configOpts = [
|
let
|
||||||
fs.spec
|
configOpts = [
|
||||||
"verbosity=${toString fs.verbosity}"
|
fs.spec
|
||||||
"idxSizeMB=${toString fs.hashTableSizeMB}"
|
"verbosity=${toString fs.verbosity}"
|
||||||
"workDir=${fs.workDir}"
|
"idxSizeMB=${toString fs.hashTableSizeMB}"
|
||||||
];
|
"workDir=${fs.workDir}"
|
||||||
configOptsStr = escapeShellArgs configOpts;
|
];
|
||||||
in {
|
configOptsStr = escapeShellArgs configOpts;
|
||||||
# Values from https://github.com/Zygo/bees/blob/v0.6.1/scripts/beesd%40.service.in
|
in
|
||||||
ExecStart = "${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${escapeShellArgs fs.extraOptions}";
|
{
|
||||||
ExecStopPost = "${pkgs.bees}/bin/bees-service-wrapper cleanup ${configOptsStr}";
|
# Values from https://github.com/Zygo/bees/blob/v0.6.5/scripts/beesd@.service.in
|
||||||
CPUAccounting = true;
|
ExecStart = "${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${escapeShellArgs fs.extraOptions}";
|
||||||
CPUWeight = 12;
|
ExecStopPost = "${pkgs.bees}/bin/bees-service-wrapper cleanup ${configOptsStr}";
|
||||||
IOSchedulingClass = "idle";
|
CPUAccounting = true;
|
||||||
IOSchedulingPriority = 7;
|
CPUSchedulingPolicy = "batch";
|
||||||
IOWeight = 10;
|
CPUWeight = 12;
|
||||||
KillMode = "control-group";
|
IOSchedulingClass = "idle";
|
||||||
KillSignal = "SIGTERM";
|
IOSchedulingPriority = 7;
|
||||||
MemoryAccounting = true;
|
IOWeight = 10;
|
||||||
Nice = 19;
|
KillMode = "control-group";
|
||||||
Restart = "on-abnormal";
|
KillSignal = "SIGTERM";
|
||||||
StartupCPUWeight = 25;
|
MemoryAccounting = true;
|
||||||
StartupIOWeight = 25;
|
Nice = 19;
|
||||||
SyslogIdentifier = "bees"; # would otherwise be "bees-service-wrapper"
|
Restart = "on-abnormal";
|
||||||
};
|
StartupCPUWeight = 25;
|
||||||
wantedBy = ["multi-user.target"];
|
StartupIOWeight = 25;
|
||||||
}) cfg.filesystems;
|
SyslogIdentifier = "beesd"; # would otherwise be "bees-service-wrapper"
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
})
|
||||||
|
cfg.filesystems;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,35 @@
|
|||||||
{ lib, stdenv, runCommand, fetchFromGitHub, bash, btrfs-progs, coreutils
|
{ lib
|
||||||
, python3Packages, util-linux, nixosTests }:
|
, stdenv
|
||||||
|
, runCommand
|
||||||
|
, fetchFromGitHub
|
||||||
|
, bash
|
||||||
|
, btrfs-progs
|
||||||
|
, coreutils
|
||||||
|
, python3Packages
|
||||||
|
, util-linux
|
||||||
|
, nixosTests
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
bees = stdenv.mkDerivation rec {
|
bees = stdenv.mkDerivation rec {
|
||||||
pname = "bees";
|
pname = "bees";
|
||||||
version = "0.6.3";
|
version = "0.6.5";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "Zygo";
|
owner = "Zygo";
|
||||||
repo = "bees";
|
repo = "bees";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-brEjr7lhmKDCIDeLq+XP+ZTxv1RvwoUlszMSEYygxv8=";
|
sha256 = "11ppbf23b8ngzfy02am0skxlybzmgsp6kna21jimb01x9pp1q7l7";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
btrfs-progs # for btrfs/ioctl.h
|
btrfs-progs # for btrfs/ioctl.h
|
||||||
util-linux # for uuid.h
|
util-linux # for uuid.h
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
python3Packages.markdown # documentation build
|
python3Packages.markdown # documentation build
|
||||||
];
|
];
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
@ -56,11 +65,12 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
(runCommand "bees-service" {
|
(runCommand "bees-service"
|
||||||
inherit bash bees coreutils;
|
{
|
||||||
utillinux = util-linux; # needs to be a valid shell variable name
|
inherit bash bees coreutils;
|
||||||
btrfsProgs = btrfs-progs; # needs to be a valid shell variable name
|
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"
|
mkdir -p -- "$out/bin"
|
||||||
substituteAll ${./bees-service-wrapper} "$out"/bin/bees-service-wrapper
|
substituteAll ${./bees-service-wrapper} "$out"/bin/bees-service-wrapper
|
||||||
chmod +x "$out"/bin/bees-service-wrapper
|
chmod +x "$out"/bin/bees-service-wrapper
|
||||||
|
Loading…
Reference in New Issue
Block a user