1
Fork 0

some linters

This commit is contained in:
Motiejus Jakštys 2024-01-15 08:45:51 +02:00
parent e17646b070
commit 94626bb28b
3 changed files with 106 additions and 6 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@
__pycache__
db.sqlite3
/.pre-commit-config.yaml

View File

@ -1,5 +1,20 @@
{
"nodes": {
"flake-compat": {
"locked": {
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -54,6 +69,26 @@
"url": "https://dl.jakstys.lt/_/2024.01.10/GeoLite2-Country.mmdb"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704420045,
@ -70,13 +105,48 @@
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": [
"flake-compat"
],
"flake-utils": [
"flake-utils"
],
"gitignore": [
"gitignore"
],
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1705229514,
"narHash": "sha256-itILy0zimR/iyUGq5Dgg0fiW8plRDyxF153LWGsg3Cw=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "ffa9a5b90b0acfaa03b1533b83eaf5dead819a05",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"geoip2-asn": "geoip2-asn",
"geoip2-city": "geoip2-city",
"geoip2-country": "geoip2-country",
"nixpkgs": "nixpkgs"
"gitignore": "gitignore",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {

View File

@ -19,15 +19,32 @@
url = "https://dl.jakstys.lt/_/2024.01.10/GeoLite2-Country.mmdb";
flake = false;
};
flake-compat.url = "github:nix-community/flake-compat";
gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
flake-utils.follows = "flake-utils";
gitignore.follows = "gitignore";
};
};
};
outputs = {
self,
nixpkgs,
flake-utils,
pre-commit-hooks,
geoip2-asn,
geoip2-city,
geoip2-country,
}:
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
@ -39,11 +56,21 @@
e11sync = pkgs.callPackage ./pkgs/e11sync.nix {inherit geoip-archive;};
in {
packages.geoip-archive = geoip-archive;
packages.e11sync-static = e11sync-static;
packages.e11sync = e11sync;
packages = {
inherit geoip-archive e11sync-static e11sync;
};
checks.e11sync-unit = e11sync.passthru.tests.unit;
checks = {
e11sync-unit = e11sync.passthru.tests.unit;
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
};
};
};
apps.e11sync-gunicorn = {
type = "app";
@ -66,6 +93,7 @@
GEOIP_PATH = "${geoip-archive}";
E11SYNC_DEBUG = "1";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
inherit (inputs.self.checks.${system}.pre-commit-check) shellHook;
};
formatter = pkgs.alejandra;