1
Fork 0
e11sync/flake.nix

78 lines
2.2 KiB
Nix
Raw Normal View History

2023-12-14 18:16:04 +02:00
{
nixConfig = {
trusted-substituters = "https://cache.nixos.org/";
trusted-public-keys = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
extra-experimental-features = "nix-command flakes";
};
inputs = {
2024-01-07 23:07:09 +02:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
2023-12-14 18:16:04 +02:00
flake-utils.url = "github:numtide/flake-utils";
2024-01-12 01:15:11 +02:00
geoip2-asn = {
2024-01-12 07:38:22 +02:00
url = "https://dl.jakstys.lt/_/2024.01.10/GeoLite2-ASN.mmdb";
2024-01-12 01:15:11 +02:00
flake = false;
};
geoip2-city = {
2024-01-12 07:38:22 +02:00
url = "https://dl.jakstys.lt/_/2024.01.10/GeoLite2-City.mmdb";
2024-01-12 01:15:11 +02:00
flake = false;
};
geoip2-country = {
2024-01-12 07:38:22 +02:00
url = "https://dl.jakstys.lt/_/2024.01.10/GeoLite2-Country.mmdb";
2024-01-12 01:15:11 +02:00
flake = false;
};
2023-12-14 18:16:04 +02:00
};
outputs = {
self,
nixpkgs,
flake-utils,
2024-01-12 01:15:11 +02:00
geoip2-asn,
geoip2-city,
geoip2-country,
2023-12-14 18:16:04 +02:00
...
}:
flake-utils.lib.eachDefaultSystem (system: let
2024-01-13 19:36:42 +02:00
pkgs = import nixpkgs {inherit system;};
2024-01-13 17:45:12 +02:00
in rec {
packages.geoip-archive = pkgs.callPackage ./pkgs/geoip-archive.nix {
inherit geoip2-asn geoip2-city geoip2-country;
};
2024-01-14 20:00:17 +02:00
packages.e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {
inherit self;
2024-01-13 09:59:21 +02:00
};
2024-01-14 19:54:32 +02:00
packages.e11sync = pkgs.callPackage ./pkgs/e11sync.nix {
inherit self;
geoip-archive = packages.geoip-archive;
2024-01-13 17:45:12 +02:00
};
checks.e11sync = packages.e11sync.passthru.tests.simple;
2024-01-13 18:58:43 +02:00
2024-01-13 17:45:12 +02:00
apps.e11sync-gunicorn = {
type = "app";
name = "e11sync-gunicorn";
program = let
wrapper = pkgs.writeShellScript "wrapper" ''
export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3
exec ${packages.e11sync}/bin/e11sync-gunicorn
'';
2024-01-14 19:54:32 +02:00
in "${wrapper}";
2024-01-13 17:00:02 +02:00
};
2024-01-12 12:53:02 +02:00
devShells.default = pkgs.mkShellNoCC {
2024-01-14 20:00:17 +02:00
packages = with pkgs; [
python3Packages.django-debug-toolbar
python3Packages.django_5
python3Packages.django-compressor
python3Packages.geoip2
libmaxminddb
dart-sass
];
GEOIP_PATH = "${packages.geoip-archive}";
2024-01-13 09:59:21 +02:00
E11SYNC_DEBUG = "1";
2024-01-13 19:30:41 +02:00
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
2023-12-14 18:16:04 +02:00
};
formatter = pkgs.alejandra;
});
}