1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00
zap/flake.nix
2023-04-14 20:38:02 +02:00

99 lines
2.7 KiB
Nix

{
description = "zap dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-22.11";
flake-utils.url = "github:numtide/flake-utils";
# required for latest zig
zig.url = "github:mitchellh/zig-overlay";
# required for latest neovim
neovim-flake.url = "github:neovim/neovim?dir=contrib";
neovim-flake.inputs.nixpkgs.follows = "nixpkgs";
# Used for shell.nix
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
};
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs: let
overlays = [
# Other overlays
(final: prev: {
zigpkgs = inputs.zig.packages.${prev.system};
neovim-nightly-pkgs = inputs.neovim-flake.packages.${prev.system};
})
];
# Our supported systems are the same supported systems as the Zig binaries
systems = builtins.attrNames inputs.zig.packages;
in
flake-utils.lib.eachSystem systems (
system: let
pkgs = import nixpkgs {inherit overlays system; };
in rec {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
neovim-nightly-pkgs.neovim
zigpkgs.master
bat
wrk
python39
pkgs.rustc
pkgs.cargo
pkgs.gcc
pkgs.rustfmt
pkgs.clippy
pkgs.go
pkgs.gotools
pkgs.gopls
pkgs.golint
];
buildInputs = with pkgs; [
# we need a version of bash capable of being interactive
# as opposed to a bash just used for building this flake
# in non-interactive mode
bashInteractive
];
shellHook = ''
# once we set SHELL to point to the interactive bash, neovim will
# launch the correct $SHELL in its :terminal
export SHELL=${pkgs.bashInteractive}/bin/bash
'';
};
devShells.build = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
zigpkgs.master
];
buildInputs = with pkgs; [
# we need a version of bash capable of being interactive
# as opposed to a bash just used for building this flake
# in non-interactive mode
bashInteractive
];
shellHook = ''
# once we set SHELL to point to the interactive bash, neovim will
# launch the correct $SHELL in its :terminal
export SHELL=${pkgs.bashInteractive}/bin/bash
'';
};
# For compatibility with older versions of the `nix` binary
devShell = self.devShells.${system}.default;
}
);
}