add a2ln server

This commit is contained in:
Dmitriy Kholkin 2022-11-21 02:54:56 +03:00
parent ed13e85157
commit 24573a42ef
5 changed files with 62 additions and 0 deletions

View File

@ -4,6 +4,7 @@
inputs.self.nixosRoles.workstation
inputs.self.nixosProfiles.stable-diffusion
inputs.self.nixosProfiles.a2ln-server
# inputs.self.nixosModules.passthrough
];

View File

@ -4,6 +4,7 @@ with config.deviceSpecific; {
home-manager.users.alukard.home.packages = with pkgs; [
# cli
a2ln
bat
comma
curl

View File

@ -5,6 +5,10 @@ let
config = config.nixpkgs.config;
localSystem = { inherit system; };
});
stable = import inputs.nixpkgs-stable ({
config = config.nixpkgs.config;
localSystem = { inherit system; };
});
roundcube-plugins = import ./packages/roundcube-plugins/default.nix;
in
with lib; {
@ -21,6 +25,7 @@ with lib; {
android-emulator = self.callPackage ./packages/android-emulator.nix { };
arkenfox-userjs = pkgs.callPackage ./packages/arkenfox-userjs.nix { arkenfox-repo = inputs.arkenfox-userjs; };
a2ln = pkgs.callPackage ./packages/a2ln.nix { };
bibata-cursors-tokyonight = pkgs.callPackage ./packages/bibata-cursors-tokyonight.nix { };
ceserver = pkgs.callPackage ./packages/ceserver.nix { };
hyprpaper = pkgs.callPackage ./packages/hyprpaper.nix { src = inputs.hyprpaper; };

View File

@ -0,0 +1,38 @@
{ lib, python3, fetchFromGitHub, writeText, libnotify, gobject-introspection, wrapGAppsHook }:
let
version = "1.1.4";
setup-py = writeText "setup.py" ''
from distutils.core import setup
setup(
name='a2ln',
version='${version}',
scripts=['a2ln'],
)
'';
in python3.pkgs.buildPythonApplication rec {
inherit version;
pname = "a2ln";
src = fetchFromGitHub {
repo = "a2ln-server";
owner = "patri9ck";
rev = version;
sha256 = "1lh8wbrhcdaqy1dhg13ay7s4hip7g911fbb5h0v3a99kzgn6vl1m";
};
preBuild = ''
cp ${setup-py} setup.py
'';
propagatedBuildInputs = with python3.pkgs; [
pillow pygobject3 setproctitle pyzmq qrcode
wrapGAppsHook libnotify gobject-introspection
];
strictDeps = false;
meta = with lib; {
description = "A way to display Android phone notifications on Linux (Server)";
license = licenses.gpl3;
};
}

View File

@ -0,0 +1,17 @@
{ pkgs, ... }: {
systemd.user.services.a2ln-server = rec {
serviceConfig = {
TimeoutStartSec = 0;
TimeoutStopSec = 10;
Type = "simple";
Restart = "always";
};
script = ''
${pkgs.a2ln}/bin/a2ln --pairing-port 23046 23045
'';
after = [ "graphical-session.target" ];
wants = after;
wantedBy = [ "multi-user.target" ];
};
networking.firewall.allowedTCPPorts = [ 23045 23046 ];
}