From d5a1aa8daaf1371d6b0032636c5c668dea581a3b Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sun, 19 Nov 2023 12:15:52 -0500 Subject: bevy --- lisp/.envrc | 1 + lisp/flake.nix | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 lisp/.envrc create mode 100644 lisp/flake.nix (limited to 'lisp') diff --git a/lisp/.envrc b/lisp/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/lisp/.envrc @@ -0,0 +1 @@ +use flake diff --git a/lisp/flake.nix b/lisp/flake.nix new file mode 100644 index 0000000..4418230 --- /dev/null +++ b/lisp/flake.nix @@ -0,0 +1,67 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { self, nixpkgs, rust-overlay }: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + + system = "x86_64-linux"; + app = "lisp"; + + rust = pkgs.rust-bin.nightly.latest.default.override { extensions = [ "rust-src" ]; }; + rustPlatform = pkgs.makeRustPlatform { cargo = rust; rustc = rust; }; + + shellInputs = with pkgs; [ + rust clang mold rust-analyzer + ]; + appNativeBuildInputs = with pkgs; [ + pkg-config + ]; + appBuildInputs = appRuntimeInputs ++ (with pkgs; [ + ]); + appRuntimeInputs = with pkgs; [ + ]; + in + { + devShells.${system}.${app} = pkgs.mkShell { + nativeBuildInputs = appNativeBuildInputs; + buildInputs = shellInputs ++ appBuildInputs; + + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath appRuntimeInputs}" + ln -fsT ${rust} ./.direnv/rust + ''; + }; + devShell.${system} = self.devShells.${system}.${app}; + + packages.${system}.${app} = rustPlatform.buildRustPackage { + pname = app; + version = "0.1.0"; + + src = ./.; + cargoSha256 = "sha256-lzs+8qAsBJ/ms/OppxnKfJChV9+xM0W/QRZGPn+9uv4="; + + nativeBuildInputs = appNativeBuildInputs; + buildInputs = appBuildInputs; + + postInstall = '' + cp -r assets $out/bin/ + ''; + }; + defaultPackage.${system} = self.packages.${system}.${app}; + + apps.${system}.${app} = { + type = "app"; + program = "${self.packages.${system}.${app}}/bin/${app}"; + }; + defaultApp.${system} = self.apps.${system}.${app}; + + checks.${system}.build = self.packages.${system}.${app}; + }; +} -- cgit v1.2.3