Add a shell.nix

This commit is contained in:
Mitchell Hashimoto 2023-01-17 09:37:23 -08:00
parent b2ecddb739
commit 03177b00df
No known key found for this signature in database
GPG key ID: 523D5DC389D273BC
4 changed files with 50 additions and 0 deletions

5
.envrc Normal file
View file

@ -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

17
flake.lock generated
View file

@ -1,5 +1,21 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
@ -33,6 +49,7 @@
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}

View file

@ -4,6 +4,12 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
# Used for shell.nix
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
};
outputs = {
@ -32,6 +38,16 @@
# nix fmt
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
curl
jq
];
};
# For compatibility with older versions of the `nix` binary
devShell = self.devShells.${system}.default;
});
in
outputs

12
shell.nix Normal file
View file

@ -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