mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
users/foo-dogsquared/programs/custom-homepage: init
YOOOOOOOOO! This is cool, a Nix-configurable homepage (made with Hugo) by taking advantage of the way how data are merged within the virtual filesystem, hell yeah. Aaaaaand... its novelty wears off a minute later in my setup because Tridactyl needs to override the tab. :/
This commit is contained in:
parent
cff4e0de43
commit
f544f3b93f
@ -11,6 +11,7 @@
|
|||||||
./programs/jujutsu.nix
|
./programs/jujutsu.nix
|
||||||
./programs/keys.nix
|
./programs/keys.nix
|
||||||
./programs/nixvim
|
./programs/nixvim
|
||||||
|
./programs/custom-homepage.nix
|
||||||
./programs/research.nix
|
./programs/research.nix
|
||||||
./programs/shell.nix
|
./programs/shell.nix
|
||||||
./programs/terminal-multiplexer.nix
|
./programs/terminal-multiplexer.nix
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
userCfg = config.users.foo-dogsquared;
|
||||||
|
cfg = userCfg.programs.custom-homepage;
|
||||||
|
|
||||||
|
settingsFormat = pkgs.formats.toml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.users.foo-dogsquared.programs.custom-homepage = {
|
||||||
|
enable = lib.mkEnableOption "addition of custom homepage";
|
||||||
|
|
||||||
|
sections = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf settingsFormat.type;
|
||||||
|
description = ''
|
||||||
|
List of additional sections with their settings to be configured
|
||||||
|
alongside the hardcoded sections.
|
||||||
|
'';
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
services = {
|
||||||
|
name = "Local services";
|
||||||
|
flavorText = "for the local productivity";
|
||||||
|
textOnly = true;
|
||||||
|
|
||||||
|
links = lib.singleton {
|
||||||
|
url = "localhost:''${builtins.toString config.services.mopidy.settings.port}";
|
||||||
|
text = "Music streaming server";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
description = ''
|
||||||
|
The package derivation of the website.
|
||||||
|
'';
|
||||||
|
default = pkgs.callPackage ../../files/homepage/package.nix { };
|
||||||
|
};
|
||||||
|
|
||||||
|
finalPackage = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
description = ''
|
||||||
|
Output derivation containing the website with all of its modifications.
|
||||||
|
'';
|
||||||
|
readOnly = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
users.foo-dogsquared.programs.custom-homepage.finalPackage =
|
||||||
|
let
|
||||||
|
data = lib.mapAttrs (n: v:
|
||||||
|
settingsFormat.generate "fds-homepage-section-${n}" v) cfg.sections;
|
||||||
|
|
||||||
|
installDataDir = lib.foldlAttrs (acc: n: v: ''
|
||||||
|
${acc}
|
||||||
|
install -Dm0644 ${v} './data/foodogsquared-homepage/links/${n}.toml'
|
||||||
|
'') "" data;
|
||||||
|
in
|
||||||
|
cfg.package.overrideAttrs (prevAttrs: {
|
||||||
|
preBuild = (prevAttrs.preBuild or "") + ''
|
||||||
|
${installDataDir}
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user