Skip to content

Conversation

savil
Copy link
Collaborator

@savil savil commented Sep 16, 2022

Summary

Adds basic support for shell and build.

Build Size optimization:

  • If I include the zig nix package in the runtimePackages, then the image size
    is really large (700MB)
  • But I believe the zig executable is standalone Executable is very big in Linux ziglang/zig#3660 (comment)
  • So, I get the zig-executable's name by:
    • parsing the build.zig file (so unfortunate) to find the addExecutable line
    • fallback: if I fail to find exactly one addExecutable, then I fallback to installing the zig nix package and invoking zig build run
  • the image size is 22MB

How was it tested?

shell:
in the testcase folder:

> devbox shell

(devbox)> zig build run
# see output
info: All your codebase are belong to us.

Don't be alarmed! Just a printout.

build:

> devbox build
> docker run devbox
info: All your codebase are belong to us.

Copy link
Collaborator Author

savil commented Sep 16, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@savil savil marked this pull request as draft September 16, 2022 22:37
@savil savil requested a review from gcurtis September 16, 2022 22:43
@savil savil marked this pull request as ready for review September 16, 2022 22:45
const std = @import("std");

pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this message. It's a bit grim 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its the default zig hello world - I think their sense of humour is very Adams Family-esque, which I love :)

But yeah, I'll edit it to be less alarming.

DevPackages: []string{"zig"},
RuntimePackages: runtimePkgs,
BuildStage: &plansdk.Stage{
InputFiles: []string{"."},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use plansdk.AllFiles() if you want

@savil savil merged commit bbe3c2b into main Sep 21, 2022
@savil savil deleted the savil/ziglang branch September 21, 2022 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants