mirror of
https://github.com/mitchellh/zig-overlay.git
synced 2025-02-05 17:02:48 +02:00
template for zig compiler dev
This commit is contained in:
parent
157234d3d8
commit
66817dde5b
5 changed files with 118 additions and 0 deletions
|
@ -41,5 +41,11 @@
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
zigpkgs = outputs.packages.${prev.system};
|
zigpkgs = outputs.packages.${prev.system};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Templates for use with zig flake init
|
||||||
|
templates.compiler-dev = {
|
||||||
|
path = ./templates/compiler-dev;
|
||||||
|
description = "A development environment for Zig compiler development.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
4
templates/compiler-dev/.envrc
Normal file
4
templates/compiler-dev/.envrc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# use nix shell if nix is available
|
||||||
|
if has nix; then
|
||||||
|
use nix
|
||||||
|
fi
|
60
templates/compiler-dev/flake.lock
generated
Normal file
60
templates/compiler-dev/flake.lock
generated
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1650374568,
|
||||||
|
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659877975,
|
||||||
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1661239106,
|
||||||
|
"narHash": "sha256-C5OCLnrv2c4CHs9DMEtYKkjJmGL7ySAZ1PqPkHBonxQ=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "963d27a0767422be9b8686a8493dcade6acee992",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
39
templates/compiler-dev/flake.nix
Normal file
39
templates/compiler-dev/flake.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
description = "Zig compiler development.";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
# Used for shell.nix
|
||||||
|
flake-compat = { url = github:edolstra/flake-compat; flake = false; };
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let pkgs = import nixpkgs { inherit system; };
|
||||||
|
in {
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
gdb
|
||||||
|
libxml2
|
||||||
|
ninja
|
||||||
|
qemu
|
||||||
|
wasmtime
|
||||||
|
zlib
|
||||||
|
] ++ (with llvmPackages_14; [
|
||||||
|
clang
|
||||||
|
clang-unwrapped
|
||||||
|
lld
|
||||||
|
llvm
|
||||||
|
]);
|
||||||
|
|
||||||
|
hardeningDisable = [ "all" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# For compatibility with older versions of the `nix` binary
|
||||||
|
devShell = self.devShells.${system}.default;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
9
templates/compiler-dev/shell.nix
Normal file
9
templates/compiler-dev/shell.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
(import
|
||||||
|
(
|
||||||
|
let flake-compat = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.flake-compat; in
|
||||||
|
fetchTarball {
|
||||||
|
url = "https://github.com/edolstra/flake-compat/archive/${flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{ src = ./.; }).shellNix
|
Loading…
Add table
Reference in a new issue