Skip to content

Commit

Permalink
[Nothing]: add nix develop support
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed May 12, 2024
1 parent e534a32 commit 013ddc5
Show file tree
Hide file tree
Showing 4 changed files with 313 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
zig-cache
zig-out
.direnv
254 changes: 254 additions & 0 deletions flake.lock

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

57 changes: 57 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
description = "For lua environment";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
zig-overlay.url = "github:mitchellh/zig-overlay";
zls-overlay.url = "github:zigtools/zls";
};

outputs = { self, nixpkgs, ... }@ inputs:
let
systems = [
# "aarch64-linux"
# "i686-linux"
# "aarch64-darwin"
# "x86_64-darwin"
"x86_64-linux"
];
# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
# This is for using nix direnv and flake develop environment
devShells = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.zig-overlay.overlays.default
(final: prev: {
zlspkgs = inputs.zls-overlay.packages.${system}.default;
})
];
};
in
{
default =
pkgs.mkShell {
packages = with pkgs; [
zigpkgs.default
zls
nodePackages.live-server
];
};

nightly =
pkgs.mkShell {
packages = with pkgs;[
zigpkgs.master
zlspkgs
nodePackages.live-server
];
};
});
};
}

0 comments on commit 013ddc5

Please sign in to comment.