Skip to content

Commit

Permalink
home/liferea: init module
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodachi94 committed Dec 6, 2024
1 parent a55df26 commit b710371
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 5 deletions.
1 change: 0 additions & 1 deletion home/common/desktop-standalone-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pkgs.discord
pkgs.obsidian
pkgs.spotube
pkgs.liferea
bitwarden-dmenu.packages.${pkgs.system}.bwmenu
];
}
1 change: 1 addition & 0 deletions home/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
./i3status-rust
./kdeconnect.nix
./kitty
./liferea
./network-manager-applet.nix
./volnoti.nix
./xdg.nix
Expand Down
8 changes: 8 additions & 0 deletions home/linux/liferea/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ config, ... }:
{
imports = [ ./module.nix ];

programs.liferea = {
enable = config.local.system.linux && config.local.eagerSetup.enableGraphicalApps;
};
}
77 changes: 77 additions & 0 deletions home/linux/liferea/module.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{ pkgs, lib, config, ... }:
let
cfg = config.programs.liferea;
in
{

options.programs.liferea = {
enable = lib.mkEnableOption "Liferea, a Linux feed reader";
package = lib.mkPackageOption pkgs "liferea" { };

style = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Text to be written to {file}`$XDG_CONFIG_DIR/liferea/style.css`.";
};

settings = lib.mkOption {
type = lib.types.submodule {
freeformType = lib.types.attrsOf lib.types.anything;
options = {};
};
default = {};
description = ''
Liferea settings.
These values are passed directly to the dconf `/org/gnome/liferea`
subkey.
Canonical list of settings:
https://github.com/lwindolf/liferea/blob/master/net.sf.liferea.gschema.xml.in
'';
};

plugins = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
description = ''
A list of packages containing Liferea plugins.
The packages will be combined into one directory and placed
into {file}`$XDG_DATA_DIR/liferea/plugins/`.
Each package should have a file with the .plugin extension
at its root, following the default format.
More information:
https://github.com/lwindolf/liferea/blob/master/plugins/README.md
'';
};
};

config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];

xdg.mimeApps.defaultAssociations = {
# FIXME: Is the absolute path necessary when we append to home.packages?
# Also: Is this too eager?
"application/rss+xml" = "${cfg.package}/share/applications/net.sourceforge.liferea.desktop";
"application/atom+xml" = "${cfg.package}/share/applications/net.sourceforge.liferea.desktop";
"application/rdf+xml" = "${cfg.package}/share/applications/net.sourceforge.liferea.desktop";
"x-scheme-handler/feed" = "${cfg.package}/share/applications/net.sourceforge.liferea.desktop";
};

dconf.settings."org/gnome/liferea" = cfg.settings;

xdg.configFile."liferea/style.css" = lib.mkIf (cfg.style != "") {
text = cfg.style;
};

xdg.dataFile."liferea/plugins" = lib.mkIf (cfg.plugins != [ ]) {
source = pkgs.symlinkJoin {
name = "liferea-plugins";
paths = cfg.plugins;
};
};
};
}
4 changes: 0 additions & 4 deletions home/linux/xdg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
# TODO: Split into modules and conditionally enable these rules if the application is enabled
"x-scheme-handler/https" = "/etc/profiles/per-user/me/share/applications/librewolf.desktop";
"x-scheme-handler/http" = "/etc/profiles/per-user/me/share/applications/librewolf.desktop";
"application/rss+xml" = "${pkgs.liferea}/share/applications/net.sourceforge.liferea.desktop";
"application/atom+xml" = "${pkgs.liferea}/share/applications/net.sourceforge.liferea.desktop";
"application/rdf+xml" = "${pkgs.liferea}/share/applications/net.sourceforge.liferea.desktop";
"x-scheme-handler/feed" = "${pkgs.liferea}/share/applications/net.sourceforge.liferea.desktop";
};
};
configFile."user-dirs.locale" = lib.mkIf config.local.system.linux {
Expand Down

0 comments on commit b710371

Please sign in to comment.