WIP: feat: add nix flake #3

Closed
ckiee wants to merge 1 commits from init-nix-flake into main
3 changed files with 126 additions and 1 deletions

4
.gitignore vendored
View File

@@ -5,4 +5,6 @@
**/*.rs.bk
*.blend1
.vscode
.vscode
result

66
flake.lock generated Normal file
View File

@@ -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
}

57
flake.nix Normal file
View File

@@ -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");
};
}