summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--flake.lock82
-rw-r--r--flake.nix42
-rw-r--r--main.c38
-rw-r--r--project.json22
5 files changed, 157 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..efc68e0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build/
+out/
+result*
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..e787972
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,82 @@
+{
+ "nodes": {
+ "c3c": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1776896666,
+ "narHash": "sha256-sHuzupUdWHfzzigugxtmKBx+25BtE35012iTLq6cP4I=",
+ "owner": "c3lang",
+ "repo": "c3c",
+ "rev": "453735825c282b419c7e08438a5b7b59d16e5624",
+ "type": "github"
+ },
+ "original": {
+ "owner": "c3lang",
+ "repo": "c3c",
+ "type": "github"
+ }
+ },
+ "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": 1776329215,
+ "narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "b86751bc4085f48661017fa226dee99fab6c651b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "c3c": "c3c",
+ "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..6622516
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,42 @@
+{
+ inputs = {
+ self.submodules = true;
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
+ c3c = {
+ url = "github:c3lang/c3c";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = {
+ nixpkgs,
+ c3c,
+ ...
+ }: let
+ pkgs = import nixpkgs {
+ system = "x86_64-linux";
+ overlays = [(_: _: {c3c = c3c.packages.x86_64-linux.default;})];
+ };
+ in {
+ packages.x86_64-linux.default = pkgs.stdenv.mkDerivation {
+ pname = "c3term";
+ version = "0.1.0";
+ src = ./.;
+ buildInputs = [
+ pkgs.c3c
+ ];
+ buildPhase = ''
+ c3c build
+ '';
+ installPhase = ''
+ mkdir -p $out/bin/
+ cp ./build/c3term $out/bin/
+ '';
+ };
+ devShells.x86_64-linux.default = pkgs.mkShell {
+ buildInputs = [
+ pkgs.c3c
+ ];
+ };
+ };
+}
diff --git a/main.c3 b/main.c3
new file mode 100644
index 0000000..01f5693
--- /dev/null
+++ b/main.c3
@@ -0,0 +1,8 @@
+module c3term;
+import std::io;
+
+fn int main(String[] args)
+{
+ io::printn("Hello, World!");
+ return 0;
+}
diff --git a/project.json b/project.json
new file mode 100644
index 0000000..822b279
--- /dev/null
+++ b/project.json
@@ -0,0 +1,22 @@
+{
+ "langrev": "1",
+ "warnings": [ "no-unused" ],
+ "dependency-search-paths": [ ],
+ "dependencies": [ ],
+ "authors": [ "Andromeda-fp" ],
+ "version": "0.1.0",
+ "sources": [ "**" ],
+ "test-sources": [ ],
+ "c-sources": [ ],
+ "c-include-dirs": [ "include" ],
+ "build-dir": "build",
+ "output": "build",
+ "targets": {
+ "c3term": {
+ "type": "executable",
+ },
+ },
+ "cpu": "generic",
+ // Optimization: "O0", "O1", "O2", "O3", "O4", "O5", "Os", "Oz".
+ "opt": "O0"
+}