Bootstrap nix flake environment

This commit is contained in:
Bruno BELANYI 2022-06-01 16:15:54 +02:00
commit 00f3013af0
2 changed files with 137 additions and 0 deletions

69
flake.lock Normal file
View file

@ -0,0 +1,69 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "master",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1654007547,
"narHash": "sha256-G812EeXZeGeGjkAvbTleGwcKFCGxdLOQb9aViOWASPc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5643714dea562f0161529ab23058562afeff46d0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1652714503,
"narHash": "sha256-qQKVEfDe5FqvGgkZtg5Pc491foeiDPIOeycHMqnPDps=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "521a524771a8e93caddaa0ac1d67d03766a8b0b3",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "master",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}

68
flake.nix Normal file
View file

@ -0,0 +1,68 @@
{
description = "A tree-sitter grammar for Tiger";
inputs = {
flake-utils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "master";
};
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixpkgs-unstable";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs =
{ self
, flake-utils
, nixpkgs
, pre-commit-hooks
}:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
};
in
rec {
checks = {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt = {
enable = true;
};
};
};
};
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs
tree-sitter
];
inherit (checks.pre-commit) shellHook;
};
};
});
}