This commit is contained in:
Hannes 2025-12-09 09:39:17 +09:00 committed by GitHub
commit 4af10c43fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 386 additions and 28 deletions

View file

@ -258,6 +258,16 @@ jobs:
git clean -fdx git clean -fdx
git reset --hard HEAD git reset --hard HEAD
nix develop ./src/ -c zig build ${{ matrix.target_flag }} && zig build snapshot ${{ matrix.target_flag }} && zig build test ${{ matrix.target_flag }} nix develop ./src/ -c zig build ${{ matrix.target_flag }} && zig build snapshot ${{ matrix.target_flag }} && zig build test ${{ matrix.target_flag }}
- name: Test Nix package
if: ${{ runner.os == 'Linux' || (runner.os == 'macOS' && runner.arch != 'X64') }}
uses: ./.github/actions/flaky-retry
with:
command: |
nix build ./src#roc
result/bin/roc check src/PROFILING/bench_repeated_check.roc
error_string_contains: TemporaryNameServerFailure
retry_count: 3
zig-cross-compile: zig-cross-compile:
needs: check-once needs: check-once
@ -291,4 +301,4 @@ jobs:
# Test cross-compilation with Roc's cross-compilation system (musl + glibc) # Test cross-compilation with Roc's cross-compilation system (musl + glibc)
roc-cross-compile: roc-cross-compile:
uses: ./.github/workflows/ci_cross_compile.yml uses: ./.github/workflows/ci_cross_compile.yml

View file

@ -4,47 +4,47 @@
.minimum_zig_version = "0.15.2", .minimum_zig_version = "0.15.2",
.dependencies = .{ .dependencies = .{
.afl_kit = .{ .afl_kit = .{
.url = "git+https://github.com/bhansconnect/zig-afl-kit?ref=main#b863c41ca47ed05729e0b509fb1926c111aa2800", .url = "git+https://github.com/kristoff-it/zig-afl-kit.git#b6cb826f21d4026409caec30a932be462bca27b9",
.hash = "afl_kit-0.1.0-NdJ3cncdAAA4154gtkRqNApovBYfOs-LWADNE-9BzzPC", .hash = "afl_kit-0.1.0-NdJ3cncdAADtO8S74G1yMYKO1f2XoHputmaJBInsHLp2",
.lazy = true, .lazy = true,
}, },
.roc_deps_aarch64_macos_none = .{ .roc_deps_aarch64_macos_none = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-macos-none.tar.xz?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-macos-none.tar.xz",
.hash = "N-V-__8AAJuttw4mNdQg3ig107ac4uyAhcFPznGHmpnmX58C", .hash = "N-V-__8AAJuttw4mNdQg3ig107ac4uyAhcFPznGHmpnmX58C",
.lazy = true, .lazy = true,
}, },
.roc_deps_aarch64_linux_musl = .{ .roc_deps_aarch64_linux_musl = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-linux-musl.tar.xz?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-linux-musl.tar.xz",
.hash = "N-V-__8AABnBVRNhZGWHvWKm8PO-N4Js4Zr65NnswmkZ0nYX", .hash = "N-V-__8AABnBVRNhZGWHvWKm8PO-N4Js4Zr65NnswmkZ0nYX",
.lazy = true, .lazy = true,
}, },
.roc_deps_aarch64_windows_gnu = .{ .roc_deps_aarch64_windows_gnu = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-windows-gnu.zip?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-windows-gnu.zip",
.hash = "N-V-__8AAEbXoBTC007kkcMVW2_P5yIKMxPKQ-L5sYEc3_qH", .hash = "N-V-__8AAEbXoBTC007kkcMVW2_P5yIKMxPKQ-L5sYEc3_qH",
.lazy = true, .lazy = true,
}, },
.roc_deps_arm_linux_musleabihf = .{ .roc_deps_arm_linux_musleabihf = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/arm-linux-musleabihf.tar.xz?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/arm-linux-musleabihf.tar.xz",
.hash = "N-V-__8AAE9SyhMGHGnkgRenWYw-birLp2Nl-IYGqIbdlga3", .hash = "N-V-__8AAE9SyhMGHGnkgRenWYw-birLp2Nl-IYGqIbdlga3",
.lazy = true, .lazy = true,
}, },
.roc_deps_x86_linux_musl = .{ .roc_deps_x86_linux_musl = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86-linux-musl.tar.xz?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86-linux-musl.tar.xz",
.hash = "N-V-__8AAGXNmxEQQYT5QBEheV2NJzSQjwaBuUx8wj_tGdoy", .hash = "N-V-__8AAGXNmxEQQYT5QBEheV2NJzSQjwaBuUx8wj_tGdoy",
.lazy = true, .lazy = true,
}, },
.roc_deps_x86_64_linux_musl = .{ .roc_deps_x86_64_linux_musl = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-linux-musl.tar.xz?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-linux-musl.tar.xz",
.hash = "N-V-__8AAL1yjxS0Lef6Fv5mMGaqNa0rGcPJxOftYK0NYuJu", .hash = "N-V-__8AAL1yjxS0Lef6Fv5mMGaqNa0rGcPJxOftYK0NYuJu",
.lazy = true, .lazy = true,
}, },
.roc_deps_x86_64_macos_none = .{ .roc_deps_x86_64_macos_none = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-macos-none.tar.xz?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-macos-none.tar.xz",
.hash = "N-V-__8AAInnSA9gFeMzlB67m7Nu-NYBUOXqDrzYmYgatUHk", .hash = "N-V-__8AAInnSA9gFeMzlB67m7Nu-NYBUOXqDrzYmYgatUHk",
.lazy = true, .lazy = true,
}, },
.roc_deps_x86_64_windows_gnu = .{ .roc_deps_x86_64_windows_gnu = .{
.url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-windows-gnu.zip?response-content-disposition=attachment", .url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-windows-gnu.zip",
.hash = "N-V-__8AANpEpBfszYPGDvz9XJK8VRBNG7eQzzK1iNSlkdVG", .hash = "N-V-__8AANpEpBfszYPGDvz9XJK8VRBNG7eQzzK1iNSlkdVG",
.lazy = true, .lazy = true,
}, },
@ -54,7 +54,7 @@
}, },
.zstd = .{ .zstd = .{
.url = "git+https://github.com/allyourcodebase/zstd.git#01327d49cbc56dc24c20a167bb0055d7fc23de84", // 1.5.7 .url = "git+https://github.com/allyourcodebase/zstd.git#01327d49cbc56dc24c20a167bb0055d7fc23de84", // 1.5.7
.hash = "1220b9feb4652a62df95843e78a5db008401599366989b52d7cab421bf6263fa73d0", .hash = "zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0",
}, },
}, },
.fingerprint = 0x9eea22a6c3bd0034, .fingerprint = 0x9eea22a6c3bd0034,

217
build.zig.zon.nix Normal file
View file

@ -0,0 +1,217 @@
# generated by zon2nix (https://github.com/Cloudef/zig2nix)
{
lib,
linkFarm,
fetchurl,
fetchgit,
runCommandLocal,
zig,
name ? "zig-packages",
}:
with builtins;
with lib;
let
unpackZigArtifact =
{ name, artifact }:
runCommandLocal name { nativeBuildInputs = [ zig ]; } ''
hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})"
mv "$TMPDIR/p/$hash" "$out"
chmod 755 "$out"
'';
fetchZig =
{
name,
url,
hash,
}:
let
artifact = fetchurl { inherit url hash; };
in
unpackZigArtifact { inherit name artifact; };
fetchGitZig =
{
name,
url,
hash,
rev ? throw "rev is required, remove and regenerate the zon2json-lock file",
}:
let
parts = splitString "#" url;
url_base = elemAt parts 0;
url_without_query = elemAt (splitString "?" url_base) 0;
in
fetchgit {
inherit name rev hash;
url = url_without_query;
deepClone = false;
};
fetchZigArtifact =
{
name,
url,
hash,
...
}@args:
let
parts = splitString "://" url;
proto = elemAt parts 0;
path = elemAt parts 1;
fetcher = {
"git+http" = fetchGitZig (
args
// {
url = "http://${path}";
}
);
"git+https" = fetchGitZig (
args
// {
url = "https://${path}";
}
);
http = fetchZig {
inherit name hash;
url = "http://${path}";
};
https = fetchZig {
inherit name hash;
url = "https://${path}";
};
};
in
fetcher.${proto};
in
linkFarm name [
{
name = "afl_kit-0.1.0-NdJ3cncdAADtO8S74G1yMYKO1f2XoHputmaJBInsHLp2";
path = fetchZigArtifact {
name = "afl_kit";
url = "git+https://github.com/kristoff-it/zig-afl-kit.git#b6cb826f21d4026409caec30a932be462bca27b9";
hash = "sha256-b3aBfO1aiM9MV6Pqdy0A8xbRy/X9zEJCztXMe18k2rA=";
rev = "b6cb826f21d4026409caec30a932be462bca27b9";
};
}
{
name = "AFLplusplus-4.21.0-aA1y4dZxAAAhqDy_JoRw3zwNSg8MenEGP7uJI_xNcYuV";
path = fetchZigArtifact {
name = "AFLplusplus";
url = "git+https://github.com/allyourcodebase/AFLplusplus#7e65eb4262688a120bf830d145060aac0e5db920";
hash = "sha256-f5Egmkg2tEOV5jfcNj9KTU0IWOAC/hGdypmC+IG88Q0=";
rev = "7e65eb4262688a120bf830d145060aac0e5db920";
};
}
{
name = "N-V-__8AAKE4uAAJZgEcPdaXnWqoj-IwYf3G2h9YSm-x92gg";
path = fetchZigArtifact {
name = "AFLplusplus";
url = "https://github.com/AFLplusplus/AFLplusplus/archive/v4.21c.tar.gz";
hash = "sha256-EffHfTfP9uf2WsfMVbq3kB4MYgjoRaOHZDlNBO1WezA=";
};
}
{
name = "N-V-__8AAJuttw4mNdQg3ig107ac4uyAhcFPznGHmpnmX58C";
path = fetchZigArtifact {
name = "roc_deps_aarch64_macos_none";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-macos-none.tar.xz";
hash = "sha256-V5vrynGlea56TSLjNpkVpQFJID+d/U/yMaflwNSQaQU=";
};
}
{
name = "N-V-__8AABnBVRNhZGWHvWKm8PO-N4Js4Zr65NnswmkZ0nYX";
path = fetchZigArtifact {
name = "roc_deps_aarch64_linux_musl";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-linux-musl.tar.xz";
hash = "sha256-CXGVG1A7V/xhpu1Kgv6RtF7EH0xKXlVXWVLOfx8DptA=";
};
}
{
name = "N-V-__8AAEbXoBTC007kkcMVW2_P5yIKMxPKQ-L5sYEc3_qH";
path = fetchZigArtifact {
name = "roc_deps_aarch64_windows_gnu";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-windows-gnu.zip";
hash = "sha256-LbVIeMh8gguUczU7nDqOhmkPlSXIYU5kH6EhcssjpWY=";
};
}
{
name = "N-V-__8AAE9SyhMGHGnkgRenWYw-birLp2Nl-IYGqIbdlga3";
path = fetchZigArtifact {
name = "roc_deps_arm_linux_musleabihf";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/arm-linux-musleabihf.tar.xz";
hash = "sha256-0fw/KOpzj7OSgFrysfRGv4WlU/JvaaC3xXu6V+LyEs8=";
};
}
{
name = "N-V-__8AAGXNmxEQQYT5QBEheV2NJzSQjwaBuUx8wj_tGdoy";
path = fetchZigArtifact {
name = "roc_deps_x86_linux_musl";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86-linux-musl.tar.xz";
hash = "sha256-LyYtnADq9CmmzRH+qu3WPRHPj2LjY3zszlyCB+CiRAo=";
};
}
{
name = "N-V-__8AAL1yjxS0Lef6Fv5mMGaqNa0rGcPJxOftYK0NYuJu";
path = fetchZigArtifact {
name = "roc_deps_x86_64_linux_musl";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-linux-musl.tar.xz";
hash = "sha256-zmrzXp9790M4NfjFuBU+TZ7jWjJdN+Z1vRs9aKwkmJM=";
};
}
{
name = "N-V-__8AAInnSA9gFeMzlB67m7Nu-NYBUOXqDrzYmYgatUHk";
path = fetchZigArtifact {
name = "roc_deps_x86_64_macos_none";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-macos-none.tar.xz";
hash = "sha256-w3vpIPXWlmIRztbXPGXiemrwYF9jjFIaFxpZaLOZ9KI=";
};
}
{
name = "N-V-__8AANpEpBfszYPGDvz9XJK8VRBNG7eQzzK1iNSlkdVG";
path = fetchZigArtifact {
name = "roc_deps_x86_64_windows_gnu";
url = "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-windows-gnu.zip";
hash = "sha256-tckuUDxjoeAUWC5RiHW1IVKG3H67R1D0cONk93VbkLs=";
};
}
{
name = "bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi";
path = fetchZigArtifact {
name = "bytebox";
url = "git+https://github.com/rdunnington/bytebox#5c8753ba11c394e4d642dddbb459edcd7c97ac26";
hash = "sha256-UMXzrH5OPqQmt5B2hlMkKzSa1gjI2EreDRK9Son+ZvM=";
rev = "5c8753ba11c394e4d642dddbb459edcd7c97ac26";
};
}
{
name = "stable_array-0.1.0-3ihgvVxbAACET5MoiUn2T5ENunG_da_X3kGbji-f4QTF";
path = fetchZigArtifact {
name = "zig-stable-array";
url = "git+https://github.com/rdunnington/zig-stable-array#9e4f089bd3abf127eafd307ecf9796455871becc";
hash = "sha256-NpxyNyOoFAeyREn3SvEnI/tyaYgM1ZjlcK+0jG2N0Lk=";
rev = "9e4f089bd3abf127eafd307ecf9796455871becc";
};
}
{
name = "zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0";
path = fetchZigArtifact {
name = "zstd";
url = "git+https://github.com/allyourcodebase/zstd.git#01327d49cbc56dc24c20a167bb0055d7fc23de84";
hash = "sha256-1w+hR2U9t6R4sNvUMynDsYO0sNAan2svjxjUvxT+x6A=";
rev = "01327d49cbc56dc24c20a167bb0055d7fc23de84";
};
}
{
name = "N-V-__8AAGxifwAAGwXwvsnl_aOXFGLZTeYCu0WBhuEXr96u";
path = fetchZigArtifact {
name = "zstd";
url = "git+https://github.com/facebook/zstd.git?ref=v1.5.7#f8745da6ff1ad1e7bab384bd1f9d742439278e99";
hash = "sha256-tNFWIT9ydfozB8dWcmTMuZLCQmQudTFJIkSr0aG7S44=";
rev = "f8745da6ff1ad1e7bab384bd1f9d742439278e99";
};
}
]

83
build.zig.zon2json-lock Normal file
View file

@ -0,0 +1,83 @@
{
"afl_kit-0.1.0-NdJ3cncdAADtO8S74G1yMYKO1f2XoHputmaJBInsHLp2": {
"name": "afl_kit",
"url": "git+https://github.com/kristoff-it/zig-afl-kit.git#b6cb826f21d4026409caec30a932be462bca27b9",
"hash": "sha256-b3aBfO1aiM9MV6Pqdy0A8xbRy/X9zEJCztXMe18k2rA=",
"rev": "b6cb826f21d4026409caec30a932be462bca27b9"
},
"AFLplusplus-4.21.0-aA1y4dZxAAAhqDy_JoRw3zwNSg8MenEGP7uJI_xNcYuV": {
"name": "AFLplusplus",
"url": "git+https://github.com/allyourcodebase/AFLplusplus#7e65eb4262688a120bf830d145060aac0e5db920",
"hash": "sha256-f5Egmkg2tEOV5jfcNj9KTU0IWOAC/hGdypmC+IG88Q0=",
"rev": "7e65eb4262688a120bf830d145060aac0e5db920"
},
"N-V-__8AAKE4uAAJZgEcPdaXnWqoj-IwYf3G2h9YSm-x92gg": {
"name": "AFLplusplus",
"url": "https://github.com/AFLplusplus/AFLplusplus/archive/v4.21c.tar.gz",
"hash": "sha256-EffHfTfP9uf2WsfMVbq3kB4MYgjoRaOHZDlNBO1WezA="
},
"N-V-__8AAJuttw4mNdQg3ig107ac4uyAhcFPznGHmpnmX58C": {
"name": "roc_deps_aarch64_macos_none",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-macos-none.tar.xz",
"hash": "sha256-V5vrynGlea56TSLjNpkVpQFJID+d/U/yMaflwNSQaQU="
},
"N-V-__8AABnBVRNhZGWHvWKm8PO-N4Js4Zr65NnswmkZ0nYX": {
"name": "roc_deps_aarch64_linux_musl",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-linux-musl.tar.xz",
"hash": "sha256-CXGVG1A7V/xhpu1Kgv6RtF7EH0xKXlVXWVLOfx8DptA="
},
"N-V-__8AAEbXoBTC007kkcMVW2_P5yIKMxPKQ-L5sYEc3_qH": {
"name": "roc_deps_aarch64_windows_gnu",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/aarch64-windows-gnu.zip",
"hash": "sha256-LbVIeMh8gguUczU7nDqOhmkPlSXIYU5kH6EhcssjpWY="
},
"N-V-__8AAE9SyhMGHGnkgRenWYw-birLp2Nl-IYGqIbdlga3": {
"name": "roc_deps_arm_linux_musleabihf",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/arm-linux-musleabihf.tar.xz",
"hash": "sha256-0fw/KOpzj7OSgFrysfRGv4WlU/JvaaC3xXu6V+LyEs8="
},
"N-V-__8AAGXNmxEQQYT5QBEheV2NJzSQjwaBuUx8wj_tGdoy": {
"name": "roc_deps_x86_linux_musl",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86-linux-musl.tar.xz",
"hash": "sha256-LyYtnADq9CmmzRH+qu3WPRHPj2LjY3zszlyCB+CiRAo="
},
"N-V-__8AAL1yjxS0Lef6Fv5mMGaqNa0rGcPJxOftYK0NYuJu": {
"name": "roc_deps_x86_64_linux_musl",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-linux-musl.tar.xz",
"hash": "sha256-zmrzXp9790M4NfjFuBU+TZ7jWjJdN+Z1vRs9aKwkmJM="
},
"N-V-__8AAInnSA9gFeMzlB67m7Nu-NYBUOXqDrzYmYgatUHk": {
"name": "roc_deps_x86_64_macos_none",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-macos-none.tar.xz",
"hash": "sha256-w3vpIPXWlmIRztbXPGXiemrwYF9jjFIaFxpZaLOZ9KI="
},
"N-V-__8AANpEpBfszYPGDvz9XJK8VRBNG7eQzzK1iNSlkdVG": {
"name": "roc_deps_x86_64_windows_gnu",
"url": "https://github.com/roc-lang/roc-bootstrap/releases/download/zig-0.15.1/x86_64-windows-gnu.zip",
"hash": "sha256-tckuUDxjoeAUWC5RiHW1IVKG3H67R1D0cONk93VbkLs="
},
"bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi": {
"name": "bytebox",
"url": "git+https://github.com/rdunnington/bytebox#5c8753ba11c394e4d642dddbb459edcd7c97ac26",
"hash": "sha256-UMXzrH5OPqQmt5B2hlMkKzSa1gjI2EreDRK9Son+ZvM=",
"rev": "5c8753ba11c394e4d642dddbb459edcd7c97ac26"
},
"stable_array-0.1.0-3ihgvVxbAACET5MoiUn2T5ENunG_da_X3kGbji-f4QTF": {
"name": "zig-stable-array",
"url": "git+https://github.com/rdunnington/zig-stable-array#9e4f089bd3abf127eafd307ecf9796455871becc",
"hash": "sha256-NpxyNyOoFAeyREn3SvEnI/tyaYgM1ZjlcK+0jG2N0Lk=",
"rev": "9e4f089bd3abf127eafd307ecf9796455871becc"
},
"zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0": {
"name": "zstd",
"url": "git+https://github.com/allyourcodebase/zstd.git#01327d49cbc56dc24c20a167bb0055d7fc23de84",
"hash": "sha256-1w+hR2U9t6R4sNvUMynDsYO0sNAan2svjxjUvxT+x6A=",
"rev": "01327d49cbc56dc24c20a167bb0055d7fc23de84"
},
"N-V-__8AAGxifwAAGwXwvsnl_aOXFGLZTeYCu0WBhuEXr96u": {
"name": "zstd",
"url": "git+https://github.com/facebook/zstd.git?ref=v1.5.7#f8745da6ff1ad1e7bab384bd1f9d742439278e99",
"hash": "sha256-tNFWIT9ydfozB8dWcmTMuZLCQmQudTFJIkSr0aG7S44=",
"rev": "f8745da6ff1ad1e7bab384bd1f9d742439278e99"
}
}

View file

@ -1,4 +1,3 @@
# Use this flake with `nix develop ./src` # Use this flake with `nix develop ./src`
{ {
@ -11,20 +10,28 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils, ... }@inputs: outputs =
{
self,
nixpkgs,
flake-utils,
...
}@inputs:
let let
supportedSystems = supportedSystems = [
[ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ]; "x86_64-linux"
in flake-utils.lib.eachSystem supportedSystems (system: "x86_64-darwin"
"aarch64-darwin"
"aarch64-linux"
];
in
flake-utils.lib.eachSystem supportedSystems (
system:
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
zig = pkgs.zig_0_15;
dependencies = (with pkgs; [
zig
zls
git # for use in ci/zig_lints.sh
]);
shellFunctions = '' shellFunctions = ''
buildcmd() { buildcmd() {
zig build roc zig build roc
@ -47,24 +54,65 @@
export -f cicmd export -f cicmd
''; '';
in { in
{
packages = {
default = self.packages.${system}.roc;
roc = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "roc";
version = "0.0.0";
src = pkgs.lib.cleanSource ./..;
deps = pkgs.callPackage ../build.zig.zon.nix {};
nativeBuildInputs = [ zig.hook pkgs.pkg-config ];
buildInputs = [ ];
dontConfigure = true;
zigBuildFlags = [
"--system"
"${finalAttrs.deps}"
];
meta.mainProgram = "roc";
});
};
apps = {
default = self.apps.${system}.roc;
roc = {
type = "app";
program = pkgs.lib.getExe self.packages.${system}.roc;
meta = {
description = "Roc CLI";
mainProgram = "roc";
};
};
};
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
buildInputs = dependencies; buildInputs = [
zig
pkgs.zls
pkgs.git # for use in ci/zig_lints.sh
(pkgs.writeShellScriptBin "zon2lock" "nix run github:Cloudef/zig2nix -- zon2lock build.zig.zon")
(pkgs.writeShellScriptBin "zon2nix" "nix run github:Cloudef/zig2nix -- zon2nix build.zig.zon2json-lock")
];
shellHook = '' shellHook = ''
${shellFunctions} ${shellFunctions}
echo "Some convenient commands:" echo "Some convenient commands:"
echo "${shellFunctions}" | grep -E '^\s*[a-zA-Z_][a-zA-Z0-9_]*\(\)' | sed 's/().*//' | sed 's/^[[:space:]]*/ /' | while read func; do echo "${shellFunctions}" | grep -E '^\s*[a-zA-Z_][a-zA-Z0-9_]*\(\)' | sed 's/().*//' | sed 's/^[[:space:]]*/ /' | while read func; do
body=$(echo "${shellFunctions}" | sed -n "/''${func}()/,/^[[:space:]]*}/p" | sed '1d;$d' | tr '\n' ';' | sed 's/;$//' | sed 's/[[:space:]]*$//') body=$(echo "${shellFunctions}" | sed -n "/''${func}()/,/^[[:space:]]*}/p" | sed '1d;$d' | tr '\n' ';' | sed 's/;$//' | sed 's/[[:space:]]*$//')
echo " $func = $body" echo " $func = $body"
done done
echo " zon2lock = nix run github:Cloudef/zig2nix -- zon2lock build.zig.zon"
echo " zon2nix = nix run github:Cloudef/zig2nix -- zon2nix build.zig.zon2json-lock"
echo "" echo ""
unset NIX_CFLAGS_COMPILE unset NIX_CFLAGS_COMPILE
unset NIX_LDFLAGS unset NIX_LDFLAGS
''; # unset to fix: Unrecognized C flag from NIX_CFLAGS_COMPILE: -fmacro-prefix-map ''; # unset to fix: Unrecognized C flag from NIX_CFLAGS_COMPILE: -fmacro-prefix-map
}; };
}); formatter = pkgs.nixfmt-rfc-style;
}
);
} }