summaryrefslogtreecommitdiff
path: root/common/templates/zig
diff options
context:
space:
mode:
authorbrustybee <bee@4d2.org>2026-03-19 23:43:21 +0530
committerbrustybee <bee@4d2.org>2026-03-19 23:43:21 +0530
commit9d2256adddbb830d33119a5e01e3fad6b4b0652b (patch)
tree958e1de443a6d59a9b09716ba5815c52bfb7bfb3 /common/templates/zig
parentf9142a5822a4f212a3031b932cbf51b2d50344a8 (diff)
add flake templates
Diffstat (limited to 'common/templates/zig')
-rw-r--r--common/templates/zig/.envrc1
-rw-r--r--common/templates/zig/.gitignore6
-rw-r--r--common/templates/zig/flake.nix46
-rw-r--r--common/templates/zig/src/main.zig5
4 files changed, 58 insertions, 0 deletions
diff --git a/common/templates/zig/.envrc b/common/templates/zig/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/common/templates/zig/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/common/templates/zig/.gitignore b/common/templates/zig/.gitignore
new file mode 100644
index 0000000..f55821a
--- /dev/null
+++ b/common/templates/zig/.gitignore
@@ -0,0 +1,6 @@
+.direnv
+.zig-cache/
+zig-out/
+result
+*.o
+
diff --git a/common/templates/zig/flake.nix b/common/templates/zig/flake.nix
new file mode 100644
index 0000000..26bb8f1
--- /dev/null
+++ b/common/templates/zig/flake.nix
@@ -0,0 +1,46 @@
+{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ ...
+ }:
+ let
+ inherit (nixpkgs) lib;
+ forAllSystems = lib.genAttrs lib.systems.flakeExposed;
+ in
+ {
+ packages = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ {
+ default = pkgs.stdenv.mkDerivation {
+ pname = "hello_zig";
+ version = "0.1.0";
+ src = self;
+
+ nativeBuildInputs = [ pkgs.zig.hook ];
+ };
+ }
+ );
+
+ devShells = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ {
+ default = pkgs.mkShellNoCC {
+ packages = [
+ pkgs.zig
+ pkgs.zls
+ ];
+ };
+ }
+ );
+ };
+}
diff --git a/common/templates/zig/src/main.zig b/common/templates/zig/src/main.zig
new file mode 100644
index 0000000..3b2b910
--- /dev/null
+++ b/common/templates/zig/src/main.zig
@@ -0,0 +1,5 @@
+const std = @import("std");
+
+pub fn main() !void {
+ try std.fs.File.stdout().writeAll("Hello, World!\n");
+}