lsyncd/flake.nix

98 lines
3.2 KiB
Nix
Raw Normal View History

2021-11-24 13:28:46 +00:00
{
description = "Lsyncd (Live Syncing Daemon)";
2022-01-12 19:46:14 +00:00
inputs.nixpkgs.url = "github:nixos/nixpkgs/release-21.11";
2021-11-24 13:28:46 +00:00
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
2022-01-12 19:46:14 +00:00
pkgs = (import nixpkgs {
inherit system;
# Makes the config pure as well. See <nixpkgs>/top-level/impure.nix:
config = {
allowBroken = true;
};}); #.legacyPackages.${system};
2021-11-24 13:28:46 +00:00
defaultDeps = with pkgs; [
gcc
cmake
2022-01-12 19:46:14 +00:00
gnumake
2021-11-24 13:28:46 +00:00
glib
rsync
openssh
2022-01-12 19:46:14 +00:00
curl
2021-11-24 13:28:46 +00:00
];
version = builtins.elemAt
(builtins.match ''.*set\(.LSYNCD_VERSION ([0-9\.]*).*''
(builtins.substring 0 500
(builtins.readFile ./CMakeLists.txt))) 0;
2022-01-12 19:46:14 +00:00
mylua5_4 = pkgs.lua5_4.override({
packageOverrides = luaself: luaprev: {
luarocks = luaprev.luarocks-3_7;
};
});
luaposix35 = mylua: mylua.pkgs.buildLuarocksPackage {
pname = "luaposix";
lua = mylua;
version = "35.1-1";
knownRockspec = (pkgs.fetchurl {
url = "https://luarocks.org/luaposix-35.1-1.rockspec";
sha256 = "1n6c7qyabj2y95jmbhf8fxbrp9i73kphmwalsam07f9w9h995xh1";
}).outPath;
src = pkgs.fetchurl {
url = "http://github.com/luaposix/luaposix/archive/v35.1.zip";
sha256 = "1c03chkzwr2p1wd0hs1bafl2890fqbrfc3qk0wxbd202gc6128zi";
};
#
propagatedBuildInputs = [ mylua ];
meta = {
homepage = "http://github.com/luaposix/luaposix/";
description = "Lua bindings for POSIX";
license.fullName = "MIT/X11";
};
};
buildTypes = {
2022-01-12 19:46:14 +00:00
lua5_1 = [pkgs.lua5_1 pkgs.lua51Packages.luaposix];
lua5_2 = [pkgs.lua5_2 pkgs.lua52Packages.luaposix];
lua5_3 = [pkgs.lua5_3 pkgs.lua53Packages.luaposix];
lua5_4 = [pkgs.lua5_3 (luaposix35 mylua5_4)];
};
2021-11-24 13:28:46 +00:00
in
let
mkLsync = luaPackages: pkgs.stdenv.mkDerivation ({
2021-11-24 13:28:46 +00:00
inherit version;
name = "lsyncd";
src = ./.;
2022-01-12 19:46:14 +00:00
buildInputs = defaultDeps ++ luaPackages;
2022-01-12 19:46:14 +00:00
});
mkDev = packages: pkgs.mkShell {
propagatedBuildInputs = defaultDeps ++ packages;
};
2021-11-24 13:28:46 +00:00
in
{
packages = {
lsyncd = mkLsync buildTypes.lua5_3;
lsyncd_lua5_1 = mkLsync buildTypes.lua5_1;
lsyncd_lua5_2 = mkLsync buildTypes.lua5_2;
lsyncd_lua5_3 = mkLsync buildTypes.lua5_3;
lsyncd_lua5_4 = mkLsync buildTypes.lua5_4;
2021-11-24 13:28:46 +00:00
};
2022-01-12 19:46:14 +00:00
devShells = {
lsyncd = mkDev buildTypes.lua5_3;
lsyncd_lua5_1 = mkDev buildTypes.lua5_1;
lsyncd_lua5_2 = mkDev buildTypes.lua5_2;
lsyncd_lua5_3 = mkDev buildTypes.lua5_3;
lsyncd_lua5_4 = mkDev buildTypes.lua5_4;
};
2021-11-24 13:28:46 +00:00
defaultPackage = self.packages.${system}.lsyncd;
}
);
}