-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds nix flake, adds tooling for creating a deployment of microzig, v…
…endors some code from ezpkg
- Loading branch information
Felix "xq" Queißner
committed
Jan 4, 2024
1 parent
597034b
commit 0c4e82e
Showing
10 changed files
with
1,283 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
zig-out/ | ||
zig-cache/ | ||
microzig-deploy/ | ||
.DS_Store | ||
.gdbinit | ||
.lldbinit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# MicroZig | ||
|
||
## Overview | ||
|
||
- `core/` contains the shared components of MicroZig. | ||
- `board-support/` contains all official board support package. | ||
- `examples/` contains examples that can be used with the board support packages. | ||
- `tools/` contains tooling to work *on* MicroZig. | ||
|
||
## Versioning Scheme | ||
|
||
MicroZig versions are tightly locked with Zig versions. | ||
|
||
The general scheme is `${zig_version}-${commit}-${count}`, so the MicroZig versions will look really similar to | ||
Zigs versions, but with our own commit abbreviations and counters. | ||
|
||
As MicroZig sticks to tagged Zig releases, `${zig_version}` will show to which Zig version the MicroZig build is compatible. | ||
|
||
Consider the version `0.11.0-abcdef-123` means that this MicroZig version has a commit starting with `abcdef`, which was the 123rd commit of the version that is compatible with Zig 0.11.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.Build) void { | ||
buildTools(b); | ||
} | ||
|
||
fn buildTools(b: *std.Build) void { | ||
const tools_step = b.step("tools", "Only build the development tools"); | ||
b.getInstallStep().dependOn(tools_step); | ||
|
||
const archive_info = b.addExecutable(.{ | ||
.name = "archive-info", | ||
.optimize = .ReleaseSafe, | ||
.root_source_file = .{ .path = "tools/archive-info.zig" }, | ||
}); | ||
|
||
tools_step.dependOn(&b.addInstallArtifact(archive_info, .{ | ||
.dest_dir = .{ .override = .{ .custom = "tools" } }, | ||
}).step); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
description = "microzig development environment"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
# required for latest zig | ||
zig.url = "github:mitchellh/zig-overlay"; | ||
|
||
# Used for shell.nix | ||
flake-compat = { | ||
url = github:edolstra/flake-compat; | ||
flake = false; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
flake-utils, | ||
... | ||
} @ inputs: let | ||
overlays = [ | ||
# Other overlays | ||
(final: prev: { | ||
zigpkgs = inputs.zig.packages.${prev.system}; | ||
}) | ||
]; | ||
|
||
# Our supported systems are the same supported systems as the Zig binaries | ||
systems = builtins.attrNames inputs.zig.packages; | ||
in | ||
flake-utils.lib.eachSystem systems ( | ||
system: let | ||
pkgs = import nixpkgs {inherit overlays system;}; | ||
in rec { | ||
devShells.default = pkgs.mkShell { | ||
nativeBuildInputs = [ | ||
pkgs.zigpkgs."0.11.0" | ||
]; | ||
|
||
buildInputs = [ | ||
# we need a version of bash capable of being interactive | ||
# as opposed to a bash just used for building this flake | ||
# in non-interactive mode | ||
pkgs.bashInteractive | ||
pkgs.zlib | ||
]; | ||
|
||
shellHook = '' | ||
# once we set SHELL to point to the interactive bash, neovim will | ||
# launch the correct $SHELL in its :terminal | ||
export SHELL=${pkgs.bashInteractive}/bin/bash | ||
''; | ||
}; | ||
|
||
# For compatibility with older versions of the `nix` binary | ||
devShell = self.devShells.${system}.default; | ||
} | ||
); | ||
} |
Oops, something went wrong.