Initial support for building with nix. (#106)

Add flake.nix to project, so this project can be built with nix. 

Also:
- Fix a died link in README.
- Add missing dependencies in docs for Ubuntu and Arch (not tested).
This commit is contained in:
Xinyang Li 2023-04-08 11:25:29 +08:00 committed by GitHub
parent ed70e54cff
commit 8aa8775fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 3 deletions

View File

@ -44,7 +44,7 @@ ___
## 如何构建
关于如何从头构建FreeKill详见[编译教程](./doc/dev/compile.md)。
关于如何从头构建FreeKill详见[编译教程](https://notify-ctrl.github.io/FreeKill/dev/compile.html)。
___

View File

@ -46,13 +46,13 @@ Debian一家子
.. code:: sh
$ sudo apt install liblua5.4-dev libsqlite3-dev libssl-dev swig flex bison
$ sudo apt install liblua5.4-dev libsqlite3-dev libreadline-dev libssl-dev swig flex bison
Arch Linux
.. code:: sh
$ sudo pacman -Sy lua sqlite swig openssl flex bison
$ sudo pacman -Sy lua sqlite swig openssl flex bison libgit2
然后使用配置好的QtCreator环境即可编译。
@ -71,6 +71,13 @@ Arch Linux
$ cmake ..
$ make -j8
如果你使用 Nix/NixOs 的话可以在clone repo后直接使用 nix flake 构建:
.. code:: sh
$ git clone https://github.com/Notify-ctrl/FreeKill
$ nix build '.?submodules=1'
--------------
Linux服务器

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1680724564,
"narHash": "sha256-eeUUGOTKTelYKDbUxKs0V7GUa186L2fym7jM2QQ4Oss=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "36adaa6aaa6b03e59102df0c1b12cdc3f23fd112",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View File

@ -0,0 +1,38 @@
{
description = "Sanguosha (a.k.a. Legend of Three Kingdoms, LTK) written in Qt and Lua.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
};
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
name = "freekill";
version = "0.0.7";
src = self;
buildInputs = with qt6; [
qtbase
qtdeclarative
qt5compat
qtmultimedia
qttools
sqlite
swig
openssl
flex
bison
readline
libgit2
lua5_4
];
nativeBuildInputs = [ cmake qt6.wrapQtAppsHook ];
postPatch = ''
substituteInPlace src/CMakeLists.txt --replace "LUA_LIB lua5.4" "LUA_LIB lua";
'';
};
};
}