Compare commits
6 commits
9df249c52d
...
5658f13955
Author | SHA1 | Date | |
---|---|---|---|
5658f13955 | |||
916cc95918 | |||
1d4f9fecdc | |||
9c9cc992b8 | |||
af395cafcb | |||
60b8c06011 |
12 changed files with 104 additions and 72 deletions
11
flake.lock
generated
11
flake.lock
generated
|
@ -675,16 +675,15 @@
|
|||
"osx-kvm": "osx-kvm"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1708168451,
|
||||
"narHash": "sha256-loWlwexnfQGFsEHeJbXpWbnmeDFkBwZB38+4BkUcGhM=",
|
||||
"owner": "aciceri",
|
||||
"lastModified": 1727105240,
|
||||
"narHash": "sha256-FEuqbcZ4TDUMwCpTA/E3J5L7pLD4U+zXPnZbmXSmaJo=",
|
||||
"owner": "MatthewCroughan",
|
||||
"repo": "NixThePlanet",
|
||||
"rev": "e8c91035d01f5082ccf30e351dcd993a5b480a72",
|
||||
"rev": "2f622af217807da78e44a5a15f620743dac57f46",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "aciceri",
|
||||
"ref": "nix-in-darwin",
|
||||
"owner": "MatthewCroughan",
|
||||
"repo": "NixThePlanet",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
};
|
||||
dream2nix.url = "github:nix-community/dream2nix";
|
||||
nixThePlanet = {
|
||||
url = "github:aciceri/NixThePlanet/nix-in-darwin";
|
||||
url = "github:MatthewCroughan/NixThePlanet/";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixDarwin = {
|
||||
|
|
|
@ -10,30 +10,4 @@
|
|||
platformTheme.name = lib.mkForce "kvantum";
|
||||
style.name = lib.mkForce "kvantum";
|
||||
};
|
||||
|
||||
# TODO move away
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
font = {
|
||||
normal = {
|
||||
family = "Fira Code";
|
||||
style = "Regular";
|
||||
};
|
||||
bold = {
|
||||
family = "Fira Code";
|
||||
style = "Bold";
|
||||
};
|
||||
italic = {
|
||||
family = "Cascadia Code";
|
||||
style = "Italic";
|
||||
};
|
||||
bold_italic = {
|
||||
family = "Fira Code";
|
||||
style = "Bold Italic";
|
||||
};
|
||||
size = 13;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
pkgs,
|
||||
secrets,
|
||||
fleetFlake,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
@ -175,9 +177,6 @@
|
|||
compose = {
|
||||
no-attachment-warning = "^[^>]*attach(ed|ment)";
|
||||
};
|
||||
triggers = {
|
||||
email-received = ''exec notify-send "New email from %n" "%s"'';
|
||||
};
|
||||
filters = {
|
||||
"text/plain" = "colorize";
|
||||
"text/html" = "html";
|
||||
|
@ -188,6 +187,18 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.emails-watcher = {
|
||||
Unit.Description = "Send notifications when new emails arrive";
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${lib.getExe fleetFlake.packages.${pkgs.system}.emails-watcher}";
|
||||
Environment = [ "INBOX_NEW=~/Maildir/autistici/Inbox/new" ];
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email = {
|
||||
accounts.autistici = {
|
||||
aerc.enable = true;
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "sleep 5 && ${lib.getExe pkgs.zmkBATx}";
|
||||
ExecStart = ''
|
||||
${pkgs.runtimeShell} -l -c "${lib.getExe' pkgs.busybox "sleep"} 5 && ${lib.getExe pkgs.zmkBATx}"
|
||||
'';
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
|
|
|
@ -44,9 +44,11 @@
|
|||
inputs.disko.nixosModules.disko
|
||||
inputs.nixosHardware.nixosModules.lenovo-thinkpad-x1-7th-gen
|
||||
inputs.lix-module.nixosModules.default
|
||||
inputs.catppuccin.nixosModules.catppuccin
|
||||
];
|
||||
extraHmModules = [
|
||||
"${inputs.homeManagerGitWorkspace}/modules/services/git-workspace.nix"
|
||||
inputs.catppuccin.homeManagerModules.catppuccin
|
||||
];
|
||||
secrets = {
|
||||
"kirk-wireguard-private-key" = { };
|
||||
|
@ -90,6 +92,7 @@
|
|||
|
||||
sisko = {
|
||||
system = "aarch64-linux";
|
||||
enableHomeManager = false;
|
||||
vpn = {
|
||||
ip = "10.100.0.1";
|
||||
publicKey = "bc5giljukT1+ChbbyTLdOfejfR3c8RZ4XoXmQM54nTY=";
|
||||
|
@ -101,7 +104,6 @@
|
|||
];
|
||||
secrets = {
|
||||
"sisko-wireguard-private-key" = { };
|
||||
"cachix-personal-token".owner = "ccr";
|
||||
"home-planimetry".owner = "hass";
|
||||
"home-assistant-token".owner = "prometheus";
|
||||
"grafana-password".owner = "grafana";
|
||||
|
@ -123,6 +125,10 @@
|
|||
ip = "10.100.0.4";
|
||||
publicKey = "9ccx4C4xvPC6lPgTZAHDSfK4FS2BP2i4D57u9IZjw18=";
|
||||
};
|
||||
macos-ventura = {
|
||||
ip = "10.100.0.6";
|
||||
publicKey = "/Eee1V0PsjZSzj7un1NxHKtFR+TpUIgJ7VAdIAzmvzQ=";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
fleetModules,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
@ -9,7 +8,6 @@
|
|||
fleetModules [
|
||||
"common"
|
||||
"ssh"
|
||||
"ccr"
|
||||
"wireguard-server"
|
||||
"mediatomb"
|
||||
"transmission"
|
||||
|
@ -35,32 +33,12 @@
|
|||
./disko.nix
|
||||
];
|
||||
|
||||
# boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_8;
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_10;
|
||||
# boot.kernelPackages = let
|
||||
# pkgs = fleetFlake.inputs.nixpkgsForSisko.legacyPackages.aarch64-linux;
|
||||
# in
|
||||
# pkgs.linuxPackagesFor pkgs.linux_testing;
|
||||
# boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_6_9.override {
|
||||
# argsOverride = {
|
||||
# src = pkgs.fetchFromGitLab {
|
||||
# domain = "gitlab.collabora.com";
|
||||
# owner = "hardware-enablement/rockchip-3588";
|
||||
# repo = "linux";
|
||||
# rev = "23bb9c65a88c114bbe945b7ef5366bb02d3d9b80";
|
||||
# sha256 = "sha256-6TygOl5r7/N2jlcPznWlvJfVVeXKSR8yMoGuTDbIdTA=";
|
||||
# };
|
||||
# version = "6.9";
|
||||
# modDirVersion = "6.9.0";
|
||||
# };
|
||||
# });
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
|
||||
powerManagement.cpuFreqGovernor = "schedutil";
|
||||
|
||||
ccr.enable = true;
|
||||
|
||||
nixpkgs.hostPlatform = "aarch64-linux";
|
||||
|
||||
swapDevices = [ ];
|
||||
|
@ -98,7 +76,6 @@
|
|||
"/var/log"
|
||||
"/var/lib/containers"
|
||||
"/var/lib/postgresql"
|
||||
"/home/${config.ccr.username}/.ssh"
|
||||
];
|
||||
files = [
|
||||
"/etc/machine-id"
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
{ fleetFlake, ... }:
|
||||
{ lib, ... }:
|
||||
{
|
||||
services.macos-ventura = {
|
||||
enable = true;
|
||||
cores = 8;
|
||||
threads = 8;
|
||||
mem = "8G";
|
||||
mem = "16G";
|
||||
vncListenAddr = "0.0.0.0";
|
||||
sshListenAddr = "127.0.0.1";
|
||||
extraQemuFlags = [ "-nographic" ];
|
||||
sshPort = 2021;
|
||||
installNix = true;
|
||||
stateless = true;
|
||||
darwinConfig = fleetFlake.darwinConfigurations.archer;
|
||||
sshPort = 2022;
|
||||
vncDisplayNumber = 1; # means port 59001
|
||||
stateless = false;
|
||||
openFirewall = true;
|
||||
autoStart = false;
|
||||
};
|
||||
|
||||
programs.ssh.extraConfig = lib.mkAfter ''
|
||||
Host macos-ventura
|
||||
Hostname localhost
|
||||
Port 2022
|
||||
Compression yes
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
extraConfig = ''
|
||||
HostKey /ssh_initrd_host_ed25519_key
|
||||
'';
|
||||
authorizedKeys = with (import ../../lib).keys.users; [
|
||||
ccr-gpg
|
||||
ccr-ssh
|
||||
authorizedKeys = with (import ../../lib).keys; [
|
||||
users.ccr-gpg
|
||||
users.ccr-ssh
|
||||
hosts.sisko
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
"d /mnt/hd/torrent/.incomplete 770 transmission transmission"
|
||||
];
|
||||
|
||||
ccr.extraGroups = [ "transmission" ];
|
||||
|
||||
environment.persistence."/persist".directories = [
|
||||
config.services.transmission.home
|
||||
];
|
||||
|
|
12
packages/emails-watcher/default.nix
Normal file
12
packages/emails-watcher/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
writers,
|
||||
python3Packages,
|
||||
...
|
||||
}:
|
||||
writers.writePython3Bin "emails-watcher" {
|
||||
libraries = with python3Packages; [
|
||||
watchdog
|
||||
desktop-notifier
|
||||
];
|
||||
flakeIgnore = [ ];
|
||||
} (builtins.readFile ./emails-watcher.py)
|
43
packages/emails-watcher/emails-watcher.py
Normal file
43
packages/emails-watcher/emails-watcher.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
import os
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from email import message_from_file
|
||||
from desktop_notifier import DesktopNotifierSync, DEFAULT_SOUND, Icon
|
||||
|
||||
|
||||
class MaildirHandler(FileSystemEventHandler):
|
||||
def __init__(self, notifier):
|
||||
super().__init__()
|
||||
self.notifier = notifier
|
||||
|
||||
def on_created(self, event):
|
||||
if not event.is_directory:
|
||||
print(f"New email found: {event.src_path}")
|
||||
with open(event.src_path, 'r') as email_file:
|
||||
msg = message_from_file(email_file)
|
||||
print(f'{msg["From"]}: {msg["Subject"]}')
|
||||
self.notifier.send(
|
||||
title=msg["From"],
|
||||
message=msg["Subject"],
|
||||
sound=DEFAULT_SOUND,
|
||||
icon=Icon(name="mail-message-new"),
|
||||
timeout=20
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
maildir_new = os.path.expanduser(os.environ.get("INBOX_NEW"))
|
||||
notifier = DesktopNotifierSync(
|
||||
app_name="Mails",
|
||||
notification_limit=10
|
||||
)
|
||||
|
||||
event_handler = MaildirHandler(notifier)
|
||||
observer = Observer()
|
||||
|
||||
observer.schedule(event_handler, maildir_new, recursive=False)
|
||||
|
||||
print(f"Monitoring {maildir_new} for new emails...")
|
||||
|
||||
observer.start()
|
||||
observer.join()
|
Loading…
Add table
Reference in a new issue