commit 816b8196027152bd91eca1160b69f338a9deb143 Author: Bruno BELANYI Date: Sat Jun 12 00:38:17 2021 +0200 nix: add flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..035d004 --- /dev/null +++ b/flake.lock @@ -0,0 +1,69 @@ +{ + "nodes": { + "futils": { + "locked": { + "lastModified": 1622445595, + "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", + "type": "github" + }, + "original": { + "owner": "numtide", + "ref": "master", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1623176226, + "narHash": "sha256-54a9uvHlIlK3i0b36HfGMc4zqM0BpMOOiFYBxEhQFK8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "51bb9f3e9ab6161a3bf7746e20b955712cef618b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "futils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1622650193, + "narHash": "sha256-qSzUpJDv04ajS9FXoCq6NjVF3qOt9IiGIiGh0P8amyw=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "0398f0649e0a741660ac5e8216760bae5cc78579", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "master", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "futils": "futils", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d286e0e --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +{ + description = "Ambroisie's blog"; + + inputs = { + futils = { + 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 = "futils"; + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + + outputs = { self, futils, nixpkgs, pre-commit-hooks } @ inputs: + futils.lib.eachDefaultSystem (system: + let + inherit (nixpkgs) lib; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + checks = { + pre-commit = pre-commit-hooks.lib.${system}.run { + src = ./.; + + hooks = { + nixpkgs-fmt = { + enable = true; + }; + + shellcheck = { + enable = true; + }; + }; + }; + }; + + devShell = pkgs.mkShell { + name = "matrix-notifier"; + + buildInputs = with pkgs; [ + curl + jq + ]; + + inherit (self.checks.${system}.pre-commit) shellHook; + }; + } + ); +}