nixpkgs/pkgs/by-name/sa/sanoid/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

103 lines
2.2 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
nixosTests,
makeWrapper,
zfs,
perlPackages,
procps,
which,
openssh,
mbuffer,
pv,
lzop,
gzip,
pigz,
}:
stdenv.mkDerivation rec {
pname = "sanoid";
version = "2.2.0";
src = fetchFromGitHub {
owner = "jimsalterjrs";
repo = pname;
rev = "v${version}";
sha256 = "sha256-qfRGZ10fhLL4tJL97VHrdOkO/4OVpa087AsL9t8LMmk=";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = with perlPackages; [
perl
ConfigIniFiles
CaptureTiny
];
passthru.tests = nixosTests.sanoid;
installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
mkdir -p "$out/etc/sanoid"
cp sanoid.defaults.conf "$out/etc/sanoid/sanoid.defaults.conf"
# Hardcode path to default config
substitute sanoid "$out/bin/sanoid" \
--replace "\$args{'configdir'}/sanoid.defaults.conf" "$out/etc/sanoid/sanoid.defaults.conf"
chmod +x "$out/bin/sanoid"
# Prefer ZFS userspace tools from /run/booted-system/sw/bin to avoid
# incompatibilities with the ZFS kernel module.
wrapProgram "$out/bin/sanoid" \
--prefix PERL5LIB : "$PERL5LIB" \
--prefix PATH : "${
lib.makeBinPath [
procps
"/run/booted-system/sw"
zfs
]
}"
install -m755 syncoid "$out/bin/syncoid"
wrapProgram "$out/bin/syncoid" \
--prefix PERL5LIB : "$PERL5LIB" \
--prefix PATH : "${
lib.makeBinPath [
openssh
procps
which
pv
mbuffer
lzop
gzip
pigz
"/run/booted-system/sw"
zfs
]
}"
install -m755 findoid "$out/bin/findoid"
wrapProgram "$out/bin/findoid" \
--prefix PERL5LIB : "$PERL5LIB" \
--prefix PATH : "${
lib.makeBinPath [
"/run/booted-system/sw"
zfs
]
}"
runHook postInstall
'';
meta = with lib; {
description = "Policy-driven snapshot management tool for ZFS filesystems";
homepage = "https://github.com/jimsalterjrs/sanoid";
license = licenses.gpl3Plus;
maintainers = with maintainers; [
lopsided98
Frostman
];
platforms = platforms.all;
};
}