mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-17 06:59:46 +03:00
Merge pull request #243094 from jnsgruk/homepage
homepage: init at 0.6.21
This commit is contained in:
commit
641b814a44
6 changed files with 155 additions and 0 deletions
|
@ -646,6 +646,7 @@
|
||||||
./services/misc/greenclip.nix
|
./services/misc/greenclip.nix
|
||||||
./services/misc/headphones.nix
|
./services/misc/headphones.nix
|
||||||
./services/misc/heisenbridge.nix
|
./services/misc/heisenbridge.nix
|
||||||
|
./services/misc/homepage-dashboard.nix
|
||||||
./services/misc/ihaskell.nix
|
./services/misc/ihaskell.nix
|
||||||
./services/misc/input-remapper.nix
|
./services/misc/input-remapper.nix
|
||||||
./services/misc/irkerd.nix
|
./services/misc/irkerd.nix
|
||||||
|
|
55
nixos/modules/services/misc/homepage-dashboard.nix
Normal file
55
nixos/modules/services/misc/homepage-dashboard.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{ config
|
||||||
|
, pkgs
|
||||||
|
, lib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.homepage-dashboard;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.homepage-dashboard = {
|
||||||
|
enable = lib.mkEnableOption (lib.mdDoc "Homepage Dashboard");
|
||||||
|
|
||||||
|
package = lib.mkPackageOptionMD pkgs "homepage-dashboard" { };
|
||||||
|
|
||||||
|
openFirewall = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = lib.mdDoc "Open ports in the firewall for Homepage.";
|
||||||
|
};
|
||||||
|
|
||||||
|
listenPort = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 8082;
|
||||||
|
description = lib.mdDoc "Port for Homepage to bind to.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.homepage-dashboard = {
|
||||||
|
description = "Homepage Dashboard";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
HOMEPAGE_CONFIG_DIR = "/var/lib/homepage-dashboard";
|
||||||
|
PORT = "${toString cfg.listenPort}";
|
||||||
|
};
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
DynamicUser = true;
|
||||||
|
StateDirectory = "homepage-dashboard";
|
||||||
|
ExecStart = "${lib.getExe cfg.package}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [ cfg.listenPort ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -337,6 +337,7 @@ in {
|
||||||
hbase3 = handleTest ./hbase.nix { package=pkgs.hbase3; };
|
hbase3 = handleTest ./hbase.nix { package=pkgs.hbase3; };
|
||||||
hedgedoc = handleTest ./hedgedoc.nix {};
|
hedgedoc = handleTest ./hedgedoc.nix {};
|
||||||
herbstluftwm = handleTest ./herbstluftwm.nix {};
|
herbstluftwm = handleTest ./herbstluftwm.nix {};
|
||||||
|
homepage-dashboard = handleTest ./homepage-dashboard.nix {};
|
||||||
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
|
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
|
||||||
invidious = handleTest ./invidious.nix {};
|
invidious = handleTest ./invidious.nix {};
|
||||||
oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {};
|
oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {};
|
||||||
|
|
14
nixos/tests/homepage-dashboard.nix
Normal file
14
nixos/tests/homepage-dashboard.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import ./make-test-python.nix ({ lib, ... }: {
|
||||||
|
name = "homepage-dashboard";
|
||||||
|
meta.maintainers = with lib.maintainers; [ jnsgruk ];
|
||||||
|
|
||||||
|
nodes.machine = { pkgs, ... }: {
|
||||||
|
services.homepage-dashboard.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("homepage-dashboard.service")
|
||||||
|
machine.wait_for_open_port(8082)
|
||||||
|
machine.succeed("curl --fail http://localhost:8082/")
|
||||||
|
'';
|
||||||
|
})
|
82
pkgs/servers/homepage-dashboard/default.nix
Normal file
82
pkgs/servers/homepage-dashboard/default.nix
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
{ buildNpmPackage
|
||||||
|
, fetchFromGitHub
|
||||||
|
, nodePackages
|
||||||
|
, python3
|
||||||
|
, lib
|
||||||
|
, fetchpatch
|
||||||
|
, makeBinaryWrapper
|
||||||
|
, nixosTests
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildNpmPackage rec {
|
||||||
|
pname = "homepage-dashboard";
|
||||||
|
version = "0.6.21";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "benphelps";
|
||||||
|
repo = "homepage";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-kjxA02hJj/GAQ0fM1xTtXAnZSQgVyE+EMRrXis1Vr+o=";
|
||||||
|
};
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-O6SQYx5vxscMsbWv0ynUYqdUkOp/nMtdvlZ/Mp95sBY=";
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(fetchpatch {
|
||||||
|
name = "env-config-dir.patch";
|
||||||
|
url = "https://github.com/benphelps/homepage/commit/ca396ce96bce52f6c06a321f292aa94a66ceeb97.patch";
|
||||||
|
hash = "sha256-eNnW/ce4ytoKR6jH1Ztc4UTWOmL0uGRdY6nYBIVYM6k=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
mkdir -p config
|
||||||
|
'';
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
# Add a shebang to the server js file, then patch the shebang.
|
||||||
|
sed -i '1s|^|#!/usr/bin/env node\n|' .next/standalone/server.js
|
||||||
|
patchShebangs .next/standalone/server.js
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
nodePackages.node-gyp-build
|
||||||
|
];
|
||||||
|
|
||||||
|
env.PYTHON = "${python3}/bin/python";
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r .next/standalone $out/bin
|
||||||
|
cp -r public $out/bin/public
|
||||||
|
|
||||||
|
mkdir -p $out/bin/.next
|
||||||
|
cp -r .next/static $out/bin/.next/static
|
||||||
|
|
||||||
|
mv $out/bin/server.js $out/bin/homepage
|
||||||
|
chmod +x $out/bin/homepage
|
||||||
|
|
||||||
|
wrapProgram $out/bin/homepage \
|
||||||
|
--set-default PORT 3000 \
|
||||||
|
--set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
doDist = false;
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
inherit (nixosTests) homepage;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "A highly customisable dashboard with Docker and service API integrations.";
|
||||||
|
mainProgram = "homepage";
|
||||||
|
homepage = "https://gethomepage.dev";
|
||||||
|
license = lib.licenses.gpl3;
|
||||||
|
maintainers = with lib.maintainers; [ jnsgruk ];
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
};
|
||||||
|
}
|
|
@ -5374,6 +5374,8 @@ with pkgs;
|
||||||
|
|
||||||
home-manager = callPackage ../tools/package-management/home-manager { };
|
home-manager = callPackage ../tools/package-management/home-manager { };
|
||||||
|
|
||||||
|
homepage-dashboard = callPackage ../servers/homepage-dashboard { };
|
||||||
|
|
||||||
hostsblock = callPackage ../tools/misc/hostsblock { };
|
hostsblock = callPackage ../tools/misc/hostsblock { };
|
||||||
|
|
||||||
hottext = callPackage ../tools/text/hottext { };
|
hottext = callPackage ../tools/text/hottext { };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue