feat: add bandcamp-collection-downloader
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
95bf1530f5
commit
7d1a057641
5 changed files with 71 additions and 2 deletions
56
modules/nixos/bandcamp-collection-downloader.nix
Normal file
56
modules/nixos/bandcamp-collection-downloader.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.bandcamp-collection-downloader;
|
||||
in
|
||||
{
|
||||
options.services.bandcamp-collection-downloader = {
|
||||
enable = mkEnableOption "Bandcamp Collection Downloader";
|
||||
|
||||
bandcampUser = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
cookiesFile = mkOption {
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
downloadFolder = mkOption {
|
||||
type = types.str;
|
||||
default = "/data/bandcamp";
|
||||
};
|
||||
|
||||
audioFormat = mkOption {
|
||||
type = types.str;
|
||||
default = "flac";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.bandcampcd = {
|
||||
enable = true;
|
||||
isSystemUser = true;
|
||||
group = "bandcampcd";
|
||||
};
|
||||
users.groups.bandcampcd = { };
|
||||
|
||||
systemd.services."bandcamp-collection-downloader" = {
|
||||
description = "Synchronize Bandcamp library";
|
||||
requires = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writers.writeBash "bandcamp-sync" ''
|
||||
${pkgs.bandcamp-collection-downloader}/bin/bandcamp-collection-downloader ${cfg.bandcampUser} \
|
||||
--cookies-file ${cfg.cookiesFile} \
|
||||
--download-folder ${cfg.downloadFolder} \
|
||||
--audio-format ${cfg.audioFormat}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
# my-module = import ./my-module.nix
|
||||
bandcamp-collection-downloader = import ./bandcamp-collection-downloader.nix;
|
||||
namespaced-vpn = import ./namespaced-vpn.nix;
|
||||
storagebox = import ./storagebox.nix;
|
||||
wrtagweb = import ./wrtagweb.nix;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue