mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
acd-cli: add module
This commit is contained in:
parent
32bfbc996e
commit
b8596c1b23
7 changed files with 215 additions and 0 deletions
120
modules/programs/acd-cli.nix
Normal file
120
modules/programs/acd-cli.nix
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.acd-cli;
|
||||
iniFormat = pkgs.formats.ini { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
options.programs.acd-cli = {
|
||||
enable = mkEnableOption "acd-cli";
|
||||
package = mkPackageOption pkgs "acd-cli" { nullable = true; };
|
||||
cliSettings = mkOption {
|
||||
inherit (iniFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
download = {
|
||||
keep_corrupt = false;
|
||||
keep_incomplete = true;
|
||||
};
|
||||
|
||||
upload = {
|
||||
timeout_wait = 10;
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
CLI configuration settings for acd-cli. All the available options can be found here:
|
||||
<https://acd-cli.readthedocs.io/en/latest/configuration.html#acd-cli-ini>.
|
||||
'';
|
||||
};
|
||||
|
||||
clientSettings = mkOption {
|
||||
inherit (iniFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
endpoints = {
|
||||
filename = "endpoint_data";
|
||||
validity_duration = 259200;
|
||||
};
|
||||
|
||||
transfer = {
|
||||
fs_chunk_size = 131072;
|
||||
dl_chunk_size = 524288000;
|
||||
chunk_retries = 1;
|
||||
connection_timeout = 30;
|
||||
idle_timeout = 60;
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Client configuration settings for acd-cli. All the available options can be found here:
|
||||
<https://acd-cli.readthedocs.io/en/latest/configuration.html#acd-client-ini>.
|
||||
'';
|
||||
};
|
||||
|
||||
cacheSettings = mkOption {
|
||||
inherit (iniFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
sqlite = {
|
||||
filename = "nodes.db";
|
||||
busy_timeout = 30000;
|
||||
journal_mode = "wal";
|
||||
};
|
||||
|
||||
blacklist = {
|
||||
folders = [ ];
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Cache configuration settings for acd-cli. All the available options can be found here:
|
||||
<https://acd-cli.readthedocs.io/en/latest/configuration.html#cache-ini>.
|
||||
'';
|
||||
};
|
||||
|
||||
fuseSettings = mkOption {
|
||||
inherit (iniFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
fs.block_size = 512;
|
||||
read.open_chunk_limit = 10;
|
||||
write = {
|
||||
buffer_size = 32;
|
||||
timeout = 30;
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
FUSE configuration settings for acd-cli. All the available options can be found here:
|
||||
<https://acd-cli.readthedocs.io/en/latest/configuration.html#fuse-ini>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
xdg.configFile = {
|
||||
"acd_cli/acd_cli.ini" = mkIf (cfg.cliSettings != { }) {
|
||||
source = iniFormat.generate "acd_cli.ini" cfg.cliSettings;
|
||||
};
|
||||
"acd_cli/acd_client.ini" = mkIf (cfg.clientSettings != { }) {
|
||||
source = iniFormat.generate "acd_client.ini" cfg.clientSettings;
|
||||
};
|
||||
"acd_cli/cache.ini" = mkIf (cfg.cacheSettings != { }) {
|
||||
source = iniFormat.generate "acd_cli_cache.ini" cfg.cacheSettings;
|
||||
};
|
||||
"acd_cli/fuse.ini" = mkIf (cfg.fuseSettings != { }) {
|
||||
source = iniFormat.generate "acd_cli_fuse.ini" cfg.fuseSettings;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
tests/modules/programs/acd-cli/acd_cli.ini
Normal file
6
tests/modules/programs/acd-cli/acd_cli.ini
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[download]
|
||||
keep_corrupt=false
|
||||
keep_incomplete=true
|
||||
|
||||
[upload]
|
||||
timeout_wait=10
|
||||
10
tests/modules/programs/acd-cli/acd_client.ini
Normal file
10
tests/modules/programs/acd-cli/acd_client.ini
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[endpoints]
|
||||
filename=endpoint_data
|
||||
validity_duration=259200
|
||||
|
||||
[transfer]
|
||||
chunk_retries=1
|
||||
connection_timeout=30
|
||||
dl_chunk_size=524288000
|
||||
fs_chunk_size=131072
|
||||
idle_timeout=60
|
||||
4
tests/modules/programs/acd-cli/cache.ini
Normal file
4
tests/modules/programs/acd-cli/cache.ini
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[sqlite]
|
||||
busy_timeout=30000
|
||||
filename=nodes.db
|
||||
journal_mode=wal
|
||||
1
tests/modules/programs/acd-cli/default.nix
Normal file
1
tests/modules/programs/acd-cli/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ acd-cli-example-config = ./example-config.nix; }
|
||||
65
tests/modules/programs/acd-cli/example-config.nix
Normal file
65
tests/modules/programs/acd-cli/example-config.nix
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
programs.acd-cli = {
|
||||
enable = true;
|
||||
cliSettings = {
|
||||
download = {
|
||||
keep_corrupt = false;
|
||||
keep_incomplete = true;
|
||||
};
|
||||
|
||||
upload = {
|
||||
timeout_wait = 10;
|
||||
};
|
||||
};
|
||||
|
||||
clientSettings = {
|
||||
endpoints = {
|
||||
filename = "endpoint_data";
|
||||
validity_duration = 259200;
|
||||
};
|
||||
|
||||
transfer = {
|
||||
fs_chunk_size = 131072;
|
||||
dl_chunk_size = 524288000;
|
||||
chunk_retries = 1;
|
||||
connection_timeout = 30;
|
||||
idle_timeout = 60;
|
||||
};
|
||||
};
|
||||
|
||||
cacheSettings = {
|
||||
sqlite = {
|
||||
filename = "nodes.db";
|
||||
busy_timeout = 30000;
|
||||
journal_mode = "wal";
|
||||
};
|
||||
};
|
||||
|
||||
fuseSettings = {
|
||||
fs.block_size = 512;
|
||||
read.open_chunk_limit = 10;
|
||||
write = {
|
||||
buffer_size = 32;
|
||||
timeout = 30;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/acd_cli/acd_cli.ini
|
||||
assertFileContent home-files/.config/acd_cli/acd_cli.ini \
|
||||
${./acd_cli.ini}
|
||||
|
||||
assertFileExists home-files/.config/acd_cli/acd_client.ini
|
||||
assertFileContent home-files/.config/acd_cli/acd_client.ini \
|
||||
${./acd_client.ini}
|
||||
|
||||
assertFileExists home-files/.config/acd_cli/cache.ini
|
||||
assertFileContent home-files/.config/acd_cli/cache.ini \
|
||||
${./cache.ini}
|
||||
|
||||
assertFileExists home-files/.config/acd_cli/fuse.ini
|
||||
assertFileContent home-files/.config/acd_cli/fuse.ini \
|
||||
${./fuse.ini}
|
||||
'';
|
||||
}
|
||||
9
tests/modules/programs/acd-cli/fuse.ini
Normal file
9
tests/modules/programs/acd-cli/fuse.ini
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[fs]
|
||||
block_size=512
|
||||
|
||||
[read]
|
||||
open_chunk_limit=10
|
||||
|
||||
[write]
|
||||
buffer_size=32
|
||||
timeout=30
|
||||
Loading…
Add table
Add a link
Reference in a new issue