diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7089437 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: "Build" + +on: + push: {} + pull_request: {} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: cachix/install-nix-action@v22 + - uses: cachix/cachix-action@v12 + with: + name: zcauchemar + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build + run: nix build diff --git a/.gitignore b/.gitignore index a8ee4aa..9bc1e9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ zig-cache/ zig-out/ - +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..225e74f --- /dev/null +++ b/flake.lock @@ -0,0 +1,280 @@ +{ + "nodes": { + "binned_allocator": { + "flake": false, + "locked": { + "narHash": "sha256-m/kr4kmkG2rLkAj5YwvM0HmXTd+chAiQHzYK6ozpWlw=", + "type": "tarball", + "url": "https://gist.github.com/antlilja/8372900fcc09e38d7b0b6bbaddad3904/archive/6c3321e0969ff2463f8335da5601986cf2108690.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://gist.github.com/antlilja/8372900fcc09e38d7b0b6bbaddad3904/archive/6c3321e0969ff2463f8335da5601986cf2108690.tar.gz" + } + }, + "diffz": { + "flake": false, + "locked": { + "narHash": "sha256-3CdYo6WevT0alRwKmbABahjhFKz7V9rdkDUZ43VtDeU=", + "type": "tarball", + "url": "https://github.com/ziglibs/diffz/archive/90353d401c59e2ca5ed0abe5444c29ad3d7489aa.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/ziglibs/diffz/archive/90353d401c59e2ca5ed0abe5444c29ad3d7489aa.tar.gz" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "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" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "zls", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "known_folders": { + "flake": false, + "locked": { + "narHash": "sha256-DM5DPZUhPlxDAGATHFT9wSuLiAgb5aXWXaws65G6Y5U=", + "type": "tarball", + "url": "https://github.com/ziglibs/known-folders/archive/d070896807cbbd2847d24d561438994504b929dd.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/ziglibs/known-folders/archive/d070896807cbbd2847d24d561438994504b929dd.tar.gz" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1632846328, + "narHash": "sha256-sFi6YtlGK30TBB9o6CW7LG9mYHkgtKeWbSLAjjrNTX0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2b71ddd869ad592510553d09fe89c9709fa26b2b", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1688798537, + "narHash": "sha256-+3QEnDgBiso8lgUJpMagn6xCujmarc6zCWfKYAd6nqU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "842e90934a352f517d23963df3ec0474612e483c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "utils": "utils", + "zig": "zig", + "zls": "zls" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "tres": { + "flake": false, + "locked": { + "narHash": "sha256-drbfeAEFaFDiJa7AHaPuhP2ZL8LHqxFWBOLpjdogdXA=", + "type": "tarball", + "url": "https://github.com/ziglibs/tres/archive/9ca9cd547d10d30984565399dec92068fefd7ad2.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/ziglibs/tres/archive/9ca9cd547d10d30984565399dec92068fefd7ad2.tar.gz" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "zig": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688818079, + "narHash": "sha256-yPR468iXjsJtK/u5LSO/qF9FJOHiG6lunNPLds2/iQ0=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "6d0393649faea7a706d8d7880da752b1dcec6f59", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zls": { + "inputs": { + "binned_allocator": "binned_allocator", + "diffz": "diffz", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore_2", + "known_folders": "known_folders", + "nixpkgs": [ + "nixpkgs" + ], + "tres": "tres", + "zig-overlay": [ + "zig" + ] + }, + "locked": { + "lastModified": 1688762275, + "narHash": "sha256-uuhO59OyoauMg229g1ko7fIV8QDOGeLwrbFDZamYOiM=", + "owner": "zigtools", + "repo": "zls", + "rev": "5038fae0234d69d95259789c4a376dfaf9df6c46", + "type": "github" + }, + "original": { + "owner": "zigtools", + "repo": "zls", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b5a4608 --- /dev/null +++ b/flake.nix @@ -0,0 +1,56 @@ +{ + description = "Stack-based programming language which emulates the look and feel of the 60s"; + + inputs = { + utils.url = "github:numtide/flake-utils"; + gitignore.url = "github:hercules-ci/gitignore.nix"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + zig = { + url = "github:mitchellh/zig-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + zls = { + url = "github:zigtools/zls"; + inputs = { + nixpkgs.follows = "nixpkgs"; + zig-overlay.follows = "zig"; + }; + }; + }; + + outputs = { self, utils, gitignore, nixpkgs, zig, zls }: + utils.lib.eachDefaultSystem (system: + let + inherit (gitignore.lib) gitignoreSource; + + pkgs = import nixpkgs { + inherit system; + overlays = [ + zig.overlays.default + (self: super: { + inherit (zls.packages.${self.system}) zls; + }) + ]; + }; + in + { + packages = rec { + zcauchemar = pkgs.stdenvNoCC.mkDerivation { + name = "zcauchemar"; + version = "main"; + src = gitignoreSource ./.; + nativeBuildInputs = [ pkgs.zigpkgs.master ]; + dontConfigure = true; + dontInstall = true; + buildPhase = '' + mkdir -p $out + mkdir -p .cache/{p,z,tmp} + zig build install --cache-dir $(pwd)/zig-cache --global-cache-dir $(pwd)/.cache -Dcpu=baseline -Doptimize=ReleaseSafe --prefix $out + ''; + }; + + default = zcauchemar; + }; + } + ); +}