users/foo-dogsquared: add custom-homepage config and proper ports state

This commit is contained in:
Gabriel Arazas 2024-09-03 18:09:33 +08:00
parent f544f3b93f
commit 6a0a697ffe
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
5 changed files with 61 additions and 5 deletions

View File

@ -22,6 +22,25 @@ in
email.thunderbird.enable = true;
research.enable = true;
vs-code.enable = true;
custom-homepage = {
enable = true;
sections.services = lib.mkMerge [
{
name = "Local services";
flavorText = "For your local productivity";
textOnly = true;
weight = (-50);
}
(lib.mkIf config.services.archivebox.webserver.enable {
links = lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.archivebox-webserver.value}";
text = "Archive webserver";
};
})
];
};
};
setups = {

View File

@ -4,8 +4,6 @@
let
userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.browsers;
homepage = pkgs.callPackage ../../files/homepage/package.nix { };
in
{
options.users.foo-dogsquared.programs.browsers = {
@ -132,7 +130,8 @@ in
# Some quality of lifes.
"browser.search.widget.inNavBar" = true;
"browser.search.openintab" = true;
"browser.startup.homepage" = "file://${homepage}";
"browser.startup.homepage" =
lib.mkIf userCfg.programs.custom-homepage.enable "file://${userCfg.programs.custom-homepage.finalPackage}";
# Some privacy settings...
"privacy.donottrackheader.enabled" = true;

View File

@ -10,6 +10,8 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [
{
state.ports.syncthing.value = 8384;
home.packages = with pkgs; [
anki # Rise, rinse, and repeat.
#archivebox # The ultimate archiving solution created by a pirate!
@ -26,11 +28,22 @@ in
zotero # It's actually good at archiving despite not being a researcher myself.
];
services.syncthing.enable = true;
services.syncthing = {
enable = true;
extraOptions = [
"--gui-address=http://localhost:${builtins.toString config.state.ports.syncthing.value}"
];
};
xdg.mimeApps.defaultApplications = {
"application/vnd.anki" = [ "anki.desktop" ];
};
users.foo-dogsquared.programs.custom-homepage.sections.services.links =
lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.syncthing.value}";
text = "Local sync server";
};
}
(lib.mkIf userCfg.programs.shell.enable {

View File

@ -10,6 +10,8 @@ in
lib.mkEnableOption "a set of usual desktop productivity services";
config = lib.mkIf cfg.enable {
state.ports.activitywatch.value = 5600;
# Install all of the desktop stuff.
suites.desktop = {
enable = true;
@ -29,6 +31,7 @@ in
# Self-inflicted telemetry.
services.activitywatch = {
enable = true;
settings.server.port = config.state.ports.activitywatch.value;
watchers = {
aw-watcher-afk.package = pkgs.activitywatch;
aw-watcher-window.package = pkgs.activitywatch;
@ -73,5 +76,10 @@ in
};
};
};
users.foo-dogsquared.programs.custom-homepage.sections.services.links = lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.activitywatch.value}";
text = "Telemetry server";
};
};
}

View File

@ -96,9 +96,20 @@ in
"vlc.memory_dump"
"vlc.mru"
];
# Set every music-related services from the encompassing NixOS
# configuration.
users.foo-dogsquared.programs.custom-homepage.sections.services.links = lib.mkMerge [
(lib.mkIf (attrs.nixosConfig.services.gonic.enable or false) (lib.singleton {
url = "http://localhost:${builtins.toString attrs.nixosConfig.state.ports.gonic.value}";
text = "Subsonic music server";
}))
];
}
(lib.mkIf cfg.mpd.enable {
state.ports.mopidy.value = 6680;
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [
@ -114,7 +125,7 @@ in
settings = {
http = {
hostname = "127.0.0.1";
port = 6680;
port = config.state.ports.mopidy.value;
default_app = "iris";
};
@ -158,6 +169,12 @@ in
enable = true;
mpdMusicDir = musicDir;
};
# Set this to the custom homepage.
users.foo-dogsquared.programs.custom-homepage.sections.services.links = lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.mopidy.value}";
text = "Music streaming server";
};
})
]);
}