mirror of
https://github.com/nix-community/home-manager
synced 2024-12-18 07:49:48 +01:00
freetube: add module
This commit is contained in:
parent
f8e6694eda
commit
3c0df2a7e4
7 changed files with 112 additions and 0 deletions
|
@ -1561,6 +1561,17 @@ in {
|
|||
https://github.com/ErikReider/SwayNotificationCenter for more.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-04-30T18:28:28+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.freetube'.
|
||||
|
||||
FreeTube is a YouTube client built around using YouTube more
|
||||
privately. You can enjoy your favorite content and creators without
|
||||
your habits being tracked. See https://freetubeapp.io/ for more.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ let
|
|||
./programs/firefox.nix
|
||||
./programs/fish.nix
|
||||
./programs/foot.nix
|
||||
./programs/freetube.nix
|
||||
./programs/fuzzel.nix
|
||||
./programs/fzf.nix
|
||||
./programs/gallery-dl.nix
|
||||
|
|
60
modules/programs/freetube.nix
Normal file
60
modules/programs/freetube.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
concatStringsSep mapAttrsToList mkIf mkEnableOption mkPackageOption mkOption
|
||||
literalExpression;
|
||||
|
||||
cfg = config.programs.freetube;
|
||||
|
||||
settings = settings:
|
||||
let
|
||||
convertSetting = name: value:
|
||||
builtins.toJSON {
|
||||
"_id" = name;
|
||||
"value" = value;
|
||||
};
|
||||
in concatStringsSep "\n" (mapAttrsToList convertSetting settings) + "\n";
|
||||
in {
|
||||
meta.maintainers = with lib.maintainers; [ vonixxx ];
|
||||
|
||||
options.programs.freetube = {
|
||||
enable = mkEnableOption "FreeTube, a YT client for Windows, Mac, and Linux";
|
||||
|
||||
package = mkPackageOption pkgs "freetube" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
allowDashAv1Formats = true;
|
||||
checkForUpdates = false;
|
||||
defaultQuality = "1080";
|
||||
baseTheme = "catppuccinMocha";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration settings for FreeTube.
|
||||
|
||||
All configurable options can be deduced by enabling them through the
|
||||
GUI and observing the changes in {file}`settings.db`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."FreeTube/hm_settings.db" = {
|
||||
source = pkgs.writeText "hm_settings.db" (settings cfg.settings);
|
||||
|
||||
onChange = let
|
||||
hmSettingsDb = "${config.xdg.configHome}/FreeTube/hm_settings.db";
|
||||
settingsDb = "${config.xdg.configHome}/FreeTube/settings.db";
|
||||
in ''
|
||||
run install -Dm644 $VERBOSE_ARG '${hmSettingsDb}' '${settingsDb}'
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -190,6 +190,7 @@ in import nmtSrc {
|
|||
./modules/programs/boxxy
|
||||
./modules/programs/firefox
|
||||
./modules/programs/foot
|
||||
./modules/programs/freetube
|
||||
./modules/programs/fuzzel
|
||||
./modules/programs/getmail
|
||||
./modules/programs/gnome-terminal
|
||||
|
|
8
tests/modules/programs/freetube/basic-configuration.db
Normal file
8
tests/modules/programs/freetube/basic-configuration.db
Normal file
|
@ -0,0 +1,8 @@
|
|||
{"_id":"allowDashAv1Formats","value":true}
|
||||
{"_id":"checkForBlogPosts","value":false}
|
||||
{"_id":"checkForUpdates","value":false}
|
||||
{"_id":"commentAutoLoadEnabled","value":true}
|
||||
{"_id":"defaultQuality","value":"1080"}
|
||||
{"_id":"hideHeaderLogo","value":true}
|
||||
{"_id":"listType","value":"list"}
|
||||
{"_id":"useRssFeeds","value":true}
|
30
tests/modules/programs/freetube/basic-configuration.nix
Normal file
30
tests/modules/programs/freetube/basic-configuration.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.freetube = {
|
||||
enable = true;
|
||||
settings = {
|
||||
useRssFeeds = true;
|
||||
hideHeaderLogo = true;
|
||||
allowDashAv1Formats = true;
|
||||
commentAutoLoadEnabled = true;
|
||||
|
||||
checkForUpdates = false;
|
||||
checkForBlogPosts = false;
|
||||
|
||||
listType = "list";
|
||||
defaultQuality = "1080";
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.freetube = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/FreeTube/hm_settings.db
|
||||
assertFileContent home-files/.config/FreeTube/hm_settings.db \
|
||||
${./basic-configuration.db}
|
||||
|
||||
assertFileContains activate \
|
||||
"install -Dm644 \$VERBOSE_ARG '/home/hm-user/.config/FreeTube/hm_settings.db' '/home/hm-user/.config/FreeTube/settings.db'"
|
||||
'';
|
||||
}
|
1
tests/modules/programs/freetube/default.nix
Normal file
1
tests/modules/programs/freetube/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ freetube-basic-configuration = ./basic-configuration.nix; }
|
Loading…
Reference in a new issue