Skip to content

Commit ad2778d

Browse files
committed
📦 Support nix
Update .pre-commit-config.yaml
1 parent f456c48 commit ad2778d

File tree

6 files changed

+120
-5
lines changed

6 files changed

+120
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/result
12
_version.py
23
_metainfo.py
34

.pre-commit-config.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ repos:
4646
hooks:
4747
- id: check-mailmap
4848
- repo: https://github.com/adrienverge/yamllint
49-
rev: v1.29.0
49+
rev: v1.30.0
5050
hooks:
5151
- id: yamllint
5252
- repo: https://github.com/executablebooks/mdformat
@@ -75,7 +75,7 @@ repos:
7575
- id: update-CITATION.cff
7676
- id: update-pyproject.toml
7777
- repo: https://github.com/perltidy/perltidy
78-
rev: "20230309"
78+
rev: "20230309.02"
7979
hooks:
8080
- id: perltidy
8181
- repo: https://github.com/psf/black
@@ -93,7 +93,7 @@ repos:
9393
additional_dependencies:
9494
- tomli
9595
- repo: https://github.com/kumaraditya303/mirrors-pyright
96-
rev: v1.1.298
96+
rev: v1.1.300
9797
hooks:
9898
- id: pyright
9999
- repo: https://github.com/PyCQA/bandit
@@ -104,6 +104,11 @@ repos:
104104
- -cpyproject.toml
105105
additional_dependencies:
106106
- tomli
107+
- repo: https://github.com/nix-community/nixpkgs-fmt
108+
rev: v1.3.0
109+
hooks:
110+
- id: nixpkgs-fmt
111+
107112
ci:
108113
skip:
109114
- pyright

docs/resources/install.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,55 @@
1-
# Install
1+
# Install & Uninstall
22

33
## [AUR](https://aur.archlinux.org/packages/python-repl-python-wakatime)
44

5+
Install:
6+
57
```sh
68
yay -S python-repl-python-wakatime
79
```
810

11+
uninstall:
12+
913
```sh
1014
sudo pacman -R python-repl-python-wakatime
1115
```
1216

17+
## [Nix](https://nixos.org)
18+
19+
For NixOS, add the following code to `/etc/nixos/configuration.nix`:
20+
21+
```nix
22+
{ config, pkgs, ... }:
23+
{
24+
nix.settings.experimental-features = [ "flakes" ];
25+
environment.systemPackages =
26+
let
27+
repl-python-wakatime = (
28+
builtins.getFlake "github:wakatime/repl-python-wakatime"
29+
).packages.${builtins.currentSystem}.default;
30+
in
31+
[
32+
repl-python-wakatime
33+
];
34+
}
35+
```
36+
37+
For nix,
38+
39+
```sh
40+
nix shell github:wakatime/repl-python-wakatime
41+
```
42+
1343
## [PYPI](https://pypi.org/project/repl-python-wakatime)
1444

45+
Install:
46+
1547
```sh
1648
pip install repl-python-wakatime
1749
```
1850

51+
Uninstall:
52+
1953
```sh
2054
pip uninstall repl-python-wakatime
2155
```

flake.lock

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
3+
inputs.flake-utils.url = "github:numtide/flake-utils";
4+
outputs = { self, nixpkgs, flake-utils }:
5+
flake-utils.lib.eachDefaultSystem
6+
(system:
7+
with nixpkgs.legacyPackages.${system};
8+
with python3.pkgs;
9+
{
10+
formatter = nixpkgs-fmt;
11+
packages.default = buildPythonApplication rec {
12+
pname = "repl-python-wakatime";
13+
version = "";
14+
src = self;
15+
format = "pyproject";
16+
disabled = pythonOlder "3.6";
17+
propagatedBuildInputs = [
18+
setuptools
19+
ptpython
20+
ipython
21+
];
22+
pythonImportsCheck = [
23+
"repl_python_wakatime"
24+
];
25+
};
26+
}
27+
);
28+
}

src/repl_python_wakatime/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
from threading import Thread
77
from typing import Any, Callable
88

9-
from ._version import __version__, __version_tuple__ # type: ignore
9+
try:
10+
from ._version import __version__, __version_tuple__ # type: ignore
11+
except ImportError:
12+
__version__ = "rolling"
13+
__version_tuple__ = (0, 0, 0, __version__, "")
1014

1115
logger = logging.getLogger(__name__)
1216

0 commit comments

Comments
 (0)