Files
calendar-bot/flake.nix
T
2026-05-26 14:54:04 +09:00

88 lines
2.1 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.${system} = {
default = pkgs.mkShell {
packages = with pkgs; [
(python3.withPackages (ppkgs: with ppkgs; [
beautifulsoup4
markdown2
matrix-nio
mysql-connector
requests
]))
ruff
];
};
};
packages.${system} = {
default = self.packages.${system}.pvv-calendar-bot;
pvv-calendar-bot = pkgs.python3Packages.buildPythonPackage {
name = "pvv-calendar-bot";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./pyproject.toml
./src
];
};
pyproject = true;
build-system = [ pkgs.python3Packages.setuptools ];
dependencies = with pkgs.python3Packages; [
beautifulsoup4
markdown2
matrix-nio
mysql-connector
requests
];
};
};
checks = {
inherit (self.packages.${system}) pvv-calender-bot;
};
nixosModules.default = ./module.nix;
overlays.default = final: prev: {
inherit (self.packages.${system}) pvv-calendar-bot;
};
nixosConfigurations."test" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.default
{ nixpkgs.overlays = [ self.overlays.default ]; }
{
boot.isContainer = true;
services.pvv-calendar-bot = {
enable = true;
settings.matrix = {
channel = "testchannel";
user = "testuser";
homeserver = "pvv.ntnu.no";
};
settings.database = {
host = "localhost";
user = "testuser";
passwordFile = pkgs.writeText "calendarDbPass" "oliveoil";
};
settings.secretsFile = pkgs.writeText "calendarSecrets" "snakeoil";
};
}
];
};
};
}