commit 9c54c86a8126e7eac246ae8e6ce526de88c979b2 Author: Simon Bruder Date: Thu May 13 08:51:44 2021 +0200 init diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d014379 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.pre-commit-config.yaml +/result* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..aae32a0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright 2021 Simon Bruder + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..09f32e0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,68 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1620759905, + "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1620897287, + "narHash": "sha256-UU0SysjA5h1NMCQhA0lKaeqy9gCBqpq/5dW1BWLbIXo=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "40a51af82c1181b9dea3526c4124eee077e30213", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "master", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1620871477, + "narHash": "sha256-8k9Yb/53HNjHP4poIxD1A0d5Uhv9Ob0YHf991J+iL5c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9c0ca46a6d23883d883fedb9bfd51f286b0a0789", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nix-pre-commit-hooks": "nix-pre-commit-hooks", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..06b4590 --- /dev/null +++ b/flake.nix @@ -0,0 +1,51 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + + nix-pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix/master"; + nix-pre-commit-hooks.inputs.flake-utils.follows = "flake-utils"; + nix-pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, flake-utils, nixpkgs, nix-pre-commit-hooks }: { + overlay = final: prev: + let + inherit (prev) callPackage; + callPythonPackage = prev.python3Packages.callPackage; + in + { + }; + } // flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; }; + lib = pkgs.lib; + in + rec { + checks = { + pre-commit-check = nix-pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + nixpkgs-fmt.enable = true; + }; + }; + }; + + devShell = pkgs.mkShell { + shellHook = checks.pre-commit-check.shellHook; + }; + + packages = lib.filterAttrs + (n: v: lib.elem system v.meta.platforms) + { + inherit (pkgs); + }; + + # My hydra only has x86_64-linux builders + hydraJobs = + if lib.elem system [ "x86_64-linux" ] + then packages + else { }; + }); +}