Add flake.nix file for easy building

This commit is contained in:
Daniel Poelzleithner 2021-11-24 14:28:46 +01:00
parent 42413cabbe
commit 9b2b3ad6e6
4 changed files with 97 additions and 1 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ install_manifest.txt
defaults.c
runner.c
result

View File

@ -1,6 +1,6 @@
# preamble
project( Lsyncd )
cmake_minimum_required( VERSION 2.8 )
cmake_minimum_required( VERSION 3.10 )
set( LSYNCD_VERSION 2.2.3 )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/" )

43
flake.lock Normal file
View File

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1637014545,
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1637709854,
"narHash": "sha256-y98gkOBUEiPAmwRhZPzTQ0YayZKPS2loNgA0GcNewMM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9c43581935a23d56734bd02da0ba8e7fda21e747",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "release-21.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

52
flake.nix Normal file
View File

@ -0,0 +1,52 @@
{
description = "Lsyncd (Live Syncing Daemon)";
inputs.nixpkgs.url = "github:nixos/nixpkgs/release-21.05";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
defaultDeps = with pkgs; [
gcc
cmake
glib
];
version = builtins.elemAt
(builtins.match ''.*set\(.LSYNCD_VERSION ([0-9\.]*).*''
(builtins.substring 0 500
(builtins.readFile ./CMakeLists.txt))) 0;
# buildTypes = {
# lua5_2 = pkgs.lua5_2;
# lua5_3 = pkgs.lua5_3;
# };
in
let
mkLsync = luaPackage: pkgs.stdenv.mkDerivation ({
inherit version;
name = "lsyncd";
src = ./.;
# nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
buildInputs = defaultDeps ++ [luaPackage];
});
in
{
packages = {
lsyncd = mkLsync pkgs.lua5_3;
lsyncd_lua5_1 = mkLsync pkgs.lua5_1;
lsyncd_lua5_2 = mkLsync pkgs.lua5_2;
lsyncd_lua5_3 = mkLsync pkgs.lua5_3;
lsyncd_lua5_4 = mkLsync pkgs.lua5_4;
};
defaultPackage = self.packages.${system}.lsyncd;
devShell = pkgs.mkShell {
buildInputs = defaultDeps;
};
}
);
}