style: format
This commit is contained in:
parent
0c6aa5730a
commit
4537c86d4d
6 changed files with 86 additions and 74 deletions
34
default.nix
34
default.nix
|
@ -1,6 +1,7 @@
|
|||
{ sources ? import ./npins
|
||||
, nixpkgs ? sources.nixpkgs
|
||||
, pkgs ? import nixpkgs { overlays = [ (import ./overlay.nix) ]; }
|
||||
{
|
||||
sources ? import ./npins,
|
||||
nixpkgs ? sources.nixpkgs,
|
||||
pkgs ? import nixpkgs { overlays = [ (import ./overlay.nix) ]; },
|
||||
}:
|
||||
rec {
|
||||
shell = pkgs.mkShell {
|
||||
|
@ -9,13 +10,22 @@ rec {
|
|||
pkgs.ruff
|
||||
];
|
||||
};
|
||||
python = pkgs.python3.withPackages (ps: [ ps.mypy ps.click ps.click-log ps.uptime-kuma-api ]);
|
||||
evalModules = (pkgs.lib.evalModules {
|
||||
modules = [
|
||||
./nixos/module.nix
|
||||
({ lib, ... }: {
|
||||
_module.args.pkgs = lib.mkDefault pkgs;
|
||||
})
|
||||
];
|
||||
}).extendModules;
|
||||
python = pkgs.python3.withPackages (ps: [
|
||||
ps.mypy
|
||||
ps.click
|
||||
ps.click-log
|
||||
ps.uptime-kuma-api
|
||||
]);
|
||||
evalModules =
|
||||
(pkgs.lib.evalModules {
|
||||
modules = [
|
||||
./nixos/module.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
_module.args.pkgs = lib.mkDefault pkgs;
|
||||
}
|
||||
)
|
||||
];
|
||||
}).extendModules;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
probesFormat = pkgs.formats.json {};
|
||||
probesFormat = pkgs.formats.json { };
|
||||
cfg = config.statelessUptimeKuma;
|
||||
in
|
||||
{
|
||||
|
@ -13,15 +18,15 @@ in
|
|||
probesConfig = {
|
||||
monitors = lib.mkOption {
|
||||
inherit (probesFormat) type;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
tags = lib.mkOption {
|
||||
inherit (probesFormat) type;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
notifications = lib.mkOption {
|
||||
inherit (probesFormat) type;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,65 +3,63 @@ let
|
|||
data = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
version = data.version;
|
||||
|
||||
mkSource = spec:
|
||||
assert spec ? type; let
|
||||
mkSource =
|
||||
spec:
|
||||
assert spec ? type;
|
||||
let
|
||||
path =
|
||||
if spec.type == "Git"
|
||||
then mkGitSource spec
|
||||
else if spec.type == "GitRelease"
|
||||
then mkGitSource spec
|
||||
else if spec.type == "PyPi"
|
||||
then mkPyPiSource spec
|
||||
else if spec.type == "Channel"
|
||||
then mkChannelSource spec
|
||||
else builtins.throw "Unknown source type ${spec.type}";
|
||||
if spec.type == "Git" then
|
||||
mkGitSource spec
|
||||
else if spec.type == "GitRelease" then
|
||||
mkGitSource spec
|
||||
else if spec.type == "PyPi" then
|
||||
mkPyPiSource spec
|
||||
else if spec.type == "Channel" then
|
||||
mkChannelSource spec
|
||||
else
|
||||
builtins.throw "Unknown source type ${spec.type}";
|
||||
in
|
||||
spec // {outPath = path;};
|
||||
spec // { outPath = path; };
|
||||
|
||||
mkGitSource = {
|
||||
repository,
|
||||
revision,
|
||||
url ? null,
|
||||
hash,
|
||||
...
|
||||
}:
|
||||
mkGitSource =
|
||||
{
|
||||
repository,
|
||||
revision,
|
||||
url ? null,
|
||||
hash,
|
||||
...
|
||||
}:
|
||||
assert repository ? type;
|
||||
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
|
||||
# In the latter case, there we will always be an url to the tarball
|
||||
if url != null
|
||||
then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else
|
||||
assert repository.type == "Git";
|
||||
builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
# hash = hash;
|
||||
};
|
||||
if url != null then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else
|
||||
assert repository.type == "Git";
|
||||
builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
# hash = hash;
|
||||
};
|
||||
|
||||
mkPyPiSource = {
|
||||
url,
|
||||
hash,
|
||||
...
|
||||
}:
|
||||
mkPyPiSource =
|
||||
{ url, hash, ... }:
|
||||
builtins.fetchurl {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkChannelSource = {
|
||||
url,
|
||||
hash,
|
||||
...
|
||||
}:
|
||||
mkChannelSource =
|
||||
{ url, hash, ... }:
|
||||
builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
in
|
||||
if version == 3
|
||||
then builtins.mapAttrs (_: mkSource) data.pins
|
||||
else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
||||
if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
||||
|
|
|
@ -1 +1 @@
|
|||
(import ./. {}).shell
|
||||
(import ./. { }).shell
|
||||
|
|
|
@ -11,6 +11,4 @@ let
|
|||
};
|
||||
};
|
||||
in
|
||||
((import ../. {}).evalModules {
|
||||
modules = [ module ];
|
||||
}).config.statelessUptimeKuma.build.json
|
||||
((import ../. { }).evalModules { modules = [ module ]; }).config.statelessUptimeKuma.build.json
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchFromGitHub
|
||||
, setuptools
|
||||
, wheel
|
||||
, packaging
|
||||
, python-socketio
|
||||
, requests
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
wheel,
|
||||
packaging,
|
||||
python-socketio,
|
||||
requests,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
|
|
Loading…
Reference in a new issue