Initial commit
This commit is contained in:
commit
3ee50f9aff
6 changed files with 158 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
31
derivation.nix
Normal file
31
derivation.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
rustPlatform,
|
||||
name,
|
||||
}:
|
||||
(rustPlatform.buildRustPackage {
|
||||
inherit name;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
dbus
|
||||
openssl
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
vulkan-loader
|
||||
SDL2
|
||||
SDL2_ttf
|
||||
];
|
||||
|
||||
src = lib.cleanSource ./.;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
# Make sure the vulkan libraries get patched in properly
|
||||
postFixup = ''
|
||||
patchelf --add-rpath ${pkgs.vulkan-loader}/lib $out/bin/*
|
||||
'';
|
||||
})
|
||||
48
flake.lock
generated
Normal file
48
flake.lock
generated
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1731954261,
|
||||
"narHash": "sha256-xk83zrDElaMXiHI8DH6sLLTix5+ijPYmIusiQ16GDdc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ad2c28c6c5cc04e09bed68db46db5718d40b5b9e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "release-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731897198,
|
||||
"narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "0be641045af6d8666c11c2c40e45ffc9667839b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
62
flake.nix
Normal file
62
flake.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
description = "Empty Epsilon inspired bridge simulator";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/release-24.05";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
systems = ["x86_64-linux"];
|
||||
systemClosure = attrs:
|
||||
builtins.foldl' (acc: system:
|
||||
lib.recursiveUpdate acc (attrs system)) {}
|
||||
systems;
|
||||
in
|
||||
systemClosure (system:
|
||||
let
|
||||
inherit ((builtins.fromTOML (builtins.readFile ./Cargo.toml)).package) name;
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [(import rust-overlay)];
|
||||
};
|
||||
toolchain = (
|
||||
pkgs.rust-bin.fromRustupToolchainFile ./rust_toolchain.toml
|
||||
);
|
||||
rustPlatform = pkgs.makeRustPlatform
|
||||
{
|
||||
rustc = toolchain;
|
||||
cargo = toolchain;
|
||||
};
|
||||
libPath = with pkgs; lib.makeLibraryPath [
|
||||
openssl
|
||||
SDL2
|
||||
SDL_ttf
|
||||
vulkan-loader
|
||||
];
|
||||
in
|
||||
{
|
||||
packages.${system}.default = pkgs.callPackage ./derivation.nix {
|
||||
inherit name rustPlatform;
|
||||
};
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
toolchain
|
||||
clang
|
||||
llvmPackages.bintools
|
||||
openssl
|
||||
pkg-config
|
||||
SDL2
|
||||
SDL2_image
|
||||
SDL2_ttf
|
||||
];
|
||||
|
||||
LD_LIBRARY_PATH = libPath;
|
||||
};
|
||||
});
|
||||
}
|
||||
3
rust_toolchain.toml
Normal file
3
rust_toolchain.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2024-10-17"
|
||||
components = ["rust-src", "rust-analyzer"]
|
||||
13
rustfmt.toml
Normal file
13
rustfmt.toml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
brace_style = "AlwaysNextLine"
|
||||
condense_wildcard_suffixes = true
|
||||
control_brace_style = "ClosingNextLine"
|
||||
fn_single_line = true
|
||||
format_strings = true
|
||||
hard_tabs = true # Please don't cancel me
|
||||
hex_literal_case = "Lower"
|
||||
imports_granularity = "Module"
|
||||
match_block_trailing_comma = true
|
||||
newline_style = "Unix"
|
||||
group_imports = "StdExternalCrate"
|
||||
struct_field_align_threshold = 15
|
||||
wrap_comments = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue