mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00:00
glance: add module
This commit is contained in:
parent
f50e2779ed
commit
7e68e55d2e
10 changed files with 167 additions and 0 deletions
|
@ -1692,6 +1692,17 @@ in {
|
|||
allows you to override this name.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-06-28T14:18:16+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.glance'.
|
||||
|
||||
Glance is a self-hosted dashboard that puts all your feeds in
|
||||
one place. See https://github.com/glanceapp/glance for more.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -301,6 +301,7 @@ let
|
|||
./services/fusuma.nix
|
||||
./services/getmail.nix
|
||||
./services/git-sync.nix
|
||||
./services/glance.nix
|
||||
./services/gnome-keyring.nix
|
||||
./services/gpg-agent.nix
|
||||
./services/grobi.nix
|
||||
|
|
77
modules/services/glance.nix
Normal file
77
modules/services/glance.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{ 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 = [ cfg.package ];
|
||||
|
||||
xdg.configFile."glance/glance.yml".source = settingsFile;
|
||||
|
||||
systemd.user.services.glance = {
|
||||
Unit = {
|
||||
Description = "Glance feed dashboard server";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
|
||||
Service.ExecStart = "${getExe cfg.package} --config ${configFilePath}";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -241,6 +241,7 @@ in import nmtSrc {
|
|||
./modules/services/fnott
|
||||
./modules/services/fusuma
|
||||
./modules/services/git-sync
|
||||
./modules/services/glance
|
||||
./modules/services/gpg-agent
|
||||
./modules/services/gromit-mpx
|
||||
./modules/services/home-manager-auto-upgrade
|
||||
|
|
15
tests/modules/services/glance/default-settings.nix
Normal file
15
tests/modules/services/glance/default-settings.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.glance.enable = true;
|
||||
|
||||
test.stubs.glance = { };
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/glance/glance.yml
|
||||
serviceFile=home-files/.config/systemd/user/glance.service
|
||||
|
||||
assertFileContent $configFile ${./glance-default-config.yml}
|
||||
assertFileContent $serviceFile ${./glance.service}
|
||||
'';
|
||||
}
|
4
tests/modules/services/glance/default.nix
Normal file
4
tests/modules/services/glance/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
glance-default-settings = ./default-settings.nix;
|
||||
glance-example-settings = ./example-settings.nix;
|
||||
}
|
33
tests/modules/services/glance/example-settings.nix
Normal file
33
tests/modules/services/glance/example-settings.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.glance = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server.port = 5678;
|
||||
pages = [{
|
||||
name = "Home";
|
||||
columns = [{
|
||||
size = "full";
|
||||
widgets = [
|
||||
{ type = "calendar"; }
|
||||
{
|
||||
type = "weather";
|
||||
location = "London, United Kingdom";
|
||||
}
|
||||
];
|
||||
}];
|
||||
}];
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.glance = { };
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/glance/glance.yml
|
||||
serviceFile=home-files/.config/systemd/user/glance.service
|
||||
|
||||
assertFileContent $configFile ${./glance-example-config.yml}
|
||||
assertFileContent $serviceFile ${./glance.service}
|
||||
'';
|
||||
}
|
6
tests/modules/services/glance/glance-default-config.yml
Normal file
6
tests/modules/services/glance/glance-default-config.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
pages:
|
||||
- columns:
|
||||
- size: full
|
||||
widgets:
|
||||
- type: calendar
|
||||
name: Calendar
|
10
tests/modules/services/glance/glance-example-config.yml
Normal file
10
tests/modules/services/glance/glance-example-config.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
pages:
|
||||
- columns:
|
||||
- size: full
|
||||
widgets:
|
||||
- type: calendar
|
||||
- location: London, United Kingdom
|
||||
type: weather
|
||||
name: Home
|
||||
server:
|
||||
port: 5678
|
9
tests/modules/services/glance/glance.service
Normal file
9
tests/modules/services/glance/glance.service
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
|
||||
[Service]
|
||||
ExecStart=@glance@/bin/dummy --config /home/hm-user/.config/glance/glance.yml
|
||||
|
||||
[Unit]
|
||||
Description=Glance feed dashboard server
|
||||
PartOf=graphical-session.target
|
Loading…
Reference in a new issue