From e6c7dc74331b47f944e6f68fb0776519dc90aced Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 24 Jan 2022 03:44:43 +0100 Subject: [PATCH] flakify --- Cargo.lock | 20 ++++++----- Cargo.toml | 4 +-- flake.lock | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ shell.nix | 34 ------------------ 5 files changed, 214 insertions(+), 44 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/Cargo.lock b/Cargo.lock index 51bae55..334b15f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1644,8 +1644,9 @@ dependencies = [ [[package]] name = "heron" -version = "1.0.1-rc.1" -source = "git+https://github.com/jcornaz/heron.git#9a2bba007d7e922d5e698e835fd7ee2b8d96f982" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864335a89bb0e2e6a86d3a2511410390e6710aa4151fe14759fd1f05e2fab371" dependencies = [ "bevy", "cfg_aliases", @@ -1656,8 +1657,9 @@ dependencies = [ [[package]] name = "heron_core" -version = "1.0.1-rc.1" -source = "git+https://github.com/jcornaz/heron.git#9a2bba007d7e922d5e698e835fd7ee2b8d96f982" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9db67811d60f01e7fcaf4ae4308f5006bfc16f6ae82f156ff9ec9215205e801" dependencies = [ "bevy", "cfg_aliases", @@ -1666,8 +1668,9 @@ dependencies = [ [[package]] name = "heron_macros" -version = "1.0.1-rc.1" -source = "git+https://github.com/jcornaz/heron.git#9a2bba007d7e922d5e698e835fd7ee2b8d96f982" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dc33e91c45b96611f455f257d9e8966a424d599b7644163a687b412c771fa6a" dependencies = [ "heron_core", "quote", @@ -1676,8 +1679,9 @@ dependencies = [ [[package]] name = "heron_rapier" -version = "1.0.1-rc.1" -source = "git+https://github.com/jcornaz/heron.git#9a2bba007d7e922d5e698e835fd7ee2b8d96f982" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d64cb512b191e072e74706637da8095078126b891c81058960eff8b344bce63" dependencies = [ "bevy", "cfg_aliases", diff --git a/Cargo.toml b/Cargo.toml index cc8cf14..884a8ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rust-bevy-test" +name = "entevsbaer" version = "0.1.0" authors = ["Astro "] edition = "2021" @@ -7,4 +7,4 @@ edition = "2021" [dependencies] rand = "0.8" bevy = { version = "0.6", features = ["jpeg"] } -heron = { git = "https://github.com/jcornaz/heron.git", features = ["3d"] } \ No newline at end of file +heron = { version = "1", features = ["3d"] } \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7792ac2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,101 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1642918989, + "narHash": "sha256-3yzQ9qilXDUjQcy7yq+mv3RJV2Lf2jA/ygGwTvFYEdA=", + "owner": "nix-community", + "repo": "fenix", + "rev": "f5e81e8dac96d156f2548ee8f0a34fa1cc20f866", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1639947939, + "narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=", + "owner": "nix-community", + "repo": "naersk", + "rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1642940213, + "narHash": "sha256-LXGwfPrtbhix9IRUT2phtbJsur41lkTsrKcTcS0lzIc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8ca77a63599ed951d6a2d244c1d62092776a3fe1", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "naersk": "naersk", + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1642845746, + "narHash": "sha256-4PmXSBTdzney7JeUTghBIfuAAl3hzd1fYyEzjyjnJME=", + "owner": "rust-analyzer", + "repo": "rust-analyzer", + "rev": "baa5cd95278f36ec9c851c72d6042ed13ab3efac", + "type": "github" + }, + "original": { + "owner": "rust-analyzer", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3a5155d --- /dev/null +++ b/flake.nix @@ -0,0 +1,99 @@ +{ + inputs = { + utils.url = "github:numtide/flake-utils"; + naersk.url = "github:nix-community/naersk"; + naersk.inputs.nixpkgs.follows = "nixpkgs"; + fenix.url = "github:nix-community/fenix"; + fenix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, utils, naersk, fenix }: + utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages."${system}"; + rust = fenix.packages.${system}.stable.withComponents [ + "cargo" + "rustc" + "rust-src" # just for rust-analyzer + "clippy" + ]; + + # Override the version used in naersk + naersk-lib = naersk.lib."${system}".override { + cargo = rust; + rustc = rust; + }; + + libpaths = with pkgs; lib.makeLibraryPath [ + vulkan-loader + xlibs.libXcursor + xlibs.libXi + xlibs.libXrandr + ]; + in rec { + # `nix build` + packages.entevsbaer = naersk-lib.buildPackage { + pname = "entevsbaer"; + src = ./.; + nativeBuildInputs = with pkgs; [ + makeWrapper + ]; + buildInputs = with pkgs; [ + alsaLib + cmake + udev + freetype + expat + openssl + pkgconfig + vulkan-validation-layers + xlibs.libX11 + ]; + overrideMain = attrs: { + installPhase = '' + ${attrs.installPhase} + + wrapProgram $out/bin/entevsbaer \ + --prefix LD_LIBRARY_PATH : ${libpaths} \ + --set CARGO_MANIFEST_DIR $out/share/entevsbaer + mkdir -p $out/share/entevsbaer + cp -a assets $out/share/entevsbaer/ + ''; + }; + # doCheck = true; + # cargoTestCommands = x: + # x ++ [ + # # clippy + # ''cargo clippy --all --all-features --tests -- \ + # -D clippy::pedantic \ + # -D warnings \ + # -A clippy::module-name-repetitions \ + # -A clippy::too-many-lines \ + # -A clippy::nonminimal_bool'' + # ]; + }; + defaultPackage = packages.entevsbaer; + + checks = packages; + + # `nix run` + apps.entevsbaer = utils.lib.mkApp { + drv = packages.entevsbaer; + }; + defaultApp = apps.entevsbaer; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = [ + fenix.packages.${system}.rust-analyzer + ] ++ + (with defaultPackage; nativeBuildInputs ++ buildInputs); + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libpaths}" + ''; + }; + }) // { + overlay = final: prev: { + entevsbaer = self.packages.${prev.system}; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index f4fa6ab..0000000 --- a/shell.nix +++ /dev/null @@ -1,34 +0,0 @@ -let - mozilla = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz); - nixpkgs = import { overlays = [ mozilla ]; }; -in - -with nixpkgs; - -mkShell { - buildInputs = [ - alsaLib - cmake - udev - freetype - latest.rustChannels.nightly.rust - #rustc cargo - expat - openssl - pkgconfig - python3 - vulkan-validation-layers - xlibs.libX11 - ]; - - APPEND_LIBRARY_PATH = lib.makeLibraryPath [ - vulkan-loader - xlibs.libXcursor - xlibs.libXi - xlibs.libXrandr - ]; - - shellHook = '' - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$APPEND_LIBRARY_PATH" - ''; -}