Local homepage
Basically the same thing as currently online, except templated, and trimmed from useless stuff, but needs modernization.
This commit is contained in:
parent
8d07123713
commit
e26fa6a011
4 changed files with 230 additions and 8 deletions
107
hm/desktop/browser/homepage.nix
Normal file
107
hm/desktop/browser/homepage.nix
Normal file
|
@ -0,0 +1,107 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# TODO ForkAwesome is deprecated, find something else
|
||||
fa = pkgs.fetchFromGitHub {
|
||||
owner = "ForkAwesome";
|
||||
repo = "Fork-Awesome";
|
||||
rev = "1.2.0";
|
||||
sha256 = "sha256-zG6/0dWjU7/y/oDZuSEv+54Mchng64LVyV8bluskYzc=";
|
||||
};
|
||||
data = config.frogeye.homepage // {
|
||||
sections = builtins.attrValues config.frogeye.homepage.sections;
|
||||
css = ./homepage.css;
|
||||
fa_css = "${fa}/css/fork-awesome.min.css";
|
||||
};
|
||||
# Blatantly stolen from https://pablo.tools/blog/computers/nix-mustache-templates/
|
||||
homepage = builtins.toString (
|
||||
pkgs.stdenv.mkDerivation {
|
||||
|
||||
name = "homepage.html";
|
||||
|
||||
nativeBuildInpts = [ pkgs.mustache-go ];
|
||||
|
||||
passAsFile = [ "jsonData" ];
|
||||
jsonData = builtins.toJSON data;
|
||||
|
||||
phases = [
|
||||
"buildPhase"
|
||||
"installPhase"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
${pkgs.mustache-go}/bin/mustache $jsonDataPath ${./homepage.html.mustache} > homepage.html
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp homepage.html $out
|
||||
'';
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
config.programs = {
|
||||
firefox.profiles.hm.settings."browser.startup.homepage" = homepage;
|
||||
qutebrowser.settings.url = {
|
||||
start_pages = homepage;
|
||||
default_page = homepage;
|
||||
};
|
||||
};
|
||||
options.frogeye.homepage = {
|
||||
sections = lib.mkOption {
|
||||
default = { };
|
||||
description = "Folders used by users";
|
||||
# Top-level so Syncthing can work for all users. Also there's no real home-manager syncthing module.
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule (
|
||||
{ config, name, ... }:
|
||||
{
|
||||
options = {
|
||||
title = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Section title";
|
||||
};
|
||||
color = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "#337ab7";
|
||||
};
|
||||
image = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
};
|
||||
links = lib.mkOption {
|
||||
default = [ ];
|
||||
type = lib.types.listOf (
|
||||
lib.types.submodule (
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Link";
|
||||
};
|
||||
url = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "about:blank";
|
||||
};
|
||||
icon = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "question-circle";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue