mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-05 16:41:04 +01:00
treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce conflicts with other PRs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
bda9deb791
commit
86402a17b6
424 changed files with 15 additions and 15 deletions
96
modules/services/glance.nix
Normal file
96
modules/services/glance.nix
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.glance;
|
||||
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
mkIf
|
||||
getExe
|
||||
;
|
||||
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
|
||||
settingsFile = settingsFormat.generate "glance.yml" cfg.settings;
|
||||
|
||||
configFilePath = "${config.xdg.configHome}/glance/glance.yml";
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ pkgs.lib.maintainers.gepbird ];
|
||||
|
||||
options.services.glance = {
|
||||
enable = mkEnableOption "glance";
|
||||
|
||||
package = mkPackageOption pkgs "glance" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = {
|
||||
pages = [
|
||||
{
|
||||
name = "Calendar";
|
||||
columns = [
|
||||
{
|
||||
size = "full";
|
||||
widgets = [ { type = "calendar"; } ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
example = {
|
||||
server.port = 5678;
|
||||
pages = [
|
||||
{
|
||||
name = "Home";
|
||||
columns = [
|
||||
{
|
||||
size = "full";
|
||||
widgets = [
|
||||
{ type = "calendar"; }
|
||||
{
|
||||
type = "weather";
|
||||
location = "London, United Kingdom";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
description = ''
|
||||
Configuration written to a yaml file that is read by glance. See
|
||||
<https://github.com/glanceapp/glance/blob/main/docs/configuration.md>
|
||||
for more.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.glance" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."glance/glance.yml".source = settingsFile;
|
||||
|
||||
systemd.user.services.glance = lib.mkIf (cfg.package != null) {
|
||||
Unit = {
|
||||
Description = "Glance feed dashboard server";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
|
||||
Service.ExecStart = "${getExe cfg.package} --config ${configFilePath}";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue