Skip to content

Commit

Permalink
Add flake and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiisbored committed Jul 8, 2023
1 parent a7224cd commit 31e5cd3
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
zig-cache/
zig-out/

result
280 changes: 280 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
);
}

0 comments on commit 31e5cd3

Please sign in to comment.