A cross-platform simulator for the GreenArrays GA144 multi-computer chip.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add initial empty Zig project

Project generated with `zig init` with root.zig deleted and references
to static library in build.zig removed as this project is intended to
build an executable at this point.

+122 -22
+5
.gitignore
··· 1 1 # Nix 2 2 .direnv 3 + result 4 + 5 + # Zig 6 + zig-out/ 7 + .zig-cache/
+40
build.zig
··· 1 + const std = @import("std"); 2 + 3 + pub fn build(b: *std.Build) void { 4 + const target = b.standardTargetOptions(.{}); 5 + 6 + const optimize = b.standardOptimizeOption(.{}); 7 + 8 + const exe_mod = b.createModule(.{ 9 + .root_source_file = b.path("src/main.zig"), 10 + .target = target, 11 + .optimize = optimize, 12 + }); 13 + 14 + const exe = b.addExecutable(.{ 15 + .name = "gasim", 16 + .root_module = exe_mod, 17 + }); 18 + 19 + b.installArtifact(exe); 20 + 21 + const run_cmd = b.addRunArtifact(exe); 22 + 23 + run_cmd.step.dependOn(b.getInstallStep()); 24 + 25 + if (b.args) |args| { 26 + run_cmd.addArgs(args); 27 + } 28 + 29 + const run_step = b.step("run", "Run gasim"); 30 + run_step.dependOn(&run_cmd.step); 31 + 32 + const exe_unit_tests = b.addTest(.{ 33 + .root_module = exe_mod, 34 + }); 35 + 36 + const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); 37 + 38 + const test_step = b.step("test", "Run unit tests"); 39 + test_step.dependOn(&run_exe_unit_tests.step); 40 + }
+18
build.zig.zon
··· 1 + .{ 2 + .name = .gasim, 3 + 4 + .version = "0.1.0", 5 + 6 + .fingerprint = 0xbf21d72499244c75, // Changing this has security and trust implications. 7 + 8 + .minimum_zig_version = "0.14.0", 9 + 10 + .dependencies = .{}, 11 + 12 + .paths = .{ 13 + "build.zig", 14 + "build.zig.zon", 15 + "src", 16 + "LICENSE", 17 + }, 18 + }
+25 -18
flake.lock
··· 71 71 "gitignore": { 72 72 "inputs": { 73 73 "nixpkgs": [ 74 + "nixpkgs" 75 + ] 76 + }, 77 + "locked": { 78 + "lastModified": 1709087332, 79 + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", 80 + "owner": "hercules-ci", 81 + "repo": "gitignore.nix", 82 + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", 83 + "type": "github" 84 + }, 85 + "original": { 86 + "owner": "hercules-ci", 87 + "repo": "gitignore.nix", 88 + "type": "github" 89 + } 90 + }, 91 + "gitignore_2": { 92 + "inputs": { 93 + "nixpkgs": [ 74 94 "zls-pkg", 75 95 "nixpkgs" 76 96 ] ··· 105 125 "type": "github" 106 126 } 107 127 }, 108 - "nixpkgs_2": { 109 - "locked": { 110 - "lastModified": 1741196730, 111 - "narHash": "sha256-0Sj6ZKjCpQMfWnN0NURqRCQn2ob7YtXTAOTwCuz7fkA=", 112 - "owner": "NixOS", 113 - "repo": "nixpkgs", 114 - "rev": "48913d8f9127ea6530a2a2f1bd4daa1b8685d8a3", 115 - "type": "github" 116 - }, 117 - "original": { 118 - "owner": "NixOS", 119 - "ref": "nixos-24.11", 120 - "repo": "nixpkgs", 121 - "type": "github" 122 - } 123 - }, 124 128 "root": { 125 129 "inputs": { 130 + "gitignore": "gitignore", 126 131 "nixpkgs": "nixpkgs", 127 132 "zig-overlay": "zig-overlay", 128 133 "zls-pkg": "zls-pkg" ··· 205 210 }, 206 211 "zls-pkg": { 207 212 "inputs": { 208 - "gitignore": "gitignore", 209 - "nixpkgs": "nixpkgs_2", 213 + "gitignore": "gitignore_2", 214 + "nixpkgs": [ 215 + "nixpkgs" 216 + ], 210 217 "zig-overlay": "zig-overlay_2" 211 218 }, 212 219 "locked": {
+31 -4
flake.nix
··· 7 7 # system glibc that the user is building for. 8 8 nixpkgs.url = "github:nixos/nixpkgs/release-24.11"; 9 9 10 - zig-overlay = { 11 - url = "github:mitchellh/zig-overlay"; 12 - inputs.nixpkgs.follows = "nixpkgs"; 13 - }; 10 + zig-overlay.url = "github:mitchellh/zig-overlay"; 11 + zig-overlay.inputs.nixpkgs.follows = "nixpkgs"; 14 12 15 13 zls-pkg.url = "github:zigtools/zls?ref=0.14.0"; 14 + zls-pkg.inputs.nixpkgs.follows = "nixpkgs"; 15 + 16 + gitignore.url = "github:hercules-ci/gitignore.nix"; 17 + gitignore.inputs.nixpkgs.follows = "nixpkgs"; 16 18 }; 17 19 18 20 outputs = { 19 21 nixpkgs, 20 22 zig-overlay, 21 23 zls-pkg, 24 + gitignore, 22 25 ... 23 26 }: 24 27 builtins.foldl' nixpkgs.lib.recursiveUpdate {} ( ··· 27 30 pkgs = nixpkgs.legacyPackages.${system}; 28 31 zig = zig-overlay.packages.${system}."0.14.0"; 29 32 zls = zls-pkg.packages.${system}.default; 33 + gitignoreSource = gitignore.lib.gitignoreSource; 34 + target = builtins.replaceStrings ["darwin"] ["macos"] system; 35 + 30 36 in { 31 37 devShells.${system}.default = pkgs.mkShell { 32 38 nativeBuildInputs = [ ··· 36 42 }; 37 43 38 44 formatter.${system} = pkgs.alejandra; 45 + 46 + packages.${system} = rec { 47 + default = gasim; 48 + gasim = pkgs.stdenvNoCC.mkDerivation { 49 + name = "gasim"; 50 + version = "0.1.0"; 51 + meta.mainProgram = "gasim"; 52 + src = gitignoreSource ./.; 53 + nativeBuildInputs = [zig]; 54 + dontConfigure = true; 55 + dontInstall = true; 56 + doCheck = true; 57 + buildPhase = '' 58 + NO_COLOR=1 # prevent escape codes from messing up the `nix log` 59 + zig build install --global-cache-dir $(pwd)/.cache -Dtarget=${target} -Doptimize=ReleaseSafe --prefix $out 60 + ''; 61 + checkPhase = '' 62 + zig build test --global-cache-dir $(pwd)/.cache -Dtarget=${target} 63 + ''; 64 + }; 65 + }; 39 66 } 40 67 # Our supported systems are the same supported systems as the Zig binaries. 41 68 ) (builtins.attrNames zig-overlay.packages)
+3
src/main.zig
··· 1 + //! gasim 2 + 3 + pub fn main() !void {}