mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-17 04:08:30 +00:00
bees: nixpkgs-fmt
Change-Id: If4e9431dad00ffade3316cf22235d8d44d12d149
This commit is contained in:
parent
141b2b111d
commit
a3fa2cf7c2
@ -57,7 +57,7 @@ let
|
||||
};
|
||||
options.extraOptions = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = ''
|
||||
Extra command-line options passed to the daemon. See upstream bees documentation.
|
||||
'';
|
||||
@ -67,7 +67,8 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.services.beesd = {
|
||||
filesystems = mkOption {
|
||||
@ -87,37 +88,41 @@ in {
|
||||
};
|
||||
};
|
||||
config = {
|
||||
systemd.services = mapAttrs' (name: fs: nameValuePair "beesd@${name}" {
|
||||
description = "Block-level BTRFS deduplication for %i";
|
||||
after = [ "sysinit.target" ];
|
||||
systemd.services = mapAttrs'
|
||||
(name: fs: nameValuePair "beesd@${name}" {
|
||||
description = "Block-level BTRFS deduplication for %i";
|
||||
after = [ "sysinit.target" ];
|
||||
|
||||
serviceConfig = let
|
||||
configOpts = [
|
||||
fs.spec
|
||||
"verbosity=${toString fs.verbosity}"
|
||||
"idxSizeMB=${toString fs.hashTableSizeMB}"
|
||||
"workDir=${fs.workDir}"
|
||||
];
|
||||
configOptsStr = escapeShellArgs configOpts;
|
||||
in {
|
||||
# Values from https://github.com/Zygo/bees/blob/v0.6.1/scripts/beesd%40.service.in
|
||||
ExecStart = "${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${escapeShellArgs fs.extraOptions}";
|
||||
ExecStopPost = "${pkgs.bees}/bin/bees-service-wrapper cleanup ${configOptsStr}";
|
||||
CPUAccounting = true;
|
||||
CPUWeight = 12;
|
||||
IOSchedulingClass = "idle";
|
||||
IOSchedulingPriority = 7;
|
||||
IOWeight = 10;
|
||||
KillMode = "control-group";
|
||||
KillSignal = "SIGTERM";
|
||||
MemoryAccounting = true;
|
||||
Nice = 19;
|
||||
Restart = "on-abnormal";
|
||||
StartupCPUWeight = 25;
|
||||
StartupIOWeight = 25;
|
||||
SyslogIdentifier = "bees"; # would otherwise be "bees-service-wrapper"
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
}) cfg.filesystems;
|
||||
serviceConfig =
|
||||
let
|
||||
configOpts = [
|
||||
fs.spec
|
||||
"verbosity=${toString fs.verbosity}"
|
||||
"idxSizeMB=${toString fs.hashTableSizeMB}"
|
||||
"workDir=${fs.workDir}"
|
||||
];
|
||||
configOptsStr = escapeShellArgs configOpts;
|
||||
in
|
||||
{
|
||||
# Values from https://github.com/Zygo/bees/blob/v0.6.1/scripts/beesd@.service.in
|
||||
ExecStart = "${pkgs.bees}/bin/bees-service-wrapper run ${configOptsStr} -- --no-timestamps ${escapeShellArgs fs.extraOptions}";
|
||||
ExecStopPost = "${pkgs.bees}/bin/bees-service-wrapper cleanup ${configOptsStr}";
|
||||
CPUAccounting = true;
|
||||
CPUWeight = 12;
|
||||
IOSchedulingClass = "idle";
|
||||
IOSchedulingPriority = 7;
|
||||
IOWeight = 10;
|
||||
KillMode = "control-group";
|
||||
KillSignal = "SIGTERM";
|
||||
MemoryAccounting = true;
|
||||
Nice = 19;
|
||||
Restart = "on-abnormal";
|
||||
StartupCPUWeight = 25;
|
||||
StartupIOWeight = 25;
|
||||
SyslogIdentifier = "bees"; # would otherwise be "bees-service-wrapper"
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
})
|
||||
cfg.filesystems;
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,14 @@
|
||||
{ lib, stdenv, runCommand, fetchFromGitHub, bash, btrfs-progs, coreutils
|
||||
, python3Packages, util-linux, nixosTests }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, runCommand
|
||||
, fetchFromGitHub
|
||||
, bash
|
||||
, btrfs-progs
|
||||
, coreutils
|
||||
, python3Packages
|
||||
, util-linux
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
@ -15,12 +24,12 @@ let
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
btrfs-progs # for btrfs/ioctl.h
|
||||
util-linux # for uuid.h
|
||||
btrfs-progs # for btrfs/ioctl.h
|
||||
util-linux # for uuid.h
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3Packages.markdown # documentation build
|
||||
python3Packages.markdown # documentation build
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
@ -56,11 +65,12 @@ let
|
||||
|
||||
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
|
||||
} ''
|
||||
(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
|
||||
|
Loading…
Reference in New Issue
Block a user