mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-04-01 17:50:51 +02:00
Added status page
This commit is contained in:
parent
48c36bbd4c
commit
a42a771ece
7 changed files with 88 additions and 0 deletions
1
base.nix
1
base.nix
|
@ -30,6 +30,7 @@
|
||||||
rxvt_unicode
|
rxvt_unicode
|
||||||
xorg.xbacklight
|
xorg.xbacklight
|
||||||
neovim
|
neovim
|
||||||
|
tinystatus
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.variables.EDITOR = "nvim";
|
environment.variables.EDITOR = "nvim";
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
outputs = { self, home-manager, nixpkgs, unstable, sops-nix, neovim-nightly-overlay, nur, ... }@inputs:
|
outputs = { self, home-manager, nixpkgs, unstable, sops-nix, neovim-nightly-overlay, nur, ... }@inputs:
|
||||||
let
|
let
|
||||||
utils = import ./utils.nix { inherit nixpkgs sops-nix home-manager inputs; nixpkgs-unstable = unstable; };
|
utils = import ./utils.nix { inherit nixpkgs sops-nix home-manager inputs; nixpkgs-unstable = unstable; };
|
||||||
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
in
|
in
|
||||||
with utils;
|
with utils;
|
||||||
{
|
{
|
||||||
|
@ -42,5 +43,6 @@
|
||||||
(builtins.attrNames (builtins.readDir ./modules)));
|
(builtins.attrNames (builtins.readDir ./modules)));
|
||||||
|
|
||||||
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
|
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
|
||||||
|
packages."x86_64-linux".tinystatus = import ./packages/tinystatus { inherit pkgs; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,13 @@
|
||||||
subdomain = "ci";
|
subdomain = "ci";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
status = {
|
||||||
|
enable = true;
|
||||||
|
nginx = {
|
||||||
|
enable = true;
|
||||||
|
subdomain = "status";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.maxJobs = lib.mkDefault 8;
|
nix.maxJobs = lib.mkDefault 8;
|
||||||
|
|
4
modules/status/checks.csv
Normal file
4
modules/status/checks.csv
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
http, 200, Homepage, https://julienmalka.me
|
||||||
|
http, 200, CI, https://ci.julienmalka.me
|
||||||
|
ping, 0, Newton, newton.julienmalka.me
|
||||||
|
|
|
48
modules/status/default.nix
Normal file
48
modules/status/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{ lib, pkgs, config, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.luj.status;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
options.luj.jackett = {
|
||||||
|
enable = mkEnableOption "activate status page";
|
||||||
|
nginx.enable = mkEnableOption "activate nginx";
|
||||||
|
nginx.subdomain = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (
|
||||||
|
mkMerge [{
|
||||||
|
systemd = {
|
||||||
|
timers.simple-timer = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
partOf = [ "tinystatus.service" ];
|
||||||
|
timerConfig.OnCalendar = "minutely";
|
||||||
|
};
|
||||||
|
services.tinystatus = {
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script = ''
|
||||||
|
mkdir -p /var/www/status
|
||||||
|
${pkgs.tinystatus}/bin/tinystatus ${./checks.csv} > /var/www/status/index.html
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
(mkIf cfg.nginx.enable {
|
||||||
|
luj.nginx.enable = true;
|
||||||
|
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
root = "/var/www/status/";
|
||||||
|
};
|
||||||
|
|
||||||
|
})]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
25
packages/tinystatus/default.nix
Normal file
25
packages/tinystatus/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
with pkgs;
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "tinystatus";
|
||||||
|
version = "1.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub{
|
||||||
|
owner = "bderenzo";
|
||||||
|
repo = "tinystatus";
|
||||||
|
rev="fc128adf240261ac99ea3e3be8d65a92eda52a73";
|
||||||
|
sha256= "FvQwibm6F10l9/U3RnNTGu+C2JjHOwbv62VxXAfI7/s=";
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
patchShebangs .
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin/
|
||||||
|
mv tinystatus $out/bin/
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ in
|
||||||
overlay-unstable
|
overlay-unstable
|
||||||
(final: prev:
|
(final: prev:
|
||||||
{
|
{
|
||||||
|
tinystatus = prev.pkgs.callPackage ./packages/tinystatus {};
|
||||||
mosh = prev.mosh.overrideAttrs (old: {
|
mosh = prev.mosh.overrideAttrs (old: {
|
||||||
patches = (prev.lib.take 1 old.patches) ++ (prev.lib.sublist 4 4 old.patches);
|
patches = (prev.lib.take 1 old.patches) ++ (prev.lib.sublist 4 4 old.patches);
|
||||||
postPatch = '''';
|
postPatch = '''';
|
||||||
|
|
Loading…
Add table
Reference in a new issue