diff options
| author | seth <[email protected]> | 2023-02-04 23:12:58 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-03-14 20:40:13 -0400 |
| commit | 52e58d2da91d2980823612d6c55e41ed6af0382e (patch) | |
| tree | 41cedd7715dca1e15e51fbba0351f2d69dd54dd4 /flake.nix | |
| parent | d7c0dd5ac7ce11ca24f4d05c35820182957fa075 (diff) | |
feat: bit of a refactor
- moved teawie_bot to root directory
- added nix flake
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7ec30ab --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +{ + description = "teawie moment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + pre-commit-hooks, + flake-compat, + flake-utils, + }: let + version = "0.0.1"; + supportedSystems = with flake-utils.lib.system; [x86_64-linux x86_64-darwin aarch64-linux aarch64-darwin]; + in + flake-utils.lib.eachSystem supportedSystems (system: let + pkgs = import nixpkgs {inherit system;}; + in { + packages = + { + teawiebot = with pkgs; + python39Packages.buildPythonPackage { + pname = "teawiebot"; + inherit version; + src = ./.; + format = "flit"; + propagatedBuildInputs = with pkgs.python39Packages; [hatchling discordpy requests]; + }; + } + // {default = self.packages.${system}.teawiebot;}; + + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + isort.enable = true; + pylint.enable = true; + yapf = { + enable = true; + name = "yapf"; + entry = "${pkgs.python39Packages.yapf}/bin/yapf -i"; + types = ["file" "python"]; + }; + }; + }; + }; + + devShells = with pkgs; { + default = mkShell { + packages = with pkgs.python39Packages; [python39 discordpy flit pylint requests toml yapf]; + inherit (self.checks.${system}.pre-commit-check) shellHook; + }; + }; + }); +} |
