updated development runtime envirnment
This commit is contained in:
parent
f956080126
commit
ffd5cc9b30
|
@ -1,3 +1,5 @@
|
|||
# SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
|
@ -6,19 +8,6 @@ insert_final_newline = true
|
|||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
[{Makefile,*.mk}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.nix]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
|
|
6
.envrc
6
.envrc
|
@ -1,5 +1,11 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# https://github.com/direnv/direnv/wiki
|
||||
|
||||
use flake
|
||||
|
||||
layout python3
|
||||
|
||||
watch_file ./nix/shell.nix
|
||||
|
||||
eval "$shellHook"
|
||||
|
|
38
.gitignore
vendored
38
.gitignore
vendored
|
@ -1,14 +1,32 @@
|
|||
.vscode
|
||||
flow_backup.json
|
||||
flows/.main.json.backup
|
||||
# SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
|
||||
# General
|
||||
.reuse
|
||||
*.dll
|
||||
*.log
|
||||
*.so
|
||||
*.swp
|
||||
export
|
||||
tmp
|
||||
img
|
||||
docs/_*
|
||||
*.jpg
|
||||
*.png
|
||||
*.pyc
|
||||
*__pycache__*
|
||||
tmp
|
||||
|
||||
# Nix
|
||||
.direnv
|
||||
.reuse
|
||||
.pre-commit-config.yaml
|
||||
result
|
||||
|
||||
# Python
|
||||
/*.py[cod]
|
||||
/__pycache__
|
||||
/.benchmark
|
||||
/.coverage*
|
||||
/.pytest_cache
|
||||
|
||||
# Node-Red
|
||||
/.main.json.backup
|
||||
/flow_backup.json
|
||||
|
||||
# Mkdocs
|
||||
dist
|
||||
docs/_*
|
||||
site
|
||||
|
|
1
.mdlrc
1
.mdlrc
|
@ -1 +0,0 @@
|
|||
rules "MD001","MD002","MD003","MD004","MD005","MD006","MD007","MD010","MD011","MD012","MD014","MD018","MD019","MD020","MD021","MD022","MD023","MD024","MD025","MD027","MD028","MD029","MD030","MD031","MD032","MD033","MD034","MD035","MD036","MD037","MD038","MD039","MD040","MD041","MD047"
|
20
.vscode/extensions.json
vendored
Normal file
20
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"bungcip.better-toml",
|
||||
"cab404.vscode-direnv",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"editorconfig.editorconfig",
|
||||
"esbenp.prettier-vscode",
|
||||
"exiasr.hadolint",
|
||||
"kamadorueda.alejandra",
|
||||
"kamikillerto.vscode-colorize",
|
||||
"mechatroner.rainbow-csv",
|
||||
"ms-python.black-formatter",
|
||||
"ms-python.python",
|
||||
"oderwat.indent-rainbow",
|
||||
"pinage404.nix-extension-pack",
|
||||
"redhat.vscode-yaml",
|
||||
"yatki.vscode-surround",
|
||||
"yzhang.markdown-all-in-one",
|
||||
],
|
||||
}
|
22
.vscode/settings.json
vendored
Normal file
22
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"[nix]": {
|
||||
"editor.defaultFormatter": "kamadorueda.alejandra",
|
||||
"editor.formatOnSave": true,
|
||||
},
|
||||
"[toml]": {
|
||||
"editor.formatOnSave": true,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.codeLens": true
|
||||
},
|
||||
"python.formatting.provider": "black",
|
||||
"python.globalModuleInstallation": false,
|
||||
"python.languageServer": "Pylance",
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.lintOnSave": true,
|
||||
"python.linting.pycodestyleEnabled": true,
|
||||
"python.linting.pydocstyleEnabled": true,
|
||||
"python.linting.pylintEnabled": true,
|
||||
"python.testing.autoTestDiscoverOnSaveEnabled": true,
|
||||
"python.testing.pytestEnabled": true,
|
||||
"python.defaultInterpreterPath": "${workspaceFolder}/.direnv/dev/bin/python3",
|
||||
}
|
23
Makefile
23
Makefile
|
@ -1,23 +0,0 @@
|
|||
##@ General
|
||||
|
||||
help: ## Display this help.
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
|
||||
##@ Documentation
|
||||
|
||||
docs-build: ## Build the MkDocs documentation
|
||||
@mkdocs build
|
||||
|
||||
docs-serve: ## Run mkdocs builtin development server
|
||||
@mkdocs serve
|
||||
|
||||
##@ Lint
|
||||
|
||||
lint-markdown: ## Run markdown linter on all files
|
||||
@mdl .
|
||||
|
||||
lint-reuse: ## Run reuse linter on all files
|
||||
@reuse lint
|
||||
|
||||
%:
|
||||
@true
|
69
flake.lock
69
flake.lock
|
@ -31,57 +31,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1642700792,
|
||||
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mach-nix": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pypi-deps-db": "pypi-deps-db"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654084003,
|
||||
"narHash": "sha256-j/XrVVistvM+Ua+0tNFvO5z83isL+LBgmBi9XppxuKA=",
|
||||
"owner": "DavHau",
|
||||
"repo": "mach-nix",
|
||||
"rev": "7e14360bde07dcae32e5e24f366c83272f52923f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "mach-nix",
|
||||
"ref": "3.5.0",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1643805626,
|
||||
"narHash": "sha256-AXLDVMG+UaAGsGSpOtQHPIKB+IZ0KSd9WS77aanGzgc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "554d2d8aa25b6e583575459c297ec23750adb6cb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1664281702,
|
||||
"narHash": "sha256-haixZ4TJLu1Dciow54wrHrHvlGDVr5sW6MTeAV/ZLuI=",
|
||||
|
@ -120,28 +70,11 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pypi-deps-db": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1643877077,
|
||||
"narHash": "sha256-jv8pIvRFTP919GybOxXE5TfOkrjTbdo9QiCO1TD3ZaY=",
|
||||
"owner": "DavHau",
|
||||
"repo": "pypi-deps-db",
|
||||
"rev": "da53397f0b782b0b18deb72ef8e0fb5aa7c98aa3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "DavHau",
|
||||
"repo": "pypi-deps-db",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"mach-nix": "mach-nix",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
}
|
||||
|
|
24
flake.nix
24
flake.nix
|
@ -1,3 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{
|
||||
description = "Nix PlanktoScope";
|
||||
inputs = {
|
||||
|
@ -15,33 +16,20 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
|
||||
mach-nix.url = "mach-nix/3.5.0";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
mach-nix,
|
||||
...
|
||||
} @ inputs:
|
||||
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system: let
|
||||
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system: {
|
||||
devShells.default = import ./nix/shell.nix inputs system;
|
||||
checks = import ./nix/checks.nix inputs system;
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
config.allowAliases = true;
|
||||
};
|
||||
machNix = mach-nix.lib."${system}";
|
||||
in rec {
|
||||
packages = {
|
||||
planktoscope = machNix.buildPythonPackage {
|
||||
src = builtins.fetchGit {
|
||||
url = "https://github.com/PlanktoScope/PlanktoScope";
|
||||
ref = "master";
|
||||
rev = "d52e194de0604e6fdd41ba2e13de9ab91e7789da";
|
||||
};
|
||||
extras = [];
|
||||
};
|
||||
};
|
||||
devShell = import ./nix/shell.nix {inherit pkgs;};
|
||||
});
|
||||
}
|
||||
|
|
43
nix/checks.nix
Normal file
43
nix/checks.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
self,
|
||||
pre-commit-hooks,
|
||||
...
|
||||
}: system:
|
||||
with self.pkgs.${system}; {
|
||||
pre-commit-check =
|
||||
pre-commit-hooks.lib.${system}.run
|
||||
{
|
||||
src = lib.cleanSource ../.;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
nix-linter.enable = true;
|
||||
yamllint.enable = true;
|
||||
# isort.enable = true;
|
||||
# black.enable = true;
|
||||
# shellcheck.enable = true;
|
||||
# markdownlint.enable = true;
|
||||
};
|
||||
settings.nix-linter.checks = [
|
||||
"DIYInherit"
|
||||
"EmptyInherit"
|
||||
"EmptyLet"
|
||||
"EtaReduce"
|
||||
"LetInInheritRecset"
|
||||
"ListLiteralConcat"
|
||||
"NegateAtom"
|
||||
"SequentialLet"
|
||||
"SetLiteralUpdate"
|
||||
"UnfortunateArgName"
|
||||
"UnneededRec"
|
||||
"UnusedArg"
|
||||
"UnusedLetBind"
|
||||
"UpdateEmptySet"
|
||||
"BetaReduction"
|
||||
"EmptyVariadicParamSet"
|
||||
"UnneededAntiquote"
|
||||
"no-FreeLetInFunc"
|
||||
"no-AlphabeticalArgs"
|
||||
"no-AlphabeticalBindings"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,22 +1,43 @@
|
|||
{pkgs ? import <nixpkgs> {}}:
|
||||
with pkgs;
|
||||
{self, ...}: system:
|
||||
with self.pkgs.${system};
|
||||
mkShell {
|
||||
name = "planctoscope";
|
||||
nativeBuildInputs = with pkgs; [
|
||||
alejandra
|
||||
docker
|
||||
editorconfig-checker
|
||||
git
|
||||
gnumake
|
||||
hadolint
|
||||
mdl
|
||||
nixpkgs-fmt
|
||||
pre-commit
|
||||
python310Packages.mkdocs
|
||||
reuse
|
||||
rnix-lsp
|
||||
vscodium-fhs
|
||||
yaml-language-server
|
||||
yamllint
|
||||
];
|
||||
name = "planktoscope";
|
||||
nativeBuildInputs =
|
||||
[
|
||||
# Development
|
||||
editorconfig-checker
|
||||
pre-commit
|
||||
python-language-server
|
||||
python37
|
||||
python38
|
||||
python39
|
||||
python310Full
|
||||
python311
|
||||
yaml-language-server
|
||||
]
|
||||
++ lib.optionals (pkgs.hostPlatform.system == "x86_64-linux") [
|
||||
vscodium-fhs
|
||||
]
|
||||
++ [
|
||||
# Linter
|
||||
git
|
||||
yamllint
|
||||
|
||||
# Nix
|
||||
alejandra
|
||||
nix
|
||||
nix-linter
|
||||
rnix-lsp
|
||||
|
||||
# Service
|
||||
mosquitto
|
||||
|
||||
# Misc
|
||||
reuse
|
||||
];
|
||||
shellHook = ''
|
||||
${self.checks.${system}.pre-commit-check.shellHook}
|
||||
pip install --upgrade pip hatch
|
||||
hatch env create dev
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue