加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
default.nix 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
Risto Saarelma 提交于 2021-06-15 21:47 . Update nix scripts
let
rpath = with pkgs; pkgs.lib.makeLibraryPath [ vulkan-loader ];
# Tell Nix to ignore in-tree build artifact directory 'target' when
# determining the unique source fingerprint of the repo.
src = builtins.filterSource
(path: type: type != "directory" || builtins.baseNameOf path != "target")
./.;
pkgs = import <nixpkgs> {};
sources = import ./nix/sources.nix;
naersk = pkgs.callPackage sources.naersk {};
version = "0.1.0";
basename = "magog";
in naersk.buildPackage {
inherit src;
name = "${basename}-${version}";
buildInputs = with pkgs; [
# Needed by cargo dependencies.
cmake gcc zlib pkgconfig openssl
# wgpu graphics dependencies
vulkan-loader xorg.libXcursor xorg.libXi xorg.libXrandr
makeWrapper
];
# Optimize binary size.
prePatch = ''
cat >> Cargo.toml << EOF
[profile.release]
lto = true
codegen-units = 1
panic = 'abort'
EOF
'';
# Wrap with necessary runtime libraries
postInstall = ''
if [[ -f $out/bin/${basename} ]]; then
wrapProgram $out/bin/${basename} --prefix LD_LIBRARY_PATH : "${rpath}"
fi
'';
meta = with pkgs.lib; {
description = "A fantasy roguelike game";
homepage = https://github.com/rsaarelm/magog;
license = licenses.agpl3;
platforms = platforms.all;
};
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化