1
0
Fork 0
mirror of https://github.com/mitchellh/zig-overlay.git synced 2025-05-09 02:56:03 +03:00
zig-overlay/flake.nix

83 lines
2.1 KiB
Nix
Raw Normal View History

{
description = "Zig compiler binaries.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
systems = {
url = "github:nix-systems/default";
flake = false;
};
2023-01-17 09:37:23 -08:00
# Used for shell.nix
flake-compat = {
url = "github:edolstra/flake-compat";
2023-01-17 09:37:23 -08:00
flake = false;
};
};
2022-08-22 19:55:54 -07:00
outputs = {
self,
nixpkgs,
systems,
2022-08-22 19:55:54 -07:00
...
}: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
2022-08-22 19:55:54 -07:00
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system});
in {
# The packages exported by the Flake:
# - default - latest /released/ version
# - <version> - tagged version
# - master - latest nightly (updated daily)
# - master-<date> - nightly by date
packages = lib.mapAttrs (system: pkgs: import ./default.nix {inherit system pkgs;}) pkgsFor;
2023-01-17 09:37:23 -08:00
# Overlay that can be imported so you can access the packages
# using zigpkgs.master or whatever you'd like.
overlays.default = final: prev: {
zigpkgs = self.packages.${prev.system};
};
2023-01-17 09:37:23 -08:00
# "Apps" so that `nix run` works. If you run `nix run .` then
# this will use the latest default.
apps = eachSystem (system: {
default = self.apps.${system}.zig;
zig = {
type = "app";
program = self.packages.${system}.default.outPath;
2022-08-22 19:55:54 -07:00
};
});
2022-08-23 09:36:18 -07:00
# nix fmt
formatter = lib.mapAttrs (_: pkgs: pkgs.alejandra) pkgsFor;
devShells =
lib.mapAttrs (system: pkgs: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
curl
jq
minisign
];
};
})
pkgsFor;
# For compatibility with older versions of the `nix` binary
devShell = eachSystem (system: self.devShells.${system}.default);
# Templates for use with nix flake init
templates.compiler-dev = {
path = ./templates/compiler-dev;
description = "A development environment for Zig compiler development.";
2022-08-22 19:55:54 -07:00
};
templates.init = {
path = ./templates/init;
description = "A basic, empty development environment.";
};
};
}