Compare commits
2 commits
3f596a6dc9
...
c51423874b
Author | SHA1 | Date | |
---|---|---|---|
|
c51423874b | ||
|
3216292d08 |
98
flake.lock
98
flake.lock
|
@ -16,25 +16,25 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"lastModified": 1696343447,
|
||||
"narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
|
@ -51,16 +51,52 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1696725822,
|
||||
"narHash": "sha256-B7uAOS7TkLlOg1aX01rQlYbydcyB6ZnLJSfaYbKVww8=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1696983906,
|
||||
"narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5aabb5780a11c500981993d49ee93cfa6df9307b",
|
||||
"rev": "bd1cde45c77891214131cbbea5b1203e485a9d51",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1696019113,
|
||||
"narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1697009197,
|
||||
"narHash": "sha256-viVRhBTFT8fPJTb1N3brQIpFZnttmwo3JVKNuWRVc3s=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "01441e14af5e29c9d27ace398e6dd0b293e25a54",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
|
@ -81,38 +117,24 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"zig": "zig"
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"zig-overlay": "zig-overlay"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zig": {
|
||||
"zig-overlay": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1696810944,
|
||||
"narHash": "sha256-yvt223HLZlAJa/u4uzT5aw3ph2bifto/KfU2k+eX+jg=",
|
||||
"lastModified": 1697198920,
|
||||
"narHash": "sha256-dtaoksNoOMC3H+FDF3cK+bP+jYvJokYBAFvzCALLDYk=",
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "6dc03885321cc8aad6356c847148eb40e167f9fb",
|
||||
"rev": "2d779a7657e346323ab048b218994dbdc42655d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
74
flake.nix
74
flake.nix
|
@ -1,47 +1,59 @@
|
|||
{
|
||||
description = "FabApp";
|
||||
|
||||
# Inspired by https://github.com/mitchellh/zig-objc/blob/main/flake.nix
|
||||
inputs = {
|
||||
# take unstable if not specified
|
||||
# nixpkgs.url = "github:nixos/nixpkgs/release-23.05";
|
||||
# nixpkgs.url = "github:NixOS/nixpkgs/unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
zig.url = "github:mitchellh/zig-overlay";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
zig-overlay.url = "github:mitchellh/zig-overlay";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
outputs = inputs@{ flake-parts, nixpkgs, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
flake = {
|
||||
# Put your original flake attributes here.
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
} @ inputs: let
|
||||
overlays = [
|
||||
(final: prev: {
|
||||
zigpkgs = inputs.zig.packages.${prev.system};
|
||||
})
|
||||
];
|
||||
systems = [ "x86_64-linux" ];
|
||||
in
|
||||
flake-utils.lib.eachSystem systems (
|
||||
system: let
|
||||
pkgs = import nixpkgs {inherit overlays system;};
|
||||
in rec {
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
zigpkgs.master
|
||||
|
||||
# https://flake.parts/module-arguments.html#persystem-module-parameters
|
||||
perSystem = { pkgs, system, ... }: {
|
||||
# We need unstable for Zig
|
||||
_module.args.pkgs = import inputs.nixpkgs-unstable {
|
||||
inherit system;
|
||||
# https://flake.parts/overlays
|
||||
overlays = [
|
||||
inputs.zig-overlay.overlays.default
|
||||
];
|
||||
config = { };
|
||||
};
|
||||
|
||||
formatter = pkgs.nixfmt;
|
||||
|
||||
devShells.default = with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
sqlite
|
||||
|
||||
# Zig / webAssembly impl.
|
||||
zig
|
||||
# zigpkgs."master" # Issue with X11/GL libraries
|
||||
zls
|
||||
emscripten
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
sqlite
|
||||
|
||||
# Linux graphical deps
|
||||
xorg.libX11
|
||||
libGL
|
||||
# xorg.libXcursor
|
||||
# xorg.libXi
|
||||
# xorg.libXext
|
||||
# xorg.libXrandr
|
||||
# xorg.libXinerama
|
||||
# libGLU
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
formatter = pkgs.alejandra;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
10
src/main.zig
10
src/main.zig
|
@ -1,11 +1,5 @@
|
|||
const std = @import("std");
|
||||
const raylib = @cImport({
|
||||
@cInclude("raylib.h");
|
||||
});
|
||||
const raygui = @cImport({
|
||||
@cDefine("RAYGUI_IMPLEMENTATION", "1");
|
||||
@cInclude("raygui.h");
|
||||
});
|
||||
const raylib = @import("raylib.zig");
|
||||
const sqlite = @cImport({
|
||||
@cInclude("sqlite3.h");
|
||||
});
|
||||
|
@ -21,7 +15,7 @@ pub fn main() !void {
|
|||
|
||||
raylib.ClearBackground(raylib.RAYWHITE);
|
||||
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY);
|
||||
if (raygui.GuiButton(.{ .x = 0, .y = 0, .width = 100, .height = 100 }, "MyButton") == 1) {}
|
||||
if (raylib.GuiButton(.{ .x = 0, .y = 0, .width = 100, .height = 100 }, "MyButton") == 1) {}
|
||||
}
|
||||
raylib.CloseWindow();
|
||||
}
|
||||
|
|
5
src/raylib.zig
Normal file
5
src/raylib.zig
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub usingnamespace @cImport({
|
||||
@cInclude("raylib.h");
|
||||
@cDefine("RAYGUI_IMPLEMENTATION", "1");
|
||||
@cInclude("raygui.h");
|
||||
});
|
Loading…
Reference in a new issue