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-15 10:52:46 +02:00
|
|
|
geoip2-tarball = {
|
|
|
|
url = "https://dl.jakstys.lt/_/2024.01.13.tar.zst";
|
2024-01-12 01:15:11 +02:00
|
|
|
flake = false;
|
|
|
|
};
|
2024-01-15 08:45:51 +02:00
|
|
|
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
2023-12-14 18:16:04 +02:00
|
|
|
};
|
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
flake-utils,
|
2024-01-15 08:45:51 +02:00
|
|
|
pre-commit-hooks,
|
2024-01-15 10:52:46 +02:00
|
|
|
geoip2-tarball,
|
2024-01-15 08:45:51 +02:00
|
|
|
...
|
2024-01-20 12:04:23 +02:00
|
|
|
}: let
|
2024-01-26 10:18:46 +02:00
|
|
|
overlay = import ./overlay.nix geoip2-tarball;
|
2024-01-20 12:04:23 +02:00
|
|
|
in
|
2023-12-14 18:16:04 +02:00
|
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
2024-01-20 06:31:40 +02:00
|
|
|
pkgs = import nixpkgs {
|
2024-01-20 12:11:17 +02:00
|
|
|
inherit system;
|
|
|
|
overlays = [overlay];
|
2024-01-17 15:03:44 +02:00
|
|
|
};
|
2024-01-14 22:45:54 +02:00
|
|
|
in {
|
2024-01-17 15:03:44 +02:00
|
|
|
packages = {
|
2024-01-28 16:42:17 +02:00
|
|
|
inherit
|
|
|
|
(pkgs)
|
2024-01-28 18:15:49 +02:00
|
|
|
e11sync-blog
|
2024-01-28 16:42:17 +02:00
|
|
|
e11sync-static
|
|
|
|
e11sync-djangostatic
|
|
|
|
e11sync-caddyfile
|
|
|
|
e11sync-backend
|
|
|
|
;
|
2024-01-17 15:03:44 +02:00
|
|
|
};
|
|
|
|
|
2024-01-15 08:45:51 +02:00
|
|
|
checks = {
|
2024-01-19 14:26:28 +02:00
|
|
|
e11sync-unit = pkgs.e11sync-backend.passthru.tests.unit;
|
2024-01-15 08:45:51 +02:00
|
|
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
alejandra.enable = true;
|
|
|
|
deadnix.enable = true;
|
|
|
|
statix.enable = true;
|
2024-01-28 15:42:57 +02:00
|
|
|
flake8.enable = true;
|
2024-01-28 15:29:15 +02:00
|
|
|
unit-tests = {
|
2024-01-28 15:42:57 +02:00
|
|
|
enable = false;
|
2024-01-28 15:29:15 +02:00
|
|
|
# ?? this is a directory, how do I run the script?
|
2024-01-28 15:55:16 +02:00
|
|
|
#entry = pkgs.e11sync-backend.passthru.tests.unit.buildCommand;
|
2024-01-28 15:29:15 +02:00
|
|
|
pass_filenames = false;
|
|
|
|
};
|
2024-01-15 08:45:51 +02:00
|
|
|
};
|
|
|
|
};
|
2024-01-20 06:46:00 +02:00
|
|
|
build-vm = self.nixosConfigurations.vm.config.system.build.vm;
|
2024-01-15 08:45:51 +02:00
|
|
|
};
|
2024-01-13 18:58:43 +02:00
|
|
|
|
2024-01-15 10:38:08 +02:00
|
|
|
apps = {
|
2024-01-20 14:10:33 +02:00
|
|
|
e11sync-caddyfile = {
|
2024-01-15 11:57:36 +02:00
|
|
|
type = "app";
|
2024-01-20 14:10:33 +02:00
|
|
|
name = "e11sync-caddyfile";
|
2024-01-15 16:22:14 +02:00
|
|
|
program = toString (pkgs.writeShellScript "wrapper" ''
|
|
|
|
exec ${pkgs.caddy}/bin/caddy run --config ${pkgs.writeTextFile {
|
2024-01-15 11:57:36 +02:00
|
|
|
name = "Caddyfile";
|
|
|
|
text = ''
|
|
|
|
{
|
|
|
|
http_port 8001
|
|
|
|
auto_https off
|
|
|
|
debug
|
|
|
|
}
|
|
|
|
:8001
|
2024-01-20 14:10:33 +02:00
|
|
|
${builtins.readFile "${pkgs.e11sync-caddyfile}"}
|
2024-01-15 11:57:36 +02:00
|
|
|
'';
|
2024-01-15 16:22:14 +02:00
|
|
|
}} --adapter caddyfile'');
|
2024-01-15 11:57:36 +02:00
|
|
|
};
|
2024-01-15 16:17:16 +02:00
|
|
|
e11sync-backend = {
|
|
|
|
type = "app";
|
|
|
|
name = "e11sync-backend";
|
|
|
|
program = toString (pkgs.writeShellScript "wrapper" ''
|
|
|
|
export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3
|
2024-01-19 14:26:28 +02:00
|
|
|
exec ${pkgs.e11sync-backend}/bin/e11sync-backend
|
2024-01-15 16:17:16 +02:00
|
|
|
'');
|
|
|
|
};
|
2024-01-13 17:00:02 +02:00
|
|
|
};
|
|
|
|
|
2024-01-12 12:53:02 +02:00
|
|
|
devShells.default = pkgs.mkShellNoCC {
|
2024-01-26 17:02:21 +02:00
|
|
|
packages = [
|
|
|
|
(
|
|
|
|
pkgs.python3.withPackages
|
|
|
|
(p: with p; [django geoip2 django-debug-toolbar flake8 autopep8])
|
|
|
|
)
|
|
|
|
pkgs.libmaxminddb
|
|
|
|
pkgs.dart-sass
|
2024-01-27 16:42:47 +02:00
|
|
|
|
|
|
|
pkgs.hugo
|
2024-01-14 20:00:17 +02:00
|
|
|
];
|
2024-01-19 14:26:28 +02:00
|
|
|
GEOIP_PATH = "${pkgs.geoip-mmdb}";
|
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";
|
2024-01-15 10:57:11 +02:00
|
|
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
2023-12-14 18:16:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
formatter = pkgs.alejandra;
|
2024-01-16 13:29:16 +02:00
|
|
|
})
|
|
|
|
// {
|
2024-01-15 23:11:46 +02:00
|
|
|
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
modules = [
|
2024-01-20 14:35:18 +02:00
|
|
|
{nixpkgs.overlays = [overlay];}
|
2024-01-16 11:41:15 +02:00
|
|
|
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
|
2024-01-15 23:11:46 +02:00
|
|
|
./vm.nix
|
2024-01-17 15:02:59 +02:00
|
|
|
self.nixosModules.e11sync
|
2024-01-15 23:11:46 +02:00
|
|
|
];
|
|
|
|
};
|
2024-01-20 06:58:09 +02:00
|
|
|
nixosModules.e11sync = import ./modules/e11sync geoip2-tarball;
|
2024-01-20 12:04:23 +02:00
|
|
|
|
2024-01-20 12:11:17 +02:00
|
|
|
overlays.default = overlay;
|
2024-01-16 13:29:16 +02:00
|
|
|
};
|
2023-12-14 18:16:04 +02:00
|
|
|
}
|