grzegorz/flake.nix

71 lines
2.0 KiB
Nix
Raw Normal View History

2022-08-27 22:27:55 +02:00
{
description = "A REST API for managing a MPV instance over via a RPC socket";
2023-08-17 20:39:22 +02:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2022-08-27 22:27:55 +02:00
2023-08-17 20:39:22 +02:00
outputs = {
self,
nixpkgs,
...
} @ inputs:
let
forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.legacyPackages.${system}.lib;
});
forAllSystems = forSystems [
"x86_64-linux"
"aarch64-linux"
#"riscv64-linux"
];
in {
2022-08-27 22:27:55 +02:00
2023-08-17 20:39:22 +02:00
packages = forAllSystems ({ system, pkgs, ...}: rec {
sanic-openapi = with pkgs.python3.pkgs; buildPythonPackage rec {
pname = "sanic-openapi";
version = "21.12.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-fNpiI00IyWX3OeqsawWejyRNhwYdlzNcVyh/1q4Wv1I=";
2022-08-27 22:27:55 +02:00
};
2023-08-17 20:39:22 +02:00
propagatedBuildInputs = [ sanic pyyaml ];
doCheck = false;
};
grzegorz = with pkgs.python3.pkgs; buildPythonPackage {
pname = "grzegorz";
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.version;
format = "pyproject";
src = ./.;
postInstall = ''
'';
nativeBuildInputs = [ poetry-core ];
propagatedBuildInputs = [ sanic sanic-openapi youtube-dl mpv ];
doCheck = false;
};
grzegorz-run = pkgs.writeShellApplication {
name = "grzegorz-run";
runtimeInputs = [ grzegorz pkgs.mpv ];
text = ''
TOOMANYARGS=()
if test -z "$*"; then
>&2 echo "DEBUG: No args provided, running with defaults...."
TOOMANYARGS=("--host" "::" "--port" "8080")
fi
(
set -x
sanic grzegorz.app "''${TOOMANYARGS[@]}" "$@"
)
'';
};
});
apps = forAllSystems ({ system, pkgs, ...}: {
default.type = "app";
default.program = "${self.packages.${system}.grzegorz-run}/bin/grzegorz-run";
});
};
2022-08-27 22:27:55 +02:00
}