diff --git a/.gitignore b/.gitignore index d83fc7c..407a43a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ **/*.rs.bk *.blend1 -.vscode \ No newline at end of file +.vscode + +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b26b159 --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1697091737, + "narHash": "sha256-NFdGypcUH8O3yRGFmLYY0ziR5hs7R9dg+fwBqZm32Cc=", + "owner": "nix-community", + "repo": "fenix", + "rev": "6f5c1db382feec02391daf406695a4fc91d44c87", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1697032224, + "narHash": "sha256-6qXqJ3aNc3Ckq/6RKARydQsCC5sK0QkzNQhsUiCLNdM=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "7eec17e6273543d1c535333433ab553df22260db", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a95ade2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + + inputs.fenix.url = "github:nix-community/fenix"; + inputs.fenix.inputs.nixpkgs.follows = "nixpkgs"; + + outputs = { self, nixpkgs, fenix }: + let + name = "protostar"; + pkgs = system: import nixpkgs { inherit system; }; + shell = pkgs: + pkgs.mkShell { inputsFrom = [ self.packages.${pkgs.system}.default ]; }; + package = pkgs: + let toolchain = fenix.packages.${pkgs.system}.minimal.toolchain; + in (pkgs.makeRustPlatform { + cargo = toolchain; + rustc = toolchain; + }).buildRustPackage rec { + pname = name; + src = ./.; + + # ---- START package specific settings ---- + version = "0.8.0"; + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "stardust-xr-0.14.1" = + "sha256-AZRVXa0mIrNSlH3tTnUarU7RghyPiK6PsKruk3cZsjk="; + "stardust-xr-molecules-0.29.0" = + "sha256-RzLvTQOG9fE3fhM17RtodzsLmeFF1qDjJH0lz9+tPEo="; + }; + }; + + # TODO: nothing renders, needs to use res dirs for everything + STARDUST_RES_PREFIXES = ./hexagon_launcher/res; + + buildInputs = with pkgs; [ libxkbcommon xorg.libxcb ]; + checkFlags = [ + # depends on system env + "--skip=xdg::test_get_desktop_files" + "--skip=xdg::test_get_icon_path" + "--skip=xdg::test_render_svg_to_png" + ]; + # ---- END package specific settings ---- + }; + in { + overlays.default = final: prev: { + stardust-xr = (prev.stardust-xr or { }) // { ${name} = package final; }; + }; + + packages."x86_64-linux".default = package (pkgs "x86_64-linux"); + packages."aarch64-linux".default = package (pkgs "aarch64-linux"); + + devShells."x86_64-linux".default = shell (pkgs "x86_64-linux"); + devShells."aarch64-linux".default = shell (pkgs "aarch64-linux"); + }; +}