Skip to content

Commit

Permalink
add flake dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
Naxdy committed Feb 19, 2024
1 parent 9a0c9b9 commit a35b62f
Show file tree
Hide file tree
Showing 8 changed files with 358 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[unstable]
build-std = ["std", "panic_abort", "core", "alloc"]
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
/.direnv
/result
104 changes: 104 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "arena-latency-slider"
version = "0.1.0"
version = "0.2.0"
authors = []
edition = "2021"

Expand All @@ -12,11 +12,11 @@ crate-type = ["cdylib"]

[dependencies]
ninput = { git = "https://github.com/blu-dev/ninput", version = "0.1.0" }
skyline = "0.2.0"
skyline = "0.2.1"

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"
lto = true
lto = true
164 changes: 164 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";

flake-utils.url = "github:numtide/flake-utils";

rust-overlay.url = "github:oxalica/rust-overlay";

cargo-skyline-src = {
url = "github:jam1garner/cargo-skyline";
flake = false;
};

skyline-rs = {
url = "github:ultimate-research/skyline-rs";
flake = false;
};
};

outputs =
{ self
, nixpkgs
, flake-utils
, rust-overlay
, cargo-skyline-src
, skyline-rs
}: (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
];
};

rustToolchain = (pkgs.rust-bin.nightly."2023-12-30".default.override {
extensions = [
"rust-src"
"rust-std"
];
});
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};

cargo-skyline = rustPlatform.buildRustPackage {
pname = "cargo-skyline";
version = (builtins.fromTOML (builtins.readFile "${cargo-skyline-src}/Cargo.toml")).package.version;

src = cargo-skyline-src;

cargoLock = {
lockFile = "${cargo-skyline-src}/Cargo.lock";
};

meta = {
description = "A cargo subcommand for working with Skyline plugins written in Rust";
};
};
in
{
packages.rustToolchain = rustToolchain;

devShells.default = pkgs.mkShell {
nativeBuildInputs = builtins.attrValues {
inherit cargo-skyline;

# for now, we use rustup to manage the toolchain
# because skyline has some weird customizations that
# I don't feel like getting into at this point in time
# this means no reproducible builds (for now), but I can live with that
inherit (pkgs) rustup;
};

# this is mainly for rust-analyzer to not get confused
CARGO_BUILD_TARGET = "${skyline-rs}/aarch64-skyline-switch.json";
};
}));
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![feature(restricted_std)]

use skyline::hooks::InlineCtx;

#[skyline::from_offset(0x37a1270)]
Expand Down

0 comments on commit a35b62f

Please sign in to comment.