mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
nix+flake: packages+overlays: init noita-proxy
This commit is contained in:
parent
876d3da91e
commit
be993008c3
5 changed files with 112 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -8,3 +8,7 @@ save_state
|
|||
/quant.ew/ewext1.dll
|
||||
/blob_guy/blob_guy/blob_guy.dll
|
||||
/blob_guy/target
|
||||
|
||||
# Nix
|
||||
/result
|
||||
/result-man
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
in {
|
||||
overlays = import ./nix/overlays { inherit self lib rust-overlay; };
|
||||
|
||||
packages = lib.mapAttrs (system: pkgs: {
|
||||
default = self.packages.${system}.noita-proxy;
|
||||
inherit (pkgs) noita-proxy;
|
||||
}) pkgsFor;
|
||||
|
||||
devShells = lib.mapAttrs
|
||||
(system: pkgs: { default = pkgs.callPackage ./nix/shell.nix { }; })
|
||||
pkgsFor;
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
{ self, lib, rust-overlay }: {
|
||||
{ self, lib, rust-overlay }:
|
||||
let rustPackageOverlay = import ./rust-package.nix;
|
||||
in {
|
||||
default = lib.composeManyExtensions [
|
||||
# This is to ensure that other overlays and invocations of `callPackage`
|
||||
# receive `rust-bin`, but without hard-coding a specific derivation.
|
||||
# This can be overridden by consumers.
|
||||
self.overlays.rust-overlay
|
||||
|
||||
# Packages provided by this flake:
|
||||
self.overlays.noita-proxy
|
||||
];
|
||||
|
||||
# This flake exposes `overlays.rust-overlay` which is automatically applied
|
||||
|
@ -11,4 +16,12 @@
|
|||
# the package overlay, in the event it is not already present.
|
||||
rust-overlay = final: prev:
|
||||
if prev ? rust-bin then { } else rust-overlay.overlays.default final prev;
|
||||
|
||||
# The overlay definition uses `rust-bin` to construct a `rustPlatform`,
|
||||
# and `rust-bin` is not provided by this particular overlay.
|
||||
# Prefer using `overlays.default`, or composing with `rust-overlay` manually.
|
||||
noita-proxy = rustPackageOverlay {
|
||||
packageName = "noita-proxy";
|
||||
sourceRoot = self;
|
||||
};
|
||||
}
|
||||
|
|
20
nix/overlays/rust-package.nix
Normal file
20
nix/overlays/rust-package.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
# This function is imported as `rustPackageOverlay` in `nix/overlays/default.nix`.
|
||||
#
|
||||
# Supplies a stable `rustPlatform` from `rust-bin` to `callPackage`.
|
||||
# The `rust-overlay` must have already been composed onto the `pkgs` set.
|
||||
#
|
||||
# This prevents `rust-bin` from being an input of the package, which would
|
||||
# make it less portable.
|
||||
{ packageName, sourceRoot }:
|
||||
final: _prev:
|
||||
let
|
||||
rust-stable = final.rust-bin.stable.latest.minimal;
|
||||
rustPlatform = final.makeRustPlatform {
|
||||
cargo = rust-stable;
|
||||
rustc = rust-stable;
|
||||
};
|
||||
in {
|
||||
${packageName} = final.callPackage "${../packages}/${packageName}.nix" {
|
||||
inherit sourceRoot rustPlatform;
|
||||
};
|
||||
}
|
68
nix/packages/noita-proxy.nix
Normal file
68
nix/packages/noita-proxy.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{ sourceRoot, lib, runCommandNoCC, rustPlatform, pkg-config, cmake, patchelf
|
||||
, openssl, libjack2, alsa-lib, libopus, wayland, libxkbcommon, libGL }:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs:
|
||||
let
|
||||
inherit (finalAttrs) src pname version buildInputs steamworksRedist;
|
||||
manifest = lib.importTOML "${src}/noita-proxy/Cargo.toml";
|
||||
in {
|
||||
pname = "noita-entangled-worlds-proxy";
|
||||
inherit (manifest.package) version;
|
||||
|
||||
# The real root of the entire project.
|
||||
# This is the only place `sourceRoot` is used.
|
||||
src = sourceRoot;
|
||||
# The root of this particular binary crate to build.
|
||||
sourceRoot = "source/noita-proxy";
|
||||
|
||||
cargoLock.lockFile = "${src}/noita-proxy/Cargo.lock";
|
||||
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ pkg-config cmake patchelf ];
|
||||
|
||||
# TODO: Add dependencies for X11 desktop environments.
|
||||
buildInputs = [
|
||||
openssl
|
||||
libjack2
|
||||
alsa-lib
|
||||
libopus
|
||||
wayland
|
||||
libxkbcommon
|
||||
libGL
|
||||
steamworksRedist
|
||||
];
|
||||
|
||||
env = {
|
||||
OPENSSL_DIR = "${lib.getDev openssl}";
|
||||
OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
|
||||
OPENSSL_NO_VENDOR = 1;
|
||||
};
|
||||
|
||||
checkFlags = [
|
||||
# Disable networked tests
|
||||
"--skip bookkeeping::releases::test::release_assets"
|
||||
];
|
||||
|
||||
postFixup = ''
|
||||
patchelf $out/bin/noita-proxy \
|
||||
--set-rpath ${lib.makeLibraryPath buildInputs}
|
||||
'';
|
||||
|
||||
# This attribute is defined here instead of a `let` block, because in this position,
|
||||
# it can be overridden with `overrideAttrs`, and shares a `src` with the top-level.
|
||||
steamworksRedist =
|
||||
runCommandNoCC "${pname}-steamworks-redist" { inherit src; } ''
|
||||
install -Dm555 $src/redist/libsteam_api.so -t $out/lib
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Noita Entangled Worlds proxy application.";
|
||||
homepage = "https://github.com/IntQuant/noita_entangled_worlds";
|
||||
changelog =
|
||||
"https://github.com/IntQuant/noita_entangled_worlds/releases/tag/v${version}";
|
||||
license = with lib.licenses; [ mit asl20 ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with lib.maintainers; [ spikespaz ];
|
||||
mainProgram = "noita-proxy";
|
||||
};
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue