diff options
author | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2024-05-12 20:37:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-12 20:37:35 +0200 |
commit | 1ec269e9c36289a5aca9201597e856209cc78959 (patch) | |
tree | 04102e08d9bc5ec828322898dd562b191f0ac2cd /pkgs/by-name | |
parent | 7c335fa5fc994844f23b61d1f343dd9cabb5149a (diff) | |
parent | 7eb350bf2c18083a90a0ea2b697c25061c0555d6 (diff) |
Merge pull request #310501 from NixOS/backport-309449-to-release-23.11
[Backport release-23.11] btrfs-auto-snapshot: init at 2.0.4
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/bt/btrfs-auto-snapshot/package.nix | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/pkgs/by-name/bt/btrfs-auto-snapshot/package.nix b/pkgs/by-name/bt/btrfs-auto-snapshot/package.nix new file mode 100644 index 0000000000000..7392a0c5809d1 --- /dev/null +++ b/pkgs/by-name/bt/btrfs-auto-snapshot/package.nix @@ -0,0 +1,75 @@ +{ + lib, + stdenv, + fetchFromGitHub, + makeWrapper, + coreutils, + getopt, + gnugrep, + gnused, + gawk, + btrfs-progs, + syslogSupport ? true, + util-linux ? null, +}: +assert syslogSupport -> util-linux != null; +stdenv.mkDerivation rec { + version = "2.0.4"; + pname = "btrfs-auto-snapshot"; + + src = fetchFromGitHub { + owner = "hunleyd"; + repo = pname; + rev = "v${version}"; + hash = "sha256-QpuwkGaYAkpu5hYyb360Mr5tHsZc2LzMlKtpS8CyyhI="; + }; + + dontBuild = true; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + install -Dm755 btrfs-auto-snapshot $out/bin/btrfs-auto-snapshot + ''; + + wrapperPath = + with lib; + makeBinPath ( + [ + coreutils + getopt + gnugrep + gnused + gawk + btrfs-progs + ] + ++ optional syslogSupport util-linux + ); + + postFixup = '' + wrapProgram $out/bin/btrfs-auto-snapshot \ + --prefix PATH : "${wrapperPath}" + ''; + + meta = with lib; { + description = "BTRFS Automatic Snapshot Service for Linux"; + homepage = "https://github.com/hunleyd/btrfs-auto-snapshot"; + license = licenses.gpl2; + mainProgram = "btrfs-auto-snapshot"; + maintainers = with maintainers; [ motiejus ]; + platforms = platforms.linux; + + longDescription = '' + btrfs-auto-snapshot is a Bash script designed to bring as much of the + functionality of the wonderful ZFS snapshot tool zfs-auto-snapshot to + BTRFS as possible. Designed to run from cron (using + /etc/cron.{daily,hourly,weekly}) it automatically creates a snapshot of + the specified BTRFS filesystem (or, optionally, all of them) and then + automatically purges the oldest snapshots of that type (hourly, daily, et + al) based on a user-defined retention policy. + + Snapshots are stored in a '.btrfs' directory at the root of the BTRFS + filesystem being snapped and are read-only by default. + ''; + }; +} |