Compare commits
14 Commits
0c1190f39c
...
feature/se
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b0adcc020 | |||
| c480bcdd1d | |||
| 05fed3ede1 | |||
| 0a9de8d159 | |||
| 055d6ab421 | |||
| d5c6342b84 | |||
| e04dacdf65 | |||
| 7d74917bdc | |||
| 5a4ab71849 | |||
| bcebf9b376 | |||
| 0f76939983 | |||
| a1da2f5cc1 | |||
| 175da48170 | |||
| ac956ef48c |
128
flake.lock
generated
128
flake.lock
generated
@@ -3,11 +3,11 @@
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1761588595,
|
||||
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
|
||||
"lastModified": 1765121682,
|
||||
"narHash": "sha256-4VBOP18BFeiPkyhy9o4ssBNQEvfvv1kXkasAYd0+rrA=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
|
||||
"rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -43,11 +43,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764866045,
|
||||
"narHash": "sha256-0GsEtXV9OquDQ1VclQfP16cU5VZh7NEVIOjSH4UaJuM=",
|
||||
"lastModified": 1766292113,
|
||||
"narHash": "sha256-sWTtmkQujRpjWYCnZc8LWdDiCzrRlSBPrGovkZpLkBI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "f63d0fe9d81d36e5fc95497217a72e02b8b7bcab",
|
||||
"rev": "fdec8815a86db36f42fc9c8cb2931cd8485f5aed",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -64,11 +64,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764872372,
|
||||
"narHash": "sha256-uZuXRz9CzeCHsRbc2MQvKomwoX6GcFC5BUMEk3ouSFU=",
|
||||
"lastModified": 1766282146,
|
||||
"narHash": "sha256-0V/nKU93KdYGi+5LB/MVo355obBJw/2z9b2xS3bPJxY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "05a56dbf24f195c62286e3273a2671d3b4904b00",
|
||||
"rev": "61fcc9de76b88e55578eb5d79fc80f2b236df707",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -86,11 +86,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764746434,
|
||||
"narHash": "sha256-6ymFuw+Z1C90ezf8H0BP3c2JFZhJYwMq31px2StwWHU=",
|
||||
"lastModified": 1766225187,
|
||||
"narHash": "sha256-6hcaU8qtmixsaEUbjPiOFd5aJPZxAIBokl5d7dkab3k=",
|
||||
"owner": "Jovian-Experiments",
|
||||
"repo": "Jovian-NixOS",
|
||||
"rev": "b4c0b604148adacf119b89824ed26df8926ce42c",
|
||||
"rev": "bb53a85db9210204a98f771f10f1f5b4e06ccb2d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -106,11 +106,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764161084,
|
||||
"narHash": "sha256-HN84sByg9FhJnojkGGDSrcjcbeioFWoNXfuyYfJ1kBE=",
|
||||
"lastModified": 1765066094,
|
||||
"narHash": "sha256-0YSU35gfRFJzx/lTGgOt6ubP8K6LeW0vaywzNNqxkl4=",
|
||||
"owner": "nix-darwin",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "e95de00a471d07435e0527ff4db092c84998698e",
|
||||
"rev": "688427b1aab9afb478ca07989dc754fa543e03d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -148,11 +148,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764730608,
|
||||
"narHash": "sha256-FxKIa3OCSRVC23qrk7VT68vExUcmSruJ8OobVlSWOxc=",
|
||||
"lastModified": 1765841014,
|
||||
"narHash": "sha256-55V0AJ36V5Egh4kMhWtDh117eE3GOjwq5LhwxDn9eHg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "10124c58674360765adcb38c9a8b081fb72904e4",
|
||||
"rev": "be4af8042e7a61fa12fda58fe9a3b3babdefe17b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -164,11 +164,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764517877,
|
||||
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",
|
||||
"lastModified": 1765472234,
|
||||
"narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c",
|
||||
"rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -180,11 +180,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1764667669,
|
||||
"narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=",
|
||||
"lastModified": 1766070988,
|
||||
"narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "418468ac9527e799809c900eda37cbff999199b6",
|
||||
"rev": "c6245e83d836d0433170a16eb185cefe0572f8b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -196,11 +196,11 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764677808,
|
||||
"narHash": "sha256-H3lC7knbXOBrHI9hITQ7modLuX20mYJVhZORL5ioms0=",
|
||||
"lastModified": 1766201043,
|
||||
"narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1aab89277eb2d87823d5b69bae631a2496cff57a",
|
||||
"rev": "b3aad468604d3e488d627c0b43984eb60e75e782",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -256,6 +256,52 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pyproject-build-systems": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"pyproject-nix": [
|
||||
"pyproject-nix"
|
||||
],
|
||||
"uv2nix": [
|
||||
"uv2nix"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763662255,
|
||||
"narHash": "sha256-4bocaOyLa3AfiS8KrWjZQYu+IAta05u3gYZzZ6zXbT0=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "build-system-pkgs",
|
||||
"rev": "042904167604c681a090c07eb6967b4dd4dae88c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "build-system-pkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pyproject-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764134915,
|
||||
"narHash": "sha256-xaKvtPx6YAnA3HQVp5LwyYG1MaN4LLehpQI8xEdBvBY=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "pyproject.nix",
|
||||
"rev": "2c8df1383b32e5443c921f61224b198a2282a657",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "pyproject.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"google-cookie-retrieval": "google-cookie-retrieval",
|
||||
@@ -267,7 +313,33 @@
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"plasma-manager": "plasma-manager",
|
||||
"plasma-manager-unstable": "plasma-manager-unstable"
|
||||
"plasma-manager-unstable": "plasma-manager-unstable",
|
||||
"pyproject-build-systems": "pyproject-build-systems",
|
||||
"pyproject-nix": "pyproject-nix",
|
||||
"uv2nix": "uv2nix"
|
||||
}
|
||||
},
|
||||
"uv2nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"pyproject-nix": [
|
||||
"pyproject-nix"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1766021660,
|
||||
"narHash": "sha256-UUfz7qWB1Rb2KjGVCimt//Jncv3TgJwffPqbzqpkmgY=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "uv2nix",
|
||||
"rev": "19fa99be3409f55ec05e823c66c9769df7a8dd17",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "uv2nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
42
flake.nix
42
flake.nix
@@ -42,9 +42,27 @@
|
||||
url = "github:Jovian-Experiments/Jovian-NixOS";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
pyproject-nix = {
|
||||
url = "github:pyproject-nix/pyproject.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
uv2nix = {
|
||||
url = "github:pyproject-nix/uv2nix";
|
||||
inputs.pyproject-nix.follows = "pyproject-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
pyproject-build-systems = {
|
||||
url = "github:pyproject-nix/build-system-pkgs";
|
||||
inputs.pyproject-nix.follows = "pyproject-nix";
|
||||
inputs.uv2nix.follows = "uv2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-wsl, ... } @ inputs: let
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-wsl, pyproject-nix, uv2nix, pyproject-build-systems, ... } @ inputs: let
|
||||
nixosModules = [
|
||||
./roles
|
||||
] ++ [
|
||||
@@ -56,7 +74,7 @@
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
custom = prev.callPackage ./packages {};
|
||||
custom = prev.callPackage ./packages { inherit uv2nix pyproject-nix pyproject-build-systems; };
|
||||
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
||||
})
|
||||
@@ -84,7 +102,7 @@
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
custom = prev.callPackage ./packages {};
|
||||
custom = prev.callPackage ./packages { inherit uv2nix pyproject-nix pyproject-build-systems; };
|
||||
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
||||
})
|
||||
@@ -117,7 +135,7 @@
|
||||
})
|
||||
];
|
||||
};
|
||||
custom = prev.callPackage ./packages {};
|
||||
custom = prev.callPackage ./packages { inherit uv2nix pyproject-nix pyproject-build-systems; };
|
||||
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
||||
})
|
||||
@@ -220,5 +238,21 @@
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Flake apps
|
||||
apps = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
update-doomemacs = pkgs.writeShellScriptBin "update-doomemacs" ''
|
||||
export PATH="${pkgs.lib.makeBinPath [ pkgs.curl pkgs.jq pkgs.nix pkgs.git pkgs.gnused pkgs.gnugrep pkgs.coreutils ]}:$PATH"
|
||||
${builtins.readFile ./scripts/update-doomemacs.sh}
|
||||
'';
|
||||
in {
|
||||
update-doomemacs = {
|
||||
type = "app";
|
||||
program = "${update-doomemacs}/bin/update-doomemacs";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"3d-printing".enable = true;
|
||||
base.enable = true;
|
||||
desktop.enable = true;
|
||||
emacs.enable = true;
|
||||
email.enable = true;
|
||||
i3_sway.enable = true;
|
||||
office.enable = true;
|
||||
media.enable = true;
|
||||
development.enable = true;
|
||||
@@ -20,8 +23,6 @@
|
||||
kubectl.enable = true;
|
||||
tmux.enable = true;
|
||||
plasma-manager.enable = true;
|
||||
emacs.enable = true;
|
||||
i3_sway.enable = true;
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
desktop.enable = true;
|
||||
development.enable = true;
|
||||
communication.enable = true;
|
||||
email.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
media.enable = true;
|
||||
sync.enable = true;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
./communication
|
||||
./desktop
|
||||
./development
|
||||
./email
|
||||
./gaming
|
||||
./kdeconnect
|
||||
./kubectl
|
||||
|
||||
@@ -81,6 +81,45 @@ in
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# rbw vault unlock on login and resume from suspend
|
||||
systemd.user.services.rbw-unlock-on-login = {
|
||||
Unit = {
|
||||
Description = "Unlock rbw vault at login";
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.rbw}/bin/rbw unlock";
|
||||
Environment = "RBW_AGENT=${pkgs.rbw}/bin/rbw-agent";
|
||||
# KillMode = "process" prevents systemd from killing the rbw-agent daemon
|
||||
# when this oneshot service completes. The agent is spawned by rbw unlock
|
||||
# and needs to persist after the service exits.
|
||||
KillMode = "process";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.rbw-unlock-on-resume = {
|
||||
Unit = {
|
||||
Description = "Unlock rbw vault after resume from suspend";
|
||||
After = [ "suspend.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.rbw}/bin/rbw unlock";
|
||||
Environment = "RBW_AGENT=${pkgs.rbw}/bin/rbw-agent";
|
||||
# KillMode = "process" prevents systemd from killing the rbw-agent daemon
|
||||
# when this oneshot service completes. The agent is spawned by rbw unlock
|
||||
# and needs to persist after the service exits.
|
||||
KillMode = "process";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "suspend.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
# KDE environment variables for proper integration
|
||||
home.sessionVariables = {
|
||||
QT_QPA_PLATFORMTHEME = "kde";
|
||||
|
||||
@@ -8,8 +8,8 @@ let
|
||||
doomEmacs = pkgs.fetchFromGitHub {
|
||||
owner = "doomemacs";
|
||||
repo = "doomemacs";
|
||||
rev = "8f55404781edacf66fa330205533b002de3fb5ee";
|
||||
sha256 = "sha256-vHwgENjip2+AFzs4oZfnKEAJKwf5Zid7fakImvxxQUw=";
|
||||
rev = "762f47805ac2a6411e11747f86f7c19a03da326e";
|
||||
sha256 = "sha256-0w0eXGB2cgxu/hr5wTiJSZDJw0NF+fZvLbzEylH5URU=";
|
||||
};
|
||||
|
||||
# Shared emacs packages
|
||||
|
||||
@@ -159,6 +159,32 @@
|
||||
(dolist (module '("bbdb" "buffer" "elisp" "emacs" "gnus" "os" "search-and-replace" "url"))
|
||||
(gptel-tool-library-load-module module)))
|
||||
|
||||
;; Notmuch email configuration
|
||||
(after! notmuch
|
||||
(setq notmuch-search-oldest-first nil
|
||||
notmuch-show-logo nil
|
||||
notmuch-fcc-dirs "proton/Sent"
|
||||
|
||||
;; User identity
|
||||
user-mail-address "john@ogle.fyi"
|
||||
user-full-name "John Ogle"
|
||||
|
||||
;; Sending mail via msmtp
|
||||
message-send-mail-function 'message-send-mail-with-sendmail
|
||||
sendmail-program (executable-find "msmtp")
|
||||
message-sendmail-envelope-from 'header
|
||||
mail-envelope-from 'header
|
||||
mail-specify-envelope-from t
|
||||
|
||||
;; Saved searches for quick access
|
||||
notmuch-saved-searches
|
||||
'((:name "inbox" :query "tag:inbox" :key "i")
|
||||
(:name "unread" :query "tag:unread" :key "u")
|
||||
(:name "flagged" :query "tag:flagged" :key "f")
|
||||
(:name "sent" :query "tag:sent" :key "t")
|
||||
(:name "drafts" :query "tag:draft" :key "d")
|
||||
(:name "all" :query "*" :key "a"))))
|
||||
|
||||
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
||||
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
||||
;;
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
|
||||
:email
|
||||
;;(mu4e +org +gmail)
|
||||
;;notmuch
|
||||
notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
|
||||
128
home/roles/email/default.nix
Normal file
128
home/roles/email/default.nix
Normal file
@@ -0,0 +1,128 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.email;
|
||||
in
|
||||
{
|
||||
options.home.roles.email = {
|
||||
enable = mkEnableOption "Enable email with notmuch, mbsync, and msmtp";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
isync # provides mbsync for IMAP sync
|
||||
msmtp # for SMTP sending
|
||||
notmuch # email indexing and search
|
||||
openssl # for certificate management
|
||||
];
|
||||
|
||||
# Ensure Mail directory exists
|
||||
home.file."Mail/.keep".text = "";
|
||||
|
||||
# mbsync configuration
|
||||
home.file.".mbsyncrc".text = ''
|
||||
# IMAP Account Configuration
|
||||
IMAPAccount proton
|
||||
Host proton.johnogle.info
|
||||
Port 143
|
||||
User john@ogle.fyi
|
||||
PassCmd "${pkgs.rbw}/bin/rbw get proton.johnogle.info"
|
||||
TLSType STARTTLS
|
||||
AuthMechs PLAIN
|
||||
|
||||
# Remote Storage
|
||||
IMAPStore proton-remote
|
||||
Account proton
|
||||
|
||||
# Local Storage
|
||||
MaildirStore proton-local
|
||||
Path ~/Mail/
|
||||
Inbox ~/Mail/INBOX
|
||||
SubFolders Verbatim
|
||||
|
||||
# Channel Configuration - Sync All
|
||||
Channel proton
|
||||
Far :proton-remote:
|
||||
Near :proton-local:
|
||||
Patterns *
|
||||
Create Both
|
||||
Expunge Both
|
||||
SyncState *
|
||||
'';
|
||||
|
||||
# Notmuch configuration
|
||||
home.file.".notmuch-config".text = ''
|
||||
[database]
|
||||
path=${config.home.homeDirectory}/Mail
|
||||
|
||||
[user]
|
||||
name=John Ogle
|
||||
primary_email=john@ogle.fyi
|
||||
|
||||
[new]
|
||||
tags=unread;inbox;
|
||||
ignore=
|
||||
|
||||
[search]
|
||||
exclude_tags=deleted;spam;
|
||||
|
||||
[maildir]
|
||||
synchronize_flags=true
|
||||
'';
|
||||
|
||||
# msmtp configuration
|
||||
home.file.".msmtprc".text = ''
|
||||
# Default settings
|
||||
defaults
|
||||
auth plain
|
||||
tls on
|
||||
tls_starttls on
|
||||
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
||||
logfile ${config.home.homeDirectory}/.msmtp.log
|
||||
|
||||
# Proton mail account
|
||||
account proton
|
||||
host proton.johnogle.info
|
||||
port 25
|
||||
from john@ogle.fyi
|
||||
user john@ogle.fyi
|
||||
passwordeval rbw get proton.johnogle.info
|
||||
|
||||
# Set default account
|
||||
account default : proton
|
||||
'';
|
||||
|
||||
# Systemd service for mail sync
|
||||
systemd.user.services.mbsync = {
|
||||
Unit = {
|
||||
Description = "Mailbox synchronization service";
|
||||
After = [ "network-online.target" ];
|
||||
Wants = [ "network-online.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.isync}/bin/mbsync -a && ${pkgs.notmuch}/bin/notmuch new'";
|
||||
Environment = "PATH=${pkgs.rbw}/bin:${pkgs.coreutils}/bin";
|
||||
StandardOutput = "journal";
|
||||
StandardError = "journal";
|
||||
};
|
||||
};
|
||||
|
||||
# Systemd timer for automatic sync
|
||||
systemd.user.timers.mbsync = {
|
||||
Unit = {
|
||||
Description = "Mailbox synchronization timer";
|
||||
};
|
||||
Timer = {
|
||||
OnBootSec = "2min";
|
||||
OnUnitActiveSec = "5min";
|
||||
Unit = "mbsync.service";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -26,6 +26,7 @@ with lib;
|
||||
enable = true;
|
||||
autologin = true;
|
||||
wayland = true;
|
||||
jellyfinScaleFactor = 2.5;
|
||||
};
|
||||
users.enable = true;
|
||||
};
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
#./virtual-surround.nix
|
||||
];
|
||||
|
||||
roles = {
|
||||
audio.enable = true;
|
||||
|
||||
132
machines/zix790prors/virtual-surround.nix
Normal file
132
machines/zix790prors/virtual-surround.nix
Normal file
@@ -0,0 +1,132 @@
|
||||
# Virtual 4.1 surround sound setup
|
||||
# Routes FL/FR to AmazonBasics USB speaker, RL/RR to Fosi BT20A PRO Bluetooth speaker
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.pipewire.extraConfig.pipewire."10-virtual-surround" = {
|
||||
"context.objects" = [
|
||||
{
|
||||
factory = "adapter";
|
||||
args = {
|
||||
"factory.name" = "support.null-audio-sink";
|
||||
"node.name" = "virtual_surround_sink";
|
||||
"node.description" = "Virtual 4.1 Surround (AmazonBasics + Fosi)";
|
||||
"media.class" = "Audio/Sink";
|
||||
"audio.position" = [ "FL" "FR" "RL" "RR" "LFE" ];
|
||||
"monitor.channel-volumes" = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
"context.modules" = [
|
||||
{
|
||||
name = "libpipewire-module-loopback";
|
||||
args = {
|
||||
"node.description" = "Route Front to AmazonBasics";
|
||||
"capture.props" = {
|
||||
"node.name" = "route_front_capture";
|
||||
"audio.position" = [ "FL" "FR" ];
|
||||
"stream.dont-remix" = true;
|
||||
"node.passive" = true;
|
||||
};
|
||||
"playback.props" = {
|
||||
"node.name" = "route_front_playback";
|
||||
"node.target" = "alsa_output.usb-C-Media_Electronics_Inc._AmazonBasics_Professional_Mic_2-00.analog-stereo";
|
||||
"audio.position" = [ "FL" "FR" ];
|
||||
"stream.dont-remix" = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "libpipewire-module-loopback";
|
||||
args = {
|
||||
"node.description" = "Route Rear to Fosi Audio";
|
||||
"capture.props" = {
|
||||
"node.name" = "route_rear_capture";
|
||||
"audio.position" = [ "RL" "RR" ];
|
||||
"stream.dont-remix" = true;
|
||||
"node.passive" = true;
|
||||
};
|
||||
"playback.props" = {
|
||||
"node.name" = "route_rear_playback";
|
||||
"node.target" = "bluez_output.F4_4E_FD_FB_58_62.1";
|
||||
"audio.position" = [ "FL" "FR" ];
|
||||
"stream.dont-remix" = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "libpipewire-module-loopback";
|
||||
args = {
|
||||
"node.description" = "Route Subwoofer to AmazonBasics";
|
||||
"capture.props" = {
|
||||
"node.name" = "route_lfe_capture";
|
||||
"audio.position" = [ "LFE" ];
|
||||
"stream.dont-remix" = true;
|
||||
"node.passive" = true;
|
||||
};
|
||||
"playback.props" = {
|
||||
"node.name" = "route_lfe_playback";
|
||||
"node.target" = "alsa_output.usb-C-Media_Electronics_Inc._AmazonBasics_Professional_Mic_2-00.analog-stereo";
|
||||
"audio.position" = [ "MONO" ];
|
||||
"stream.dont-remix" = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Systemd services to fix PipeWire loopback routing for virtual surround
|
||||
systemd.user.services.pipewire-surround-link = {
|
||||
description = "Link virtual surround sink to loopback captures";
|
||||
after = [ "pipewire.service" "wireplumber.service" ];
|
||||
requires = [ "pipewire.service" "wireplumber.service" ];
|
||||
wantedBy = [ "pipewire.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = false;
|
||||
ExecStart = pkgs.writeShellScript "surround-link" ''
|
||||
sleep 2
|
||||
# Disconnect wrong connections
|
||||
${pkgs.pipewire}/bin/pw-link -d alsa_input.pci-0000_00_1f.3.pro-input-2:capture_AUX0 route_front_capture:input_FL 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link -d alsa_input.pci-0000_00_1f.3.pro-input-2:capture_AUX1 route_front_capture:input_FR 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link -d alsa_input.pci-0000_00_1f.3.pro-input-2:capture_AUX0 route_rear_capture:input_RL 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link -d alsa_input.pci-0000_00_1f.3.pro-input-2:capture_AUX1 route_rear_capture:input_RR 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link -d alsa_input.pci-0000_00_1f.3.pro-input-2:capture_AUX0 route_lfe_capture:input_LFE 2>/dev/null || true
|
||||
# Create correct connections
|
||||
${pkgs.pipewire}/bin/pw-link virtual_surround_sink:monitor_FL route_front_capture:input_FL 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link virtual_surround_sink:monitor_FR route_front_capture:input_FR 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link virtual_surround_sink:monitor_RL route_rear_capture:input_RL 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link virtual_surround_sink:monitor_RR route_rear_capture:input_RR 2>/dev/null || true
|
||||
${pkgs.pipewire}/bin/pw-link virtual_surround_sink:monitor_LFE route_lfe_capture:input_LFE 2>/dev/null || true
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.pipewire-surround-link-check = {
|
||||
description = "Check and fix surround sink links";
|
||||
after = [ "pipewire.service" "wireplumber.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "surround-link-check" ''
|
||||
if ${pkgs.pipewire}/bin/pw-cli ls Node 2>/dev/null | grep -q "bluez_output.F4_4E_FD_FB_58_62"; then
|
||||
if ${pkgs.pipewire}/bin/pw-link -l 2>/dev/null | grep -q "route_front_capture:input_FL.*alsa_input"; then
|
||||
${pkgs.systemd}/bin/systemctl --user start pipewire-surround-link.service
|
||||
fi
|
||||
if ! ${pkgs.pipewire}/bin/pw-link -l 2>/dev/null | grep -q "virtual_surround_sink:monitor_FL.*route_front_capture"; then
|
||||
${pkgs.systemd}/bin/systemctl --user start pipewire-surround-link.service
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.timers.pipewire-surround-link-check = {
|
||||
description = "Periodically check surround sink links";
|
||||
wantedBy = [ "default.target" ];
|
||||
timerConfig = {
|
||||
OnStartupSec = "10s";
|
||||
OnUnitActiveSec = "10s";
|
||||
Unit = "pipewire-surround-link-check.service";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,24 +5,24 @@
|
||||
}:
|
||||
|
||||
let
|
||||
version = "2.0.53";
|
||||
version = "2.0.75";
|
||||
|
||||
srcs = {
|
||||
aarch64-darwin = {
|
||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/darwin-arm64/claude";
|
||||
sha256 = "28c3ad73a20f3ae7ab23efa24d45a9791ccbe071284f1622d4e5e2b89c4a15b7";
|
||||
sha256 = "a96eb18218e112486b7ecebd1551d927ffb310ab5fb06d2e8db25fb31367537e";
|
||||
};
|
||||
x86_64-darwin = {
|
||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/darwin-x64/claude";
|
||||
sha256 = "a27f7b75a51514658640432a0afec8be130673eb7dbecc9a4d742527dd85d29a";
|
||||
sha256 = "e27313053d3268a0bc1e0080f8c2ef7155325f0a95e72971163eef698a71e829";
|
||||
};
|
||||
x86_64-linux = {
|
||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/linux-x64/claude";
|
||||
sha256 = "9c4cc19e207fb6bf7ea140a1580d5ed0dd0a481af471f23614d5a140a4abf1c6";
|
||||
sha256 = "62160f8766681d8c933e9133398d3dde6ad0df08038881a66eddb993b4b6a33f";
|
||||
};
|
||||
aarch64-linux = {
|
||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/linux-arm64/claude";
|
||||
sha256 = "a5d4044034f3b63c38379bc2dd4067a4dd3c8ec48965ba8e66e3623774a93b72";
|
||||
sha256 = "681fbd1a84b2de883dc954441693766b43ea4faafb3e72b88c99a33645cd3507";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, uv2nix ? null, pyproject-nix ? null, pyproject-build-systems ? null, ... }:
|
||||
{
|
||||
vulkanHDRLayer = pkgs.callPackage ./vulkan-hdr-layer {};
|
||||
tea-rbw = pkgs.callPackage ./tea-rbw {};
|
||||
app-launcher-server = pkgs.callPackage ./app-launcher-server {};
|
||||
claude-code = pkgs.callPackage ./claude-code {};
|
||||
sendspin-cli = pkgs.callPackage ./sendspin-cli { inherit uv2nix pyproject-nix pyproject-build-systems; };
|
||||
}
|
||||
|
||||
91
packages/sendspin-cli/default.nix
Normal file
91
packages/sendspin-cli/default.nix
Normal file
@@ -0,0 +1,91 @@
|
||||
{ pkgs
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, uv2nix ? null
|
||||
, pyproject-nix ? null
|
||||
, pyproject-build-systems ? null
|
||||
}:
|
||||
|
||||
# Simple package build
|
||||
# Note: uv2nix would be ideal but requires uv.lock which sendspin-cli doesn't have yet
|
||||
let
|
||||
# Package aiosendspin from GitHub since it's only in nixpkgs-unstable
|
||||
aiosendspin = pkgs.python312Packages.buildPythonPackage rec {
|
||||
pname = "aiosendspin";
|
||||
version = "1.2.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Sendspin";
|
||||
repo = "aiosendspin";
|
||||
rev = version;
|
||||
sha256 = "sha256-3vTEfXeFqouPswRKST/9U7yg9ah7J9m2KAMoxaBZNR0=";
|
||||
};
|
||||
|
||||
build-system = with pkgs.python312Packages; [
|
||||
hatchling
|
||||
setuptools
|
||||
];
|
||||
|
||||
dependencies = with pkgs.python312Packages; [
|
||||
aiohttp
|
||||
av
|
||||
mashumaro
|
||||
orjson
|
||||
pillow
|
||||
zeroconf
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "aiosendspin" ];
|
||||
|
||||
meta = {
|
||||
description = "Async Python implementation of the Sendspin Protocol";
|
||||
homepage = "https://github.com/Sendspin-Protocol/aiosendspin";
|
||||
license = lib.licenses.asl20;
|
||||
};
|
||||
};
|
||||
|
||||
python = pkgs.python312.withPackages (ps: with ps; [
|
||||
# Core dependencies from pyproject.toml
|
||||
aiosendspin
|
||||
av
|
||||
numpy
|
||||
qrcode
|
||||
readchar
|
||||
rich
|
||||
sounddevice
|
||||
setuptools
|
||||
]);
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "sendspin-cli";
|
||||
version = "0.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Sendspin";
|
||||
repo = "sendspin-cli";
|
||||
rev = "main";
|
||||
sha256 = "sha256-z8ieaDHv4C6WNLpPGybhcfB+E6Jj/rCc7zSRpL6vdk0=";
|
||||
};
|
||||
|
||||
buildInputs = [ python pkgs.portaudio pkgs.ffmpeg ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin $out/lib
|
||||
cp -r sendspin $out/lib/
|
||||
cat > $out/bin/sendspin <<EOF
|
||||
#!/bin/sh
|
||||
export PYTHONPATH="$out/lib:\$PYTHONPATH"
|
||||
export LD_LIBRARY_PATH="${pkgs.portaudio}/lib:${pkgs.ffmpeg}/lib:\$LD_LIBRARY_PATH"
|
||||
exec ${python}/bin/python3 -m sendspin.cli "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/sendspin
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Synchronized audio player for Sendspin servers";
|
||||
homepage = "https://github.com/Sendspin/sendspin-cli";
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -48,10 +48,19 @@ in
|
||||
then pkgs.symlinkJoin {
|
||||
name = "jellyfin-media-player-scaled";
|
||||
paths = [ pkgs.jellyfin-media-player ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/jellyfinmediaplayer \
|
||||
--add-flags "--scale-factor ${toString cfg.jellyfinScaleFactor}"
|
||||
mkdir -p $out/bin
|
||||
rm -f $out/bin/jellyfin-desktop
|
||||
makeWrapper ${pkgs.jellyfin-media-player}/bin/jellyfin-desktop $out/bin/jellyfin-desktop \
|
||||
--add-flags "--tv --scale-factor ${toString cfg.jellyfinScaleFactor}"
|
||||
|
||||
# Update .desktop file to include scale factor and TV mode arguments
|
||||
mkdir -p $out/share/applications
|
||||
rm -f $out/share/applications/org.jellyfin.JellyfinDesktop.desktop
|
||||
substitute ${pkgs.jellyfin-media-player}/share/applications/org.jellyfin.JellyfinDesktop.desktop \
|
||||
$out/share/applications/org.jellyfin.JellyfinDesktop.desktop \
|
||||
--replace-fail "Exec=jellyfin-desktop" "Exec=jellyfin-desktop --tv --scale-factor ${toString cfg.jellyfinScaleFactor}"
|
||||
'';
|
||||
}
|
||||
else pkgs.jellyfin-media-player;
|
||||
|
||||
82
scripts/update-doomemacs.sh
Executable file
82
scripts/update-doomemacs.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
OWNER="doomemacs"
|
||||
REPO="doomemacs"
|
||||
FILE="home/roles/emacs/default.nix"
|
||||
# Use current working directory as repo root (allows running from anywhere in the repo)
|
||||
REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
||||
TARGET_FILE="$REPO_ROOT/$FILE"
|
||||
|
||||
echo -e "${GREEN}Updating DoomEmacs to latest commit...${NC}"
|
||||
|
||||
# Check if file exists
|
||||
if [[ ! -f "$TARGET_FILE" ]]; then
|
||||
echo -e "${RED}Error: $TARGET_FILE not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the default branch first
|
||||
echo "Fetching repository information..."
|
||||
DEFAULT_BRANCH=$(curl -s "https://api.github.com/repos/$OWNER/$REPO" | jq -r '.default_branch')
|
||||
|
||||
if [[ -z "$DEFAULT_BRANCH" ]] || [[ "$DEFAULT_BRANCH" == "null" ]]; then
|
||||
echo -e "${RED}Error: Failed to fetch default branch${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the latest commit SHA from GitHub
|
||||
echo "Fetching latest commit SHA from $DEFAULT_BRANCH branch..."
|
||||
LATEST_SHA=$(curl -s "https://api.github.com/repos/$OWNER/$REPO/commits/$DEFAULT_BRANCH" | jq -r '.sha')
|
||||
|
||||
if [[ -z "$LATEST_SHA" ]] || [[ "$LATEST_SHA" == "null" ]]; then
|
||||
echo -e "${RED}Error: Failed to fetch latest commit SHA${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "Latest commit: ${YELLOW}$LATEST_SHA${NC}"
|
||||
|
||||
# Get current SHA from file
|
||||
CURRENT_SHA=$(grep -oP 'rev = "\K[^"]+' "$TARGET_FILE")
|
||||
echo -e "Current commit: ${YELLOW}$CURRENT_SHA${NC}"
|
||||
|
||||
if [[ "$CURRENT_SHA" == "$LATEST_SHA" ]]; then
|
||||
echo -e "${GREEN}Already up to date!${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Update the rev field
|
||||
echo "Updating rev in $FILE..."
|
||||
sed -i "s/rev = \".*\"/rev = \"$LATEST_SHA\"/" "$TARGET_FILE"
|
||||
|
||||
# Fetch the new sha256 hash using nix-prefetch
|
||||
echo "Fetching new sha256 hash..."
|
||||
NEW_SHA256=$(nix-prefetch-url --unpack "https://github.com/$OWNER/$REPO/archive/$LATEST_SHA.tar.gz" 2>/dev/null)
|
||||
|
||||
if [[ -z "$NEW_SHA256" ]]; then
|
||||
echo -e "${RED}Error: Failed to fetch sha256 hash${NC}"
|
||||
# Revert the rev change
|
||||
sed -i "s/rev = \".*\"/rev = \"$CURRENT_SHA\"/" "$TARGET_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert to SRI hash format
|
||||
SRI_HASH=$(nix hash to-sri --type sha256 "$NEW_SHA256")
|
||||
echo -e "New sha256: ${YELLOW}$SRI_HASH${NC}"
|
||||
|
||||
# Update the sha256 field
|
||||
sed -i "s|sha256 = \".*\"|sha256 = \"$SRI_HASH\"|" "$TARGET_FILE"
|
||||
|
||||
echo -e "${GREEN}Successfully updated DoomEmacs!${NC}"
|
||||
echo -e " Old commit: ${YELLOW}$CURRENT_SHA${NC}"
|
||||
echo -e " New commit: ${YELLOW}$LATEST_SHA${NC}"
|
||||
echo -e " New sha256: ${YELLOW}$SRI_HASH${NC}"
|
||||
echo ""
|
||||
echo "You can now rebuild your system with the updated DoomEmacs."
|
||||
660
thoughts/shared/plans/2025-12-29-sendspin-cli-integration.md
Normal file
660
thoughts/shared/plans/2025-12-29-sendspin-cli-integration.md
Normal file
@@ -0,0 +1,660 @@
|
||||
# Sendspin-CLI Integration Implementation Plan
|
||||
|
||||
## Overview
|
||||
|
||||
Integrate sendspin-cli (https://github.com/Sendspin/sendspin-cli) into the NixOS configuration using uv2nix for Python packaging. Provide a flexible systemd service template that runs as the graphical user, supporting multiple use cases: standalone media centers (like `boxy` running as `kodi` user) and desktop workstations (like `zix790prors` running as `johno` user).
|
||||
|
||||
## Current State Analysis
|
||||
|
||||
**Existing Infrastructure:**
|
||||
- Custom package system using overlays at flake.nix:54-59
|
||||
- Packages defined in `packages/default.nix` and exposed as `pkgs.custom.<name>`
|
||||
- Role-based configuration system with audio role at roles/audio/default.nix:1-41
|
||||
- User-level systemd services pattern demonstrated in machines/zix790prors/virtual-surround.nix:79-103
|
||||
- Python packaging pattern using `python3.withPackages` at packages/app-launcher-server/default.nix:1-10
|
||||
|
||||
**Sendspin-CLI Analysis:**
|
||||
- Python 3.12+ application with setuptools build system
|
||||
- Entry point: `sendspin.cli:main` (sendspin-cli/sendspin/cli.py:143)
|
||||
- Dependencies: aiosendspin, av, numpy, qrcode, readchar, rich, sounddevice (sendspin-cli/pyproject.toml:16-23)
|
||||
- Native dependencies needed: portaudio (for sounddevice), ffmpeg (for av)
|
||||
- Supports headless mode via `--headless` flag (sendspin-cli/sendspin/cli.py:115-117)
|
||||
- Device selection via `--audio-device <index|name>` (sendspin-cli/sendspin/cli.py:96-102)
|
||||
- Device discovery via `--list-audio-devices` (sendspin-cli/sendspin/cli.py:15-34)
|
||||
- Auto-discovers servers via mDNS unless `--url` specified (sendspin-cli/sendspin/cli.py:69-71)
|
||||
- No `uv.lock` file currently in repository (only `pyproject.toml`)
|
||||
|
||||
**Gap:**
|
||||
- No uv2nix flake inputs (pyproject-nix, uv2nix, pyproject-build-systems)
|
||||
- No sendspin-cli package definition
|
||||
- No sendspin role or systemd service configuration
|
||||
|
||||
## Desired End State
|
||||
|
||||
After implementation completion:
|
||||
1. **Package available**: `pkgs.custom.sendspin-cli` builds successfully with all dependencies
|
||||
2. **Role available**: `roles.sendspin.enable = true` provides sendspin with configurable service
|
||||
3. **Service template**: Systemd user service runs as graphical session user with configurable audio device
|
||||
4. **Audio device compatibility**: Uses sendspin's native device specification (index or name prefix)
|
||||
5. **Flexible user context**: Service can run as kodi, johno, or any graphical session user
|
||||
|
||||
### Verification Commands:
|
||||
```bash
|
||||
# Package builds successfully
|
||||
nix build .#nixosConfigurations.zix790prors.config.environment.systemPackages --no-link | grep sendspin-cli
|
||||
|
||||
# Package contains working executable
|
||||
$(nix-build -E '(import <nixpkgs> {}).callPackage ./packages/sendspin-cli {}')/bin/sendspin --help
|
||||
|
||||
# Service template is generated
|
||||
nixos-rebuild dry-build --flake .#zix790prors 2>&1 | grep sendspin
|
||||
```
|
||||
|
||||
## Key Discoveries
|
||||
|
||||
### uv2nix Integration Points
|
||||
- **No lock file**: sendspin-cli has `pyproject.toml` but no `uv.lock` - uv2nix will resolve from pyproject.toml
|
||||
- **Native dependencies**: sounddevice and av require portaudio and ffmpeg in buildInputs
|
||||
- **Workspace loading**: uv2nix.lib.workspace.loadWorkspace works with pyproject.toml-only projects
|
||||
- **Build system**: Uses setuptools (declared in pyproject.toml:1-3)
|
||||
|
||||
### Service Architecture
|
||||
- **User services**: Must use `systemd.user.services` (not system services) for audio access
|
||||
- **Automatic user detection**: User services run in the logged-in graphical user's session
|
||||
- **PipeWire dependency**: Service must start after `pipewire.service` and `wireplumber.service`
|
||||
- **Auto-restart**: Use `Restart=always` for persistent background operation
|
||||
|
||||
### Audio Device Handling
|
||||
- **Native format**: Sendspin expects device index (0, 1, 2) or name prefix ("AmazonBasics")
|
||||
- **Discovery**: `sendspin --list-audio-devices` shows available devices
|
||||
- **PipeWire independence**: No need to use PipeWire node names; sendspin queries via sounddevice library
|
||||
|
||||
## What We're NOT Doing
|
||||
|
||||
To prevent scope creep:
|
||||
|
||||
1. **Not creating uv.lock**: Using pyproject.toml directly; lock file can be added upstream later
|
||||
2. **Not implementing multi-instance configuration**: Providing single-instance template; machines can extend for multiple instances
|
||||
3. **Not configuring specific machines**: Template only; zix790prors multi-instance setup is future work
|
||||
4. **Not creating home-manager module**: Using system-level role with user services
|
||||
5. **Not implementing server mode**: Client-only integration; `sendspin serve` can be added later
|
||||
6. **Not auto-detecting graphical user**: Relying on systemd user service behavior; explicit user selection can be added later
|
||||
7. **Not packaging dev dependencies**: Only runtime dependencies; test tools (mypy, ruff) excluded
|
||||
|
||||
## Implementation Approach
|
||||
|
||||
Use uv2nix to package sendspin-cli from its GitHub repository, accessing pyproject.toml for dependency resolution. Create a NixOS role following the spotifyd pattern with a systemd user service template. The service runs in the logged-in user's session (automatic user detection) and can be configured per-machine for different audio devices.
|
||||
|
||||
**Key Technical Decisions:**
|
||||
1. **uv2nix over python3.withPackages**: Better maintainability, automatic dependency resolution, aligns with upstream development
|
||||
2. **System-level role with user services**: Follows existing patterns (virtual-surround.nix), enables per-user configuration
|
||||
3. **Headless mode default**: Services always use `--headless`; TUI available via manual `sendspin` command
|
||||
4. **mDNS discovery default**: No `--url` by default; let sendspin auto-discover servers on the network
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Add uv2nix Flake Inputs
|
||||
|
||||
### Overview
|
||||
Add pyproject-nix, uv2nix, and pyproject-build-systems as flake inputs and thread them through to package definitions.
|
||||
|
||||
### Changes Required
|
||||
|
||||
#### 1. Flake Inputs
|
||||
**File**: `flake.nix`
|
||||
**Changes**: Add new inputs after existing inputs (after line 44)
|
||||
|
||||
```nix
|
||||
pyproject-nix = {
|
||||
url = "github:pyproject-nix/pyproject.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
uv2nix = {
|
||||
url = "github:pyproject-nix/uv2nix";
|
||||
inputs.pyproject-nix.follows = "pyproject-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
pyproject-build-systems = {
|
||||
url = "github:pyproject-nix/build-system-pkgs";
|
||||
inputs.pyproject-nix.follows = "pyproject-nix";
|
||||
inputs.uv2nix.follows = "uv2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
```
|
||||
|
||||
#### 2. Outputs Signature
|
||||
**File**: `flake.nix`
|
||||
**Changes**: Update outputs function signature (line 47)
|
||||
|
||||
```nix
|
||||
# Before
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-wsl, ... } @ inputs:
|
||||
|
||||
# After
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-wsl, pyproject-nix, uv2nix, pyproject-build-systems, ... } @ inputs:
|
||||
```
|
||||
|
||||
#### 3. Pass Inputs to Packages
|
||||
**File**: `flake.nix`
|
||||
**Changes**: Update custom package overlay (line 59 and 87)
|
||||
|
||||
```nix
|
||||
# Before
|
||||
custom = prev.callPackage ./packages {};
|
||||
|
||||
# After
|
||||
custom = prev.callPackage ./packages { inherit uv2nix pyproject-nix pyproject-build-systems; };
|
||||
```
|
||||
|
||||
#### 4. Update Packages Default.nix Signature
|
||||
**File**: `packages/default.nix`
|
||||
**Changes**: Accept new parameters
|
||||
|
||||
```nix
|
||||
# Before
|
||||
{ pkgs, ... }:
|
||||
|
||||
# After
|
||||
{ pkgs, uv2nix ? null, pyproject-nix ? null, pyproject-build-systems ? null, ... }:
|
||||
```
|
||||
|
||||
**Note**: Parameters are optional to maintain compatibility with direct `nix-build` calls.
|
||||
|
||||
### Success Criteria
|
||||
|
||||
#### Automated Verification:
|
||||
- [x] Flake evaluation succeeds: `nix flake check`
|
||||
- [x] Custom packages still build: `nix build .#nixosConfigurations.zix790prors.config.environment.systemPackages`
|
||||
- [x] No evaluation errors: `nixos-rebuild dry-build --flake .#zix790prors`
|
||||
|
||||
#### Manual Verification:
|
||||
- [x] Flake inputs show pyproject-nix, uv2nix, and pyproject-build-systems: `nix flake metadata`
|
||||
- [x] Existing machines still build without errors
|
||||
|
||||
**Implementation Note**: After completing this phase and all automated verification passes, pause here for manual confirmation before proceeding to Phase 2.
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Create Sendspin-CLI Package
|
||||
|
||||
### Overview
|
||||
Create uv2nix-based package for sendspin-cli that handles Python dependencies and native libraries (portaudio, ffmpeg).
|
||||
|
||||
### Changes Required
|
||||
|
||||
#### 1. Package Definition
|
||||
**File**: `packages/sendspin-cli/default.nix`
|
||||
**Changes**: Create new file
|
||||
|
||||
```nix
|
||||
{ pkgs
|
||||
, uv2nix ? null
|
||||
, pyproject-nix ? null
|
||||
, pyproject-build-systems ? null
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
# Fallback to simple package if uv2nix not available
|
||||
if uv2nix == null || pyproject-nix == null || pyproject-build-systems == null then
|
||||
let
|
||||
python = pkgs.python312.withPackages (ps: with ps; [
|
||||
# Core dependencies from pyproject.toml
|
||||
# Note: aiosendspin may need to be packaged separately if not in nixpkgs
|
||||
av
|
||||
numpy
|
||||
qrcode
|
||||
readchar
|
||||
rich
|
||||
sounddevice
|
||||
# Build dependencies
|
||||
setuptools
|
||||
]);
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "sendspin-cli";
|
||||
version = "0.0.0-fallback";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Sendspin";
|
||||
repo = "sendspin-cli";
|
||||
rev = "main";
|
||||
sha256 = lib.fakeSha256; # Replace with actual hash after first build
|
||||
};
|
||||
|
||||
buildInputs = [ python pkgs.portaudio pkgs.ffmpeg ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin $out/lib
|
||||
cp -r sendspin $out/lib/
|
||||
cat > $out/bin/sendspin <<EOF
|
||||
#!/bin/sh
|
||||
export PYTHONPATH="$out/lib:\$PYTHONPATH"
|
||||
exec ${python}/bin/python3 -m sendspin.cli "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/sendspin
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Synchronized audio player for Sendspin servers (fallback build)";
|
||||
homepage = "https://github.com/Sendspin/sendspin-cli";
|
||||
license = lib.licenses.asl20;
|
||||
};
|
||||
}
|
||||
else
|
||||
let
|
||||
# Fetch sendspin-cli source
|
||||
src = fetchFromGitHub {
|
||||
owner = "Sendspin";
|
||||
repo = "sendspin-cli";
|
||||
rev = "main"; # TODO: Pin to specific release tag
|
||||
sha256 = lib.fakeSha256; # Replace with actual hash after first build
|
||||
};
|
||||
|
||||
# Load workspace from pyproject.toml
|
||||
workspace = uv2nix.lib.workspace.loadWorkspace {
|
||||
workspaceRoot = src;
|
||||
};
|
||||
|
||||
# Create overlay from pyproject.toml dependencies
|
||||
overlay = workspace.mkPyprojectOverlay {
|
||||
sourcePreference = "wheel"; # Prefer wheels for faster builds
|
||||
};
|
||||
|
||||
# Build Python package set with native dependency overrides
|
||||
pythonSet = (pkgs.callPackage pyproject-nix.build.packages {
|
||||
python = pkgs.python312;
|
||||
}).overrideScope (lib.composeManyExtensions [
|
||||
pyproject-build-systems.overlays.default
|
||||
overlay
|
||||
# Override for packages with native dependencies
|
||||
(final: prev: {
|
||||
# sounddevice needs portaudio
|
||||
sounddevice = prev.sounddevice.overrideAttrs (old: {
|
||||
buildInputs = (old.buildInputs or []) ++ [ pkgs.portaudio ];
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ pkgs.portaudio ];
|
||||
});
|
||||
# av (PyAV) needs ffmpeg
|
||||
av = prev.av.overrideAttrs (old: {
|
||||
buildInputs = (old.buildInputs or []) ++ [ pkgs.ffmpeg ];
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ pkgs.pkg-config ];
|
||||
});
|
||||
})
|
||||
]);
|
||||
|
||||
# Create virtual environment with all dependencies
|
||||
venv = pythonSet.mkVirtualEnv "sendspin-cli-env" workspace.deps.default;
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "sendspin-cli";
|
||||
version = "0.0.0";
|
||||
inherit src;
|
||||
|
||||
buildInputs = [ venv pkgs.portaudio pkgs.ffmpeg ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
# Copy virtual environment
|
||||
cp -r ${venv} $out/venv
|
||||
# Create wrapper script
|
||||
cat > $out/bin/sendspin <<EOF
|
||||
#!/bin/sh
|
||||
export LD_LIBRARY_PATH="${pkgs.portaudio}/lib:${pkgs.ffmpeg}/lib:\$LD_LIBRARY_PATH"
|
||||
exec $out/venv/bin/sendspin "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/sendspin
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Synchronized audio player for Sendspin servers";
|
||||
homepage = "https://github.com/Sendspin/sendspin-cli";
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Register Package
|
||||
**File**: `packages/default.nix`
|
||||
**Changes**: Add sendspin-cli to exports (after line 6)
|
||||
|
||||
```nix
|
||||
{ pkgs, uv2nix ? null, pyproject-nix ? null, pyproject-build-systems ? null, ... }:
|
||||
{
|
||||
vulkanHDRLayer = pkgs.callPackage ./vulkan-hdr-layer {};
|
||||
tea-rbw = pkgs.callPackage ./tea-rbw {};
|
||||
app-launcher-server = pkgs.callPackage ./app-launcher-server {};
|
||||
claude-code = pkgs.callPackage ./claude-code {};
|
||||
sendspin-cli = pkgs.callPackage ./sendspin-cli { inherit uv2nix pyproject-nix pyproject-build-systems; };
|
||||
}
|
||||
```
|
||||
|
||||
### Success Criteria
|
||||
|
||||
#### Automated Verification:
|
||||
- [x] Package builds successfully: `nix build .#nixosConfigurations.zix790prors.pkgs.custom.sendspin-cli`
|
||||
- [x] Binary exists in output: `nix path-info .#nixosConfigurations.zix790prors.pkgs.custom.sendspin-cli`
|
||||
- [x] No build errors in dry-run: `nixos-rebuild dry-build --flake .#zix790prors`
|
||||
|
||||
#### Manual Verification:
|
||||
- [ ] Help text displays correctly: `$(nix-build '<nixpkgs>' -A custom.sendspin-cli)/bin/sendspin --help`
|
||||
- [ ] List audio devices works: `$(nix-build '<nixpkgs>' -A custom.sendspin-cli)/bin/sendspin --list-audio-devices`
|
||||
- [ ] Version information is correct: `$(nix-build '<nixpkgs>' -A custom.sendspin-cli)/bin/sendspin --version` (if supported)
|
||||
- [ ] Dependencies are bundled: Check that output closure contains portaudio and ffmpeg libraries
|
||||
|
||||
**Implementation Note**: The first build will fail with `lib.fakeSha256` error. Copy the actual hash from the error message and replace `lib.fakeSha256` with the real hash. After completing this phase and all automated verification passes, pause here for manual confirmation before proceeding to Phase 3.
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Create Sendspin Role with Service Template
|
||||
|
||||
### Overview
|
||||
Create NixOS role that provides sendspin-cli package and configurable systemd user service template for running sendspin as a background service.
|
||||
|
||||
### Changes Required
|
||||
|
||||
#### 1. Role Definition
|
||||
**File**: `roles/sendspin/default.nix`
|
||||
**Changes**: Create new file
|
||||
|
||||
```nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.roles.sendspin;
|
||||
in
|
||||
{
|
||||
options.roles.sendspin = {
|
||||
enable = mkEnableOption "Enable the sendspin role";
|
||||
|
||||
audioDevice = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Audio output device by index (e.g., "0", "1") or name prefix (e.g., "AmazonBasics").
|
||||
Use `sendspin --list-audio-devices` to see available devices.
|
||||
If null, uses system default audio device.
|
||||
'';
|
||||
example = "0";
|
||||
};
|
||||
|
||||
clientName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Friendly name for this Sendspin client.
|
||||
Defaults to hostname if not specified.
|
||||
'';
|
||||
example = "Living Room Speakers";
|
||||
};
|
||||
|
||||
clientId = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Unique identifier for this Sendspin client.
|
||||
Defaults to sendspin-cli-<hostname> if not specified.
|
||||
'';
|
||||
example = "sendspin-livingroom";
|
||||
};
|
||||
|
||||
serverUrl = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
WebSocket URL of the Sendspin server.
|
||||
If null, auto-discovers servers via mDNS.
|
||||
'';
|
||||
example = "ws://192.168.1.100:8927";
|
||||
};
|
||||
|
||||
staticDelayMs = mkOption {
|
||||
type = types.float;
|
||||
default = 0.0;
|
||||
description = ''
|
||||
Extra playback delay in milliseconds applied after clock sync.
|
||||
Useful for compensating audio latency differences between devices.
|
||||
'';
|
||||
example = 50.0;
|
||||
};
|
||||
|
||||
logLevel = mkOption {
|
||||
type = types.enum [ "DEBUG" "INFO" "WARNING" "ERROR" "CRITICAL" ];
|
||||
default = "INFO";
|
||||
description = "Logging level for sendspin service";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Ensure audio infrastructure is available
|
||||
roles.audio.enable = true;
|
||||
|
||||
# Make sendspin-cli available system-wide
|
||||
environment.systemPackages = with pkgs; [
|
||||
custom.sendspin-cli
|
||||
];
|
||||
|
||||
# Systemd user service for running sendspin in headless mode
|
||||
systemd.user.services.sendspin = {
|
||||
description = "Sendspin Audio Sync Client";
|
||||
documentation = [ "https://github.com/Sendspin/sendspin-cli" ];
|
||||
|
||||
# Start after audio services are ready
|
||||
after = [ "pipewire.service" "wireplumber.service" ];
|
||||
requires = [ "pipewire.service" "wireplumber.service" ];
|
||||
|
||||
# Auto-start with pipewire (which starts with graphical session)
|
||||
wantedBy = [ "pipewire.service" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
RestartSec = "5s";
|
||||
|
||||
# Build command with configured options
|
||||
ExecStart = pkgs.writeShellScript "sendspin-start" ''
|
||||
exec ${pkgs.custom.sendspin-cli}/bin/sendspin \
|
||||
--headless \
|
||||
--log-level ${cfg.logLevel} \
|
||||
${optionalString (cfg.audioDevice != null) "--audio-device '${cfg.audioDevice}'"} \
|
||||
${optionalString (cfg.clientName != null) "--name '${cfg.clientName}'"} \
|
||||
${optionalString (cfg.clientId != null) "--id '${cfg.clientId}'"} \
|
||||
${optionalString (cfg.serverUrl != null) "--url '${cfg.serverUrl}'"} \
|
||||
${optionalString (cfg.staticDelayMs != 0.0) "--static-delay-ms ${toString cfg.staticDelayMs}"}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Open firewall for mDNS discovery
|
||||
networking.firewall.allowedUDPPorts = [ 5353 ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Register Role
|
||||
**File**: `roles/default.nix`
|
||||
**Changes**: Add sendspin to imports (after line 16)
|
||||
|
||||
```nix
|
||||
imports = [
|
||||
./audio
|
||||
./bluetooth
|
||||
./btrfs
|
||||
./desktop
|
||||
./kodi
|
||||
./nfs-mounts
|
||||
./nvidia
|
||||
./printing
|
||||
./remote-build
|
||||
./sendspin
|
||||
./spotifyd
|
||||
./users
|
||||
./virtualisation
|
||||
];
|
||||
```
|
||||
|
||||
### Success Criteria
|
||||
|
||||
#### Automated Verification:
|
||||
- [ ] Configuration evaluates: `nixos-rebuild dry-build --flake .#zix790prors`
|
||||
- [ ] Service unit is generated: `nixos-rebuild dry-build --flake .#zix790prors 2>&1 | grep -i sendspin`
|
||||
- [ ] No syntax errors: `nix eval .#nixosConfigurations.zix790prors.config.roles.sendspin.enable`
|
||||
|
||||
#### Manual Verification:
|
||||
- [ ] Role can be enabled in machine config without errors
|
||||
- [ ] Service dependencies are correct (after pipewire/wireplumber)
|
||||
- [ ] Firewall rule for mDNS is present
|
||||
- [ ] Sendspin-cli is in system packages when role is enabled
|
||||
- [ ] All configuration options (audioDevice, clientName, etc.) are exposed
|
||||
- [ ] Service starts successfully after enabling role and rebuilding
|
||||
|
||||
**Implementation Note**: After completing this phase and all automated verification passes, pause here for manual confirmation. Test the service by adding `roles.sendspin.enable = true;` to a machine configuration, rebuilding, and verifying the service runs as the logged-in user.
|
||||
|
||||
---
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Unit Tests (Per-Phase)
|
||||
|
||||
**Phase 1 (Flake Inputs):**
|
||||
```bash
|
||||
# Verify flake is valid
|
||||
nix flake check
|
||||
|
||||
# Verify inputs are available
|
||||
nix flake metadata | grep -E "(pyproject-nix|uv2nix|pyproject-build-systems)"
|
||||
|
||||
# Verify existing builds still work
|
||||
nix build .#nixosConfigurations.zix790prors.config.system.build.toplevel
|
||||
```
|
||||
|
||||
**Phase 2 (Package):**
|
||||
```bash
|
||||
# Build package
|
||||
nix build .#nixosConfigurations.zix790prors.pkgs.custom.sendspin-cli
|
||||
|
||||
# Test executable
|
||||
result/bin/sendspin --help
|
||||
result/bin/sendspin --list-audio-devices
|
||||
|
||||
# Verify dependencies
|
||||
nix-store --query --requisites result | grep -E "(portaudio|ffmpeg)"
|
||||
```
|
||||
|
||||
**Phase 3 (Role):**
|
||||
```bash
|
||||
# Evaluate with role enabled
|
||||
nix eval .#nixosConfigurations.zix790prors.config.roles.sendspin.enable
|
||||
|
||||
# Check service definition
|
||||
nixos-rebuild dry-build --flake .#zix790prors
|
||||
systemctl --user cat sendspin.service # After rebuild
|
||||
|
||||
# Verify audio device option works
|
||||
nix eval '.#nixosConfigurations.zix790prors.config.roles.sendspin.audioDevice'
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
|
||||
**Basic Service Test:**
|
||||
1. Enable role on a test machine: `roles.sendspin.enable = true;`
|
||||
2. Rebuild system: `make switch`
|
||||
3. Check service status: `systemctl --user status sendspin.service`
|
||||
4. Verify logs show connection attempts: `journalctl --user -u sendspin -f`
|
||||
5. Run server locally: `sendspin serve --demo`
|
||||
6. Verify client connects and plays audio
|
||||
|
||||
**Multi-Device Test (Future - zix790prors):**
|
||||
1. Create multiple service instances with different audio devices
|
||||
2. Verify each instance targets correct device
|
||||
3. Test audio sync between devices
|
||||
|
||||
**User Context Test:**
|
||||
1. Test on `boxy` running as `kodi` user
|
||||
2. Test on `zix790prors` running as `johno` user
|
||||
3. Verify service runs in correct user session
|
||||
|
||||
### Manual Testing Steps
|
||||
|
||||
1. **Package Installation:**
|
||||
```bash
|
||||
# As root
|
||||
nix-shell -p 'pkgs.custom.sendspin-cli'
|
||||
sendspin --list-audio-devices
|
||||
```
|
||||
|
||||
2. **Service Functionality:**
|
||||
```bash
|
||||
# After enabling role and rebuilding
|
||||
systemctl --user status sendspin
|
||||
journalctl --user -u sendspin -n 50
|
||||
```
|
||||
|
||||
3. **Audio Device Selection:**
|
||||
```bash
|
||||
# Configure specific device
|
||||
roles.sendspin.audioDevice = "0";
|
||||
# Rebuild and verify service uses correct device
|
||||
```
|
||||
|
||||
4. **Server Discovery:**
|
||||
```bash
|
||||
# Without serverUrl, verify mDNS discovery
|
||||
sendspin --list-servers
|
||||
```
|
||||
|
||||
5. **Delay Calibration:**
|
||||
```bash
|
||||
# Test delay configuration
|
||||
roles.sendspin.staticDelayMs = 50.0;
|
||||
# Verify in service logs
|
||||
```
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
**Build Time:**
|
||||
- uv2nix initial build may take 5-10 minutes (Python dependency resolution)
|
||||
- Subsequent builds use Nix cache
|
||||
- Consider using binary cache if building on multiple machines
|
||||
|
||||
**Runtime:**
|
||||
- Sendspin client is lightweight (~20-50 MB memory)
|
||||
- CPU usage minimal when not playing audio
|
||||
- Network: Uses mDNS (UDP 5353) and WebSocket connection to server
|
||||
|
||||
**Storage:**
|
||||
- Package closure size: ~200-300 MB (Python + dependencies + libraries)
|
||||
- No persistent cache by sendspin-cli itself
|
||||
|
||||
## Migration Notes
|
||||
|
||||
**For Existing Systems:**
|
||||
1. Add role to machine configuration
|
||||
2. Configure audio device if not using default
|
||||
3. Rebuild and enable service
|
||||
4. No data migration needed (stateless service)
|
||||
|
||||
**For Multi-Instance Setups (Future):**
|
||||
When implementing multiple instances for zix790prors:
|
||||
1. Disable default service: `systemd.user.services.sendspin.wantedBy = lib.mkForce [];`
|
||||
2. Create per-device service instances manually
|
||||
3. Each instance needs unique `--id` and `--audio-device`
|
||||
|
||||
## References
|
||||
|
||||
- Original research: `thoughts/shared/research/2025-12-29-sendspin-cli-integration.md`
|
||||
- Sendspin-CLI source: `~/src/sendspin-cli/` (GitHub: https://github.com/Sendspin/sendspin-cli)
|
||||
- Sendspin pyproject.toml: `~/src/sendspin-cli/pyproject.toml`
|
||||
- Sendspin CLI implementation: `~/src/sendspin-cli/sendspin/cli.py:143-222`
|
||||
- Custom packages pattern: `packages/default.nix:1-7`
|
||||
- Python package pattern: `packages/app-launcher-server/default.nix:1-10`
|
||||
- Audio role pattern: `roles/audio/default.nix:1-41`
|
||||
- Service role pattern: `roles/spotifyd/default.nix:1-40`
|
||||
- User service pattern: `machines/zix790prors/virtual-surround.nix:79-132`
|
||||
- Flake overlay: `flake.nix:54-59`
|
||||
- uv2nix documentation: https://pyproject-nix.github.io/uv2nix/
|
||||
- uv2nix getting started: https://pyproject-nix.github.io/uv2nix/usage/getting-started.html
|
||||
Reference in New Issue
Block a user