pkgs: Add homer
and dashboard-icons
homer: https://github.com/bastienwirtz/homer dashboard-icons: https://github.com/bastienwirtz/homer Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
bc31aab711
commit
3ab77b338a
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -1 +1,2 @@
|
||||||
flake.lock binary
|
flake.lock binary
|
||||||
|
package-lock.json binary
|
||||||
|
|
19
pkgs/dashboard-icons.nix
Normal file
19
pkgs/dashboard-icons.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{ stdenvNoCC, fetchFromGitHub }:
|
||||||
|
|
||||||
|
stdenvNoCC.mkDerivation rec {
|
||||||
|
pname = "dashboard-icons";
|
||||||
|
version = "29d0ff765c8b363b741f2f026aeb58a0c790178b";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "walkxcode";
|
||||||
|
repo = pname;
|
||||||
|
rev = version;
|
||||||
|
hash = "sha256-t2d/MfimXO1RgVlGF0jFKwmWy153bWJ/al7/A1Irtg0=";
|
||||||
|
};
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p $out/share
|
||||||
|
cp -vr png $out/share
|
||||||
|
cp -vr svg $out/share
|
||||||
|
'';
|
||||||
|
}
|
|
@ -2,4 +2,6 @@ _: super:
|
||||||
|
|
||||||
{
|
{
|
||||||
git-multi-shortlog = super.callPackage ./git-multi-shortlog.nix { };
|
git-multi-shortlog = super.callPackage ./git-multi-shortlog.nix { };
|
||||||
|
homer = super.callPackage ./homer { };
|
||||||
|
dashboard-icons = super.callPackage ./dashboard-icons.nix { };
|
||||||
}
|
}
|
||||||
|
|
32
pkgs/homer/default.nix
Normal file
32
pkgs/homer/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ buildNpmPackage, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildNpmPackage rec {
|
||||||
|
pname = "homer";
|
||||||
|
version = "23.02.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "bastienwirtz";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-ploHidePqYpZm4NRPbRlljpnIjBlkwUsgOPROInC730=";
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
cp ${./package-lock.json} package-lock.json
|
||||||
|
'';
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
rm -v dist/assets/*.dist
|
||||||
|
rm -v dist/assets/*.sample
|
||||||
|
rm -v dist/assets/*.sample-sui
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out/share
|
||||||
|
cp -vr dist $out/share/www
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-jVc+Cjpv0kP0D07kZT81zS0GQ+rVyq6i6BCsk8pcA8c=";
|
||||||
|
}
|
6098
pkgs/homer/package-lock.json
generated
Normal file
6098
pkgs/homer/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
56
services/homer.nix
Normal file
56
services/homer.nix
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.homer;
|
||||||
|
configFile =
|
||||||
|
pkgs.writeText "homer-config.yml" (generators.toYAML { } cfg.settings);
|
||||||
|
|
||||||
|
in {
|
||||||
|
options.services.homer = {
|
||||||
|
enable = mkEnableOption "Whether to enable the Homer dashboard nginx vhost";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "homer" { };
|
||||||
|
|
||||||
|
virtualHost = {
|
||||||
|
name = mkOption {
|
||||||
|
description = "Name of the vhost to configure homer for.";
|
||||||
|
default = "localhost";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
location = mkOption {
|
||||||
|
description = "Path to serve homer at.";
|
||||||
|
default = "/";
|
||||||
|
type = types.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
description = mdDoc ''
|
||||||
|
Configuration for the Homer dashboard.
|
||||||
|
|
||||||
|
See the [Homer documentation](https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md)
|
||||||
|
for more information.
|
||||||
|
'';
|
||||||
|
default = { };
|
||||||
|
type = types.attrs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.nginx.virtualHosts.${cfg.virtualHost.name} = {
|
||||||
|
locations.${cfg.virtualHost.location}.root = "${pkgs.homer}/share/www";
|
||||||
|
locations."= ${
|
||||||
|
removeSuffix "/" cfg.virtualHost.location
|
||||||
|
}/assets/config.yml" = {
|
||||||
|
root = "${dirOf configFile}";
|
||||||
|
tryFiles = "/${baseNameOf configFile} =404";
|
||||||
|
extraConfig = ''
|
||||||
|
expires -1;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue