From 872d8fc5c9f4f8b5d31cb5a2a886e986dc0abd52 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Thu, 3 Aug 2017 14:43:15 +0200 Subject: [PATCH] flockit: init at 2012-08-11 The flockit library and tool exists solely because rsync doesn't have file locking. It's not used like a normal library; you don't link against it, and you don't have to patch your source code to use it. It's inserted between your program and its libraries by use of LD_PRELOAD. For example: $ env LD_PRELOAD=$(nix-build -A pkgs.flockit)/lib/libflockit.so FLOCKIT_FILE_PREFIX=test rsync SRC DEST Besides the library a handy executable is provided which can simplify the above to: $ $(nix-build -A pkgs.flockit)/bin/flockit test rsync SRC DEST Also see the following blog post: https://www.swiftstack.com/blog/2012/08/15/old-school-monkeypatching/ --- pkgs/tools/backup/flockit/default.nix | 51 +++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 53 insertions(+) create mode 100644 pkgs/tools/backup/flockit/default.nix diff --git a/pkgs/tools/backup/flockit/default.nix b/pkgs/tools/backup/flockit/default.nix new file mode 100644 index 00000000000..e569d9b6d59 --- /dev/null +++ b/pkgs/tools/backup/flockit/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + name = "flockit-${version}"; + version = "2012-08-11"; + + src = fetchFromGitHub { + owner = "smerritt"; + repo = "flockit"; + rev = "5c2b2092f8edcc8e3e2eb6ef66c968675dbfa686"; + sha256 = "0vajck9q2677gpn9a4flkyz7mw69ql1647cjwqh834nrcr2b5164"; + }; + + installPhase = '' + mkdir -p $out/lib $out/bin + cp ./libflockit.so $out/lib + + (cat < $out/bin/flockit + chmod +x $out/bin/flockit + ''; + + meta = with stdenv.lib; { + description = "LD_PRELOAD shim to add file locking to programs that don't do it (I'm looking at you, rsync!)"; + longDescription = '' + This library and tool exists solely because rsync doesn't have file locking. + + It's not used like a normal library; you don't link against it, and you + don't have to patch your source code to use it. It's inserted between your + program and its libraries by use of LD_PRELOAD. + + For example: + + $ env LD_PRELOAD=$(nix-build -A pkgs.flockit)/lib/libflockit.so FLOCKIT_FILE_PREFIX=test rsync SRC DEST + + Besides the library a handy executable is provided which can simplify the above to: + + $ $(nix-build -A pkgs.flockit)/bin/flockit test rsync SRC DEST + + Also see the following blog post: + https://www.swiftstack.com/blog/2012/08/15/old-school-monkeypatching/ + ''; + homepage = https://github.com/smerritt/flockit; + license = licenses.asl20; + platforms = platforms.linux; + maintainers = [ maintainers.basvandijk ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eb59deba7e8..7ff5f20767f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18615,6 +18615,8 @@ with pkgs; flat-plat = callPackage ../misc/themes/flat-plat { }; + flockit = callPackage ../tools/backup/flockit { }; + foldingathome = callPackage ../misc/foldingathome { }; foo2zjs = callPackage ../misc/drivers/foo2zjs {};