Compare commits
2 commits
3f596a6dc9
...
c51423874b
Author | SHA1 | Date | |
---|---|---|---|
|
c51423874b | ||
|
3216292d08 |
98
flake.lock
98
flake.lock
|
@ -16,25 +16,25 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694529238,
|
"lastModified": 1696343447,
|
||||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
"narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=",
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
"rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1659877975,
|
"lastModified": 1659877975,
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
|
@ -51,16 +51,52 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696725822,
|
"lastModified": 1696983906,
|
||||||
"narHash": "sha256-B7uAOS7TkLlOg1aX01rQlYbydcyB6ZnLJSfaYbKVww8=",
|
"narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=",
|
||||||
"owner": "NixOS",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5aabb5780a11c500981993d49ee93cfa6df9307b",
|
"rev": "bd1cde45c77891214131cbbea5b1203e485a9d51",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "nixos",
|
||||||
"type": "indirect"
|
"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": {
|
"nixpkgs_2": {
|
||||||
|
@ -81,38 +117,24 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-parts": "flake-parts",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"zig": "zig"
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
"zig-overlay": "zig-overlay"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"zig-overlay": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"zig": {
|
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696810944,
|
"lastModified": 1697198920,
|
||||||
"narHash": "sha256-yvt223HLZlAJa/u4uzT5aw3ph2bifto/KfU2k+eX+jg=",
|
"narHash": "sha256-dtaoksNoOMC3H+FDF3cK+bP+jYvJokYBAFvzCALLDYk=",
|
||||||
"owner": "mitchellh",
|
"owner": "mitchellh",
|
||||||
"repo": "zig-overlay",
|
"repo": "zig-overlay",
|
||||||
"rev": "6dc03885321cc8aad6356c847148eb40e167f9fb",
|
"rev": "2d779a7657e346323ab048b218994dbdc42655d7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
72
flake.nix
72
flake.nix
|
@ -1,47 +1,59 @@
|
||||||
{
|
{
|
||||||
description = "FabApp";
|
description = "FabApp";
|
||||||
|
|
||||||
# Inspired by https://github.com/mitchellh/zig-objc/blob/main/flake.nix
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# take unstable if not specified
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
# nixpkgs.url = "github:nixos/nixpkgs/release-23.05";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
# nixpkgs.url = "github:NixOS/nixpkgs/unstable";
|
zig-overlay.url = "github:mitchellh/zig-overlay";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
zig.url = "github:mitchellh/zig-overlay";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = inputs@{ flake-parts, nixpkgs, ... }:
|
||||||
self,
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
nixpkgs,
|
flake = {
|
||||||
flake-utils,
|
# Put your original flake attributes here.
|
||||||
...
|
};
|
||||||
} @ inputs: let
|
|
||||||
|
systems = [ "x86_64-linux" ];
|
||||||
|
|
||||||
|
# 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 = [
|
overlays = [
|
||||||
(final: prev: {
|
inputs.zig-overlay.overlays.default
|
||||||
zigpkgs = inputs.zig.packages.${prev.system};
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
systems = ["x86_64-linux"];
|
config = { };
|
||||||
in
|
};
|
||||||
flake-utils.lib.eachSystem systems (
|
|
||||||
system: let
|
formatter = pkgs.nixfmt;
|
||||||
pkgs = import nixpkgs {inherit overlays system;};
|
|
||||||
in rec {
|
devShells.default = with pkgs;
|
||||||
devShells.default = pkgs.mkShell {
|
mkShell {
|
||||||
nativeBuildInputs = with pkgs; [
|
buildInputs = [
|
||||||
zigpkgs.master
|
sqlite
|
||||||
|
|
||||||
|
# Zig / webAssembly impl.
|
||||||
|
zig
|
||||||
|
# zigpkgs."master" # Issue with X11/GL libraries
|
||||||
zls
|
zls
|
||||||
emscripten
|
emscripten
|
||||||
];
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
sqlite
|
|
||||||
|
|
||||||
# Linux graphical deps
|
# Linux graphical deps
|
||||||
xorg.libX11
|
xorg.libX11
|
||||||
libGL
|
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 std = @import("std");
|
||||||
const raylib = @cImport({
|
const raylib = @import("raylib.zig");
|
||||||
@cInclude("raylib.h");
|
|
||||||
});
|
|
||||||
const raygui = @cImport({
|
|
||||||
@cDefine("RAYGUI_IMPLEMENTATION", "1");
|
|
||||||
@cInclude("raygui.h");
|
|
||||||
});
|
|
||||||
const sqlite = @cImport({
|
const sqlite = @cImport({
|
||||||
@cInclude("sqlite3.h");
|
@cInclude("sqlite3.h");
|
||||||
});
|
});
|
||||||
|
@ -21,7 +15,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
raylib.ClearBackground(raylib.RAYWHITE);
|
raylib.ClearBackground(raylib.RAYWHITE);
|
||||||
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY);
|
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();
|
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