-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathflake.nix
More file actions
106 lines (91 loc) · 2.67 KB
/
flake.nix
File metadata and controls
106 lines (91 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
description = "A terminal UI for SQL databases";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
pyPkgs = pkgs.python3.pkgs;
ref =
if self ? sourceInfo && self.sourceInfo ? ref
then self.sourceInfo.ref
else "";
tag =
if lib.hasPrefix "refs/tags/v" ref
then lib.removePrefix "refs/tags/v" ref
else if lib.hasPrefix "refs/tags/" ref
then lib.removePrefix "refs/tags/" ref
else if lib.hasPrefix "v" ref
then lib.removePrefix "v" ref
else "";
shortRev = if self ? shortRev then self.shortRev else "dirty";
version = if tag != "" then tag else "0.0.0+${shortRev}";
sqlit = pyPkgs.buildPythonApplication {
pname = "sqlit";
inherit version;
pyproject = true;
src = self;
build-system = [
pyPkgs.hatchling
pyPkgs."hatch-vcs"
pyPkgs."setuptools-scm"
];
nativeBuildInputs = [
pyPkgs.pythonRelaxDepsHook
];
pythonRelaxDeps = [
"textual-fastdatatable"
];
SETUPTOOLS_SCM_PRETEND_VERSION = version;
dependencies = [
pyPkgs.docker
pyPkgs.keyring
pyPkgs.pyperclip
pyPkgs.sqlparse
pyPkgs.textual
pyPkgs."textual-fastdatatable"
];
pythonImportsCheck = [ "sqlit" ];
meta = with lib; {
description = "A terminal UI for SQL databases";
homepage = "https://github.com/Maxteabag/sqlit";
license = licenses.mit;
mainProgram = "sqlit";
};
};
in {
packages = {
inherit sqlit;
default = sqlit;
};
apps.default = {
type = "app";
program = "${sqlit}/bin/sqlit";
};
checks = {
inherit sqlit;
};
devShells.default = pkgs.mkShell {
packages = [
pkgs.python3
pkgs.hatch
pyPkgs.pytest
pyPkgs.pytest-timeout
pyPkgs.pytest-asyncio
pyPkgs.pytest-cov
pyPkgs.pytest-benchmark
pkgs.ruff
pyPkgs.mypy
pkgs.pre-commit
pyPkgs.build
pyPkgs.faker
pyPkgs.ipython
];
inputsFrom = [ sqlit ];
};
});
}