summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rw-r--r--flake.lock61
-rw-r--r--flake.nix41
4 files changed, 104 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 979403b..d34ac02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
obj/
zc
+result \ No newline at end of file
diff --git a/Makefile b/Makefile
index 0b62685..acbd80c 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ OBJ_DIR = obj
OBJS = $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRCS))
# Installation paths
-PREFIX = /usr/local
+PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..28ab3b0
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1768127708,
+ "narHash": "sha256-1Sm77VfZh3mU0F5OqKABNLWxOuDeHIlcFjsXeeiPazs=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "ffbc9f8cbaacfb331b6017d5a5abb21a492c9a38",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..0a9eefc
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,41 @@
+{
+ description = "Zen-C compiler";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ flake-utils,
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+
+ lib = pkgs.lib;
+ in
+ {
+ packages.default = pkgs.stdenv.mkDerivation {
+ pname = "zen-c";
+ version = "unstable";
+
+ src = self;
+
+ env.PREFIX = placeholder "out";
+
+ meta = {
+ description = "Zen-C programming language compiler";
+ homepage = "https://github.com/z-libs/Zen-C";
+ license = lib.licenses.mit;
+ platforms = lib.platforms.unix;
+ mainProgram = "zc";
+ };
+ };
+ }
+ );
+}