Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Feb 6, 2023
0 parents commit 2f795b9
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# If we are a computer with nix-shell available, then use that to setup
# the build environment with exactly what we need.
if has nix; then
use nix
fi
128 changes: 128 additions & 0 deletions flake.lock

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

46 changes: 46 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
description = "An empty project that uses Zig.";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-22.05";
flake-utils.url = "github:numtide/flake-utils";
zig.url = "github:mitchellh/zig-overlay";

# 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};
})
];

# 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; [
zigpkgs.master
];
};

# For compatibility with older versions of the `nix` binary
devShell = self.devShells.${system}.default;
}
);
}
12 changes: 12 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(import
(
let
flake-compat = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.flake-compat;
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${flake-compat.locked.rev}.tar.gz";
sha256 = flake-compat.locked.narHash;
}
)
{src = ./.;})
.shellNix

0 comments on commit 2f795b9

Please sign in to comment.