mirror of
https://github.com/Death916/nixconfig.git
synced 2026-04-10 02:54:39 -07:00
c2csrape modules
This commit is contained in:
parent
95ffd056e5
commit
75b8b4babb
3 changed files with 93 additions and 0 deletions
50
modules/c2cscrape.nix
Normal file
50
modules/c2cscrape.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.c2cscrape;
|
||||
# Import the package relative to this file
|
||||
c2cscrapePkg = pkgs.callPackage ../pkgs/c2cscrape/default.nix { };
|
||||
in
|
||||
{
|
||||
options.services.c2cscrape = {
|
||||
enable = lib.mkEnableOption "C2C Scraper Service";
|
||||
|
||||
dataDir = lib.mkOption {
|
||||
type = lib.types.Path;
|
||||
default = "/var/lib/c2cscrape";
|
||||
description = "Directory where episodes will be saved.";
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.Str;
|
||||
default = "c2cscrape";
|
||||
description = "user to run as";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# 1. The Service
|
||||
systemd.services.c2cscrape = {
|
||||
description = "Coast 2 Coast Scraper Service";
|
||||
unitConfig.RequiresMountsFor = cfg.dataDir;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${c2cscrapePkg}/bin/c2cscrape";
|
||||
User = cfg.user;
|
||||
WorkingDirectory = cfg.dataDir;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
systemd.timers.c2cscrape = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
RandomizedDelaySec = "5m";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -14,6 +14,11 @@
|
|||
arrSuite.enable = true;
|
||||
services.samba.shares.Media.path = "/media/storage/media";
|
||||
|
||||
services.c2cscrape = {
|
||||
enable = true;
|
||||
dataDir = "/media/storage/media/books/audio/podcasts/C2C";
|
||||
user = "death916";
|
||||
};
|
||||
# virtualisation.incus.enable = true;
|
||||
services.qbittorrent = {
|
||||
enable = true;
|
||||
|
|
|
|||
38
pkgs/c2cscrape/default.nix
Normal file
38
pkgs/c2cscrape/default.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, requests
|
||||
, beautifulsoup4
|
||||
, lxml
|
||||
, feedgen
|
||||
, pytz
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "c2cscrape";
|
||||
version = "0.1.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "death916";
|
||||
repo = "c2cscrape";
|
||||
rev = "b61b888b229d646859976f8fb69e59c17c8c27a4";
|
||||
hash = "sha256-oVuLGHds2zT/QzlFUaBzS73hwF28Wm03XwrOQbKrgdo=";
|
||||
};
|
||||
|
||||
format = "other";
|
||||
|
||||
propagatedBuildInputs = [
|
||||
requests
|
||||
beautifulsoup4
|
||||
lxml
|
||||
feedgen
|
||||
pytz
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
install -Dm755 src/c2cscrape.py $out/bin/c2cscrape
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue