use zig overlay

This commit is contained in:
Fabien Freling 2023-10-09 14:03:56 +02:00
parent 2162e114fc
commit d9204132ee
2 changed files with 119 additions and 57 deletions

View file

@ -1,44 +1,41 @@
{
description = "FabApp";
# Inspired by https://github.com/mitchellh/zig-objc/blob/main/flake.nix
inputs = {
# take unstable if not specified
# nixpkgs.url = "github:nixos/nixpkgs/release-23.05";
flake-parts.url = "github:hercules-ci/flake-parts";
# nixpkgs.url = "github:NixOS/nixpkgs/unstable";
flake-utils.url = "github:numtide/flake-utils";
zig.url = "github:mitchellh/zig-overlay";
};
outputs = inputs@{ flake-parts, nixpkgs, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
flake = {
# Put your original flake attributes here.
};
systems = [ "x86_64-linux" ];
# https://flake.parts/module-arguments.html#persystem-module-parameters
perSystem = { pkgs, system, ... }: {
_module.args.pkgs = import nixpkgs {
inherit system;
# config.allowUnfree = true;
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs: let
overlays = [
(final: prev: {
zigpkgs = inputs.zig.packages.${prev.system};
})
];
systems = ["x86_64-linux"];
in
flake-utils.lib.eachSystem systems (
system: let
pkgs = import nixpkgs {inherit overlays system;};
in rec {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
zigpkgs.master
zls
emscripten
sqlite
];
};
devShells.default = with pkgs;
mkShell {
buildInputs = [
sqlite
# Zig / webAssembly impl.
zig
zls
emscripten
# Tools
nixfmt
];
};
formatter = pkgs.nixfmt;
};
};
formatter = pkgs.alejandra;
}
);
}