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"
|
"osx-kvm": "osx-kvm"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1708168451,
|
"lastModified": 1727105240,
|
||||||
"narHash": "sha256-loWlwexnfQGFsEHeJbXpWbnmeDFkBwZB38+4BkUcGhM=",
|
"narHash": "sha256-FEuqbcZ4TDUMwCpTA/E3J5L7pLD4U+zXPnZbmXSmaJo=",
|
||||||
"owner": "aciceri",
|
"owner": "MatthewCroughan",
|
||||||
"repo": "NixThePlanet",
|
"repo": "NixThePlanet",
|
||||||
"rev": "e8c91035d01f5082ccf30e351dcd993a5b480a72",
|
"rev": "2f622af217807da78e44a5a15f620743dac57f46",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "aciceri",
|
"owner": "MatthewCroughan",
|
||||||
"ref": "nix-in-darwin",
|
|
||||||
"repo": "NixThePlanet",
|
"repo": "NixThePlanet",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
};
|
};
|
||||||
dream2nix.url = "github:nix-community/dream2nix";
|
dream2nix.url = "github:nix-community/dream2nix";
|
||||||
nixThePlanet = {
|
nixThePlanet = {
|
||||||
url = "github:aciceri/NixThePlanet/nix-in-darwin";
|
url = "github:MatthewCroughan/NixThePlanet/";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
nixDarwin = {
|
nixDarwin = {
|
||||||
|
|
|
@ -10,30 +10,4 @@
|
||||||
platformTheme.name = lib.mkForce "kvantum";
|
platformTheme.name = lib.mkForce "kvantum";
|
||||||
style.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,
|
pkgs,
|
||||||
secrets,
|
secrets,
|
||||||
|
fleetFlake,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -175,9 +177,6 @@
|
||||||
compose = {
|
compose = {
|
||||||
no-attachment-warning = "^[^>]*attach(ed|ment)";
|
no-attachment-warning = "^[^>]*attach(ed|ment)";
|
||||||
};
|
};
|
||||||
triggers = {
|
|
||||||
email-received = ''exec notify-send "New email from %n" "%s"'';
|
|
||||||
};
|
|
||||||
filters = {
|
filters = {
|
||||||
"text/plain" = "colorize";
|
"text/plain" = "colorize";
|
||||||
"text/html" = "html";
|
"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.email = {
|
||||||
accounts.autistici = {
|
accounts.autistici = {
|
||||||
aerc.enable = true;
|
aerc.enable = true;
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
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";
|
Restart = "on-failure";
|
||||||
RestartSec = 3;
|
RestartSec = 3;
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,9 +44,11 @@
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
inputs.nixosHardware.nixosModules.lenovo-thinkpad-x1-7th-gen
|
inputs.nixosHardware.nixosModules.lenovo-thinkpad-x1-7th-gen
|
||||||
inputs.lix-module.nixosModules.default
|
inputs.lix-module.nixosModules.default
|
||||||
|
inputs.catppuccin.nixosModules.catppuccin
|
||||||
];
|
];
|
||||||
extraHmModules = [
|
extraHmModules = [
|
||||||
"${inputs.homeManagerGitWorkspace}/modules/services/git-workspace.nix"
|
"${inputs.homeManagerGitWorkspace}/modules/services/git-workspace.nix"
|
||||||
|
inputs.catppuccin.homeManagerModules.catppuccin
|
||||||
];
|
];
|
||||||
secrets = {
|
secrets = {
|
||||||
"kirk-wireguard-private-key" = { };
|
"kirk-wireguard-private-key" = { };
|
||||||
|
@ -90,6 +92,7 @@
|
||||||
|
|
||||||
sisko = {
|
sisko = {
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
|
enableHomeManager = false;
|
||||||
vpn = {
|
vpn = {
|
||||||
ip = "10.100.0.1";
|
ip = "10.100.0.1";
|
||||||
publicKey = "bc5giljukT1+ChbbyTLdOfejfR3c8RZ4XoXmQM54nTY=";
|
publicKey = "bc5giljukT1+ChbbyTLdOfejfR3c8RZ4XoXmQM54nTY=";
|
||||||
|
@ -101,7 +104,6 @@
|
||||||
];
|
];
|
||||||
secrets = {
|
secrets = {
|
||||||
"sisko-wireguard-private-key" = { };
|
"sisko-wireguard-private-key" = { };
|
||||||
"cachix-personal-token".owner = "ccr";
|
|
||||||
"home-planimetry".owner = "hass";
|
"home-planimetry".owner = "hass";
|
||||||
"home-assistant-token".owner = "prometheus";
|
"home-assistant-token".owner = "prometheus";
|
||||||
"grafana-password".owner = "grafana";
|
"grafana-password".owner = "grafana";
|
||||||
|
@ -123,6 +125,10 @@
|
||||||
ip = "10.100.0.4";
|
ip = "10.100.0.4";
|
||||||
publicKey = "9ccx4C4xvPC6lPgTZAHDSfK4FS2BP2i4D57u9IZjw18=";
|
publicKey = "9ccx4C4xvPC6lPgTZAHDSfK4FS2BP2i4D57u9IZjw18=";
|
||||||
};
|
};
|
||||||
|
macos-ventura = {
|
||||||
|
ip = "10.100.0.6";
|
||||||
|
publicKey = "/Eee1V0PsjZSzj7un1NxHKtFR+TpUIgJ7VAdIAzmvzQ=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
fleetModules,
|
fleetModules,
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -9,7 +8,6 @@
|
||||||
fleetModules [
|
fleetModules [
|
||||||
"common"
|
"common"
|
||||||
"ssh"
|
"ssh"
|
||||||
"ccr"
|
|
||||||
"wireguard-server"
|
"wireguard-server"
|
||||||
"mediatomb"
|
"mediatomb"
|
||||||
"transmission"
|
"transmission"
|
||||||
|
@ -35,32 +33,12 @@
|
||||||
./disko.nix
|
./disko.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_8;
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_10;
|
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";
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = "schedutil";
|
powerManagement.cpuFreqGovernor = "schedutil";
|
||||||
|
|
||||||
ccr.enable = true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = "aarch64-linux";
|
nixpkgs.hostPlatform = "aarch64-linux";
|
||||||
|
|
||||||
swapDevices = [ ];
|
swapDevices = [ ];
|
||||||
|
@ -98,7 +76,6 @@
|
||||||
"/var/log"
|
"/var/log"
|
||||||
"/var/lib/containers"
|
"/var/lib/containers"
|
||||||
"/var/lib/postgresql"
|
"/var/lib/postgresql"
|
||||||
"/home/${config.ccr.username}/.ssh"
|
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
{ fleetFlake, ... }:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
services.macos-ventura = {
|
services.macos-ventura = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cores = 8;
|
cores = 8;
|
||||||
threads = 8;
|
threads = 8;
|
||||||
mem = "8G";
|
mem = "16G";
|
||||||
vncListenAddr = "0.0.0.0";
|
vncListenAddr = "0.0.0.0";
|
||||||
|
sshListenAddr = "127.0.0.1";
|
||||||
extraQemuFlags = [ "-nographic" ];
|
extraQemuFlags = [ "-nographic" ];
|
||||||
sshPort = 2021;
|
sshPort = 2022;
|
||||||
installNix = true;
|
vncDisplayNumber = 1; # means port 59001
|
||||||
stateless = true;
|
stateless = false;
|
||||||
darwinConfig = fleetFlake.darwinConfigurations.archer;
|
openFirewall = true;
|
||||||
|
autoStart = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.ssh.extraConfig = lib.mkAfter ''
|
||||||
|
Host macos-ventura
|
||||||
|
Hostname localhost
|
||||||
|
Port 2022
|
||||||
|
Compression yes
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
HostKey /ssh_initrd_host_ed25519_key
|
HostKey /ssh_initrd_host_ed25519_key
|
||||||
'';
|
'';
|
||||||
authorizedKeys = with (import ../../lib).keys.users; [
|
authorizedKeys = with (import ../../lib).keys; [
|
||||||
ccr-gpg
|
users.ccr-gpg
|
||||||
ccr-ssh
|
users.ccr-ssh
|
||||||
|
hosts.sisko
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,8 +45,6 @@
|
||||||
"d /mnt/hd/torrent/.incomplete 770 transmission transmission"
|
"d /mnt/hd/torrent/.incomplete 770 transmission transmission"
|
||||||
];
|
];
|
||||||
|
|
||||||
ccr.extraGroups = [ "transmission" ];
|
|
||||||
|
|
||||||
environment.persistence."/persist".directories = [
|
environment.persistence."/persist".directories = [
|
||||||
config.services.transmission.home
|
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