Compare commits
29 Commits
25.11
...
feature/se
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b0adcc020 | |||
| c480bcdd1d | |||
| 05fed3ede1 | |||
| 0a9de8d159 | |||
| 055d6ab421 | |||
| d5c6342b84 | |||
| e04dacdf65 | |||
| 7d74917bdc | |||
| 5a4ab71849 | |||
| bcebf9b376 | |||
| 0f76939983 | |||
| a1da2f5cc1 | |||
| 175da48170 | |||
| ac956ef48c | |||
| 0c1190f39c | |||
| 00f05d1bb2 | |||
| 4e6c6ab81d | |||
| 04e1a8563c | |||
| 7278dc8306 | |||
| 066eea2999 | |||
| 80633142fb | |||
| 3029e3d9a8 | |||
| 3483e26bce | |||
| b3add6ddf8 | |||
| 89994e3fc8 | |||
| 0e9671a45f | |||
| f4078970b2 | |||
| bc42c4dc77 | |||
| 585f9ef5c7 |
128
flake.lock
generated
128
flake.lock
generated
@@ -3,11 +3,11 @@
|
|||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1761588595,
|
"lastModified": 1765121682,
|
||||||
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
|
"narHash": "sha256-4VBOP18BFeiPkyhy9o4ssBNQEvfvv1kXkasAYd0+rrA=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
|
"rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -43,11 +43,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764866045,
|
"lastModified": 1766292113,
|
||||||
"narHash": "sha256-0GsEtXV9OquDQ1VclQfP16cU5VZh7NEVIOjSH4UaJuM=",
|
"narHash": "sha256-sWTtmkQujRpjWYCnZc8LWdDiCzrRlSBPrGovkZpLkBI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "f63d0fe9d81d36e5fc95497217a72e02b8b7bcab",
|
"rev": "fdec8815a86db36f42fc9c8cb2931cd8485f5aed",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -64,11 +64,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764872372,
|
"lastModified": 1766282146,
|
||||||
"narHash": "sha256-uZuXRz9CzeCHsRbc2MQvKomwoX6GcFC5BUMEk3ouSFU=",
|
"narHash": "sha256-0V/nKU93KdYGi+5LB/MVo355obBJw/2z9b2xS3bPJxY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "05a56dbf24f195c62286e3273a2671d3b4904b00",
|
"rev": "61fcc9de76b88e55578eb5d79fc80f2b236df707",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -86,11 +86,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764746434,
|
"lastModified": 1766225187,
|
||||||
"narHash": "sha256-6ymFuw+Z1C90ezf8H0BP3c2JFZhJYwMq31px2StwWHU=",
|
"narHash": "sha256-6hcaU8qtmixsaEUbjPiOFd5aJPZxAIBokl5d7dkab3k=",
|
||||||
"owner": "Jovian-Experiments",
|
"owner": "Jovian-Experiments",
|
||||||
"repo": "Jovian-NixOS",
|
"repo": "Jovian-NixOS",
|
||||||
"rev": "b4c0b604148adacf119b89824ed26df8926ce42c",
|
"rev": "bb53a85db9210204a98f771f10f1f5b4e06ccb2d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -106,11 +106,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764161084,
|
"lastModified": 1765066094,
|
||||||
"narHash": "sha256-HN84sByg9FhJnojkGGDSrcjcbeioFWoNXfuyYfJ1kBE=",
|
"narHash": "sha256-0YSU35gfRFJzx/lTGgOt6ubP8K6LeW0vaywzNNqxkl4=",
|
||||||
"owner": "nix-darwin",
|
"owner": "nix-darwin",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "e95de00a471d07435e0527ff4db092c84998698e",
|
"rev": "688427b1aab9afb478ca07989dc754fa543e03d5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -148,11 +148,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764730608,
|
"lastModified": 1765841014,
|
||||||
"narHash": "sha256-FxKIa3OCSRVC23qrk7VT68vExUcmSruJ8OobVlSWOxc=",
|
"narHash": "sha256-55V0AJ36V5Egh4kMhWtDh117eE3GOjwq5LhwxDn9eHg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "NixOS-WSL",
|
||||||
"rev": "10124c58674360765adcb38c9a8b081fb72904e4",
|
"rev": "be4af8042e7a61fa12fda58fe9a3b3babdefe17b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -164,11 +164,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764517877,
|
"lastModified": 1765472234,
|
||||||
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",
|
"narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c",
|
"rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -180,11 +180,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764667669,
|
"lastModified": 1766070988,
|
||||||
"narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=",
|
"narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "418468ac9527e799809c900eda37cbff999199b6",
|
"rev": "c6245e83d836d0433170a16eb185cefe0572f8b8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -196,11 +196,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764677808,
|
"lastModified": 1766201043,
|
||||||
"narHash": "sha256-H3lC7knbXOBrHI9hITQ7modLuX20mYJVhZORL5ioms0=",
|
"narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1aab89277eb2d87823d5b69bae631a2496cff57a",
|
"rev": "b3aad468604d3e488d627c0b43984eb60e75e782",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -256,6 +256,52 @@
|
|||||||
"type": "github"
|
"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": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"google-cookie-retrieval": "google-cookie-retrieval",
|
"google-cookie-retrieval": "google-cookie-retrieval",
|
||||||
@@ -267,7 +313,33 @@
|
|||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"plasma-manager": "plasma-manager",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
48
flake.nix
48
flake.nix
@@ -42,9 +42,27 @@
|
|||||||
url = "github:Jovian-Experiments/Jovian-NixOS";
|
url = "github:Jovian-Experiments/Jovian-NixOS";
|
||||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pyproject-nix = {
|
||||||
|
url = "github:pyproject-nix/pyproject.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-wsl, ... } @ inputs: let
|
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, pyproject-nix, uv2nix, pyproject-build-systems, ... } @ inputs: let
|
||||||
nixosModules = [
|
nixosModules = [
|
||||||
./roles
|
./roles
|
||||||
] ++ [
|
] ++ [
|
||||||
@@ -53,10 +71,10 @@
|
|||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
unstable = import nixpkgs-unstable {
|
unstable = import nixpkgs-unstable {
|
||||||
system = prev.system;
|
system = prev.stdenv.hostPlatform.system;
|
||||||
config.allowUnfree = true;
|
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
|
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
||||||
})
|
})
|
||||||
@@ -81,10 +99,10 @@
|
|||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
unstable = import nixpkgs-unstable {
|
unstable = import nixpkgs-unstable {
|
||||||
system = prev.system;
|
system = prev.stdenv.hostPlatform.system;
|
||||||
config.allowUnfree = true;
|
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
|
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
||||||
})
|
})
|
||||||
@@ -107,7 +125,7 @@
|
|||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
unstable = import nixpkgs-unstable {
|
unstable = import nixpkgs-unstable {
|
||||||
system = prev.system;
|
system = prev.stdenv.hostPlatform.system;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
overlays = [
|
overlays = [
|
||||||
# Override claude-code in unstable to use our custom GCS-based build
|
# Override claude-code in unstable to use our custom GCS-based build
|
||||||
@@ -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
|
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
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";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,12 @@
|
|||||||
|
|
||||||
# Enable all desktop roles for full-featured experience
|
# Enable all desktop roles for full-featured experience
|
||||||
home.roles = {
|
home.roles = {
|
||||||
|
"3d-printing".enable = true;
|
||||||
base.enable = true;
|
base.enable = true;
|
||||||
desktop.enable = true;
|
desktop.enable = true;
|
||||||
|
emacs.enable = true;
|
||||||
|
email.enable = true;
|
||||||
|
i3_sway.enable = true;
|
||||||
office.enable = true;
|
office.enable = true;
|
||||||
media.enable = true;
|
media.enable = true;
|
||||||
development.enable = true;
|
development.enable = true;
|
||||||
@@ -19,8 +23,6 @@
|
|||||||
kubectl.enable = true;
|
kubectl.enable = true;
|
||||||
tmux.enable = true;
|
tmux.enable = true;
|
||||||
plasma-manager.enable = true;
|
plasma-manager.enable = true;
|
||||||
emacs.enable = true;
|
|
||||||
i3_sway.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
targets.genericLinux.enable = true;
|
targets.genericLinux.enable = true;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
desktop.enable = true;
|
desktop.enable = true;
|
||||||
development.enable = true;
|
development.enable = true;
|
||||||
communication.enable = true;
|
communication.enable = true;
|
||||||
|
email.enable = true;
|
||||||
kdeconnect.enable = true;
|
kdeconnect.enable = true;
|
||||||
media.enable = true;
|
media.enable = true;
|
||||||
sync.enable = true;
|
sync.enable = true;
|
||||||
|
|||||||
22
home/roles/3d-printing/default.nix
Normal file
22
home/roles/3d-printing/default.nix
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.home.roles."3d-printing";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.home.roles."3d-printing" = {
|
||||||
|
enable = mkEnableOption "Enable 3D printing applications and tools";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# 3D Slicing Software
|
||||||
|
orca-slicer # G-code generator for 3D printers (Bambu, Prusa, Voron, etc.)
|
||||||
|
|
||||||
|
# 3D Modeling Software
|
||||||
|
openscad-unstable # 3D parametric model compiler (nightly build)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -298,7 +298,7 @@ in
|
|||||||
gaps = {
|
gaps = {
|
||||||
outer = {
|
outer = {
|
||||||
top = 0;
|
top = 0;
|
||||||
bottom = 40;
|
bottom = 38;
|
||||||
left = 0;
|
left = 0;
|
||||||
right = 0;
|
right = 0;
|
||||||
};
|
};
|
||||||
@@ -337,8 +337,8 @@ in
|
|||||||
FOCUSED=0xff285577
|
FOCUSED=0xff285577
|
||||||
|
|
||||||
# Background colors matching i3blocks bar
|
# Background colors matching i3blocks bar
|
||||||
BAR_BG=0xcc000000 # Semi-transparent black
|
BAR_BG=0xff333333 # Dark gray
|
||||||
ITEM_BG=0xff333333 # Dark gray for inactive items
|
ITEM_BG=0xff333333 # Dark gray matching bar
|
||||||
|
|
||||||
# Text colors
|
# Text colors
|
||||||
TEXT=0xffffffff # White text
|
TEXT=0xffffffff # White text
|
||||||
@@ -351,29 +351,32 @@ in
|
|||||||
# Configure the bar appearance
|
# Configure the bar appearance
|
||||||
${pkgs.sketchybar}/bin/sketchybar --bar \
|
${pkgs.sketchybar}/bin/sketchybar --bar \
|
||||||
position=bottom \
|
position=bottom \
|
||||||
height=32 \
|
height=30 \
|
||||||
color=$BAR_BG \
|
color=$BAR_BG \
|
||||||
border_width=0 \
|
border_width=0 \
|
||||||
corner_radius=0 \
|
corner_radius=0 \
|
||||||
padding_left=10 \
|
padding_left=10 \
|
||||||
padding_right=10
|
padding_right=10 \
|
||||||
|
shadow=off \
|
||||||
|
topmost=on \
|
||||||
|
sticky=on
|
||||||
|
|
||||||
# Set default properties for all items
|
# Set default properties for all items
|
||||||
# Using monospace font to match waybar's Fira Code styling
|
# Using monospace font to match waybar's Fira Code styling
|
||||||
${pkgs.sketchybar}/bin/sketchybar --default \
|
${pkgs.sketchybar}/bin/sketchybar --default \
|
||||||
updates=when_shown \
|
updates=when_shown \
|
||||||
icon.font="SF Mono:Regular:13.0" \
|
icon.font="Fira Code:Regular:13.0" \
|
||||||
icon.color=$TEXT \
|
icon.color=$TEXT \
|
||||||
icon.padding_left=4 \
|
icon.padding_left=4 \
|
||||||
icon.padding_right=4 \
|
icon.padding_right=4 \
|
||||||
label.font="SF Mono:Regular:13.0" \
|
label.font="Fira Code:Regular:13.0" \
|
||||||
label.color=$TEXT \
|
label.color=$TEXT \
|
||||||
label.padding_left=4 \
|
label.padding_left=4 \
|
||||||
label.padding_right=4 \
|
label.padding_right=4 \
|
||||||
padding_left=4 \
|
padding_left=4 \
|
||||||
padding_right=4 \
|
padding_right=4 \
|
||||||
background.corner_radius=5 \
|
background.corner_radius=0 \
|
||||||
background.height=24
|
background.height=30
|
||||||
|
|
||||||
# Register aerospace workspace change event
|
# Register aerospace workspace change event
|
||||||
${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change
|
${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change
|
||||||
@@ -390,11 +393,12 @@ in
|
|||||||
${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \
|
${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \
|
||||||
--subscribe space.$sid aerospace_workspace_change \
|
--subscribe space.$sid aerospace_workspace_change \
|
||||||
--set space.$sid \
|
--set space.$sid \
|
||||||
|
drawing=on \
|
||||||
update_freq=2 \
|
update_freq=2 \
|
||||||
width=32 \
|
width=32 \
|
||||||
background.color=$ITEM_BG \
|
background.color=$ITEM_BG \
|
||||||
background.corner_radius=5 \
|
background.corner_radius=0 \
|
||||||
background.height=20 \
|
background.height=30 \
|
||||||
background.drawing=on \
|
background.drawing=on \
|
||||||
icon="$display" \
|
icon="$display" \
|
||||||
icon.padding_left=13 \
|
icon.padding_left=13 \
|
||||||
@@ -405,15 +409,6 @@ in
|
|||||||
script="$PLUGIN_DIR/aerospace.sh $sid"
|
script="$PLUGIN_DIR/aerospace.sh $sid"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Separator after workspaces
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --add item separator_left left \
|
|
||||||
--set separator_left \
|
|
||||||
icon="" \
|
|
||||||
label="" \
|
|
||||||
background.drawing=off \
|
|
||||||
padding_left=10 \
|
|
||||||
padding_right=10
|
|
||||||
|
|
||||||
# System monitoring modules (right side)
|
# System monitoring modules (right side)
|
||||||
# Note: Items added to 'right' appear in reverse order (last added = leftmost)
|
# Note: Items added to 'right' appear in reverse order (last added = leftmost)
|
||||||
# Adding in reverse to get: disk | cpu | memory | battery | volume | calendar
|
# Adding in reverse to get: disk | cpu | memory | battery | volume | calendar
|
||||||
@@ -425,14 +420,6 @@ in
|
|||||||
background.drawing=on \
|
background.drawing=on \
|
||||||
script="$PLUGIN_DIR/calendar.sh"
|
script="$PLUGIN_DIR/calendar.sh"
|
||||||
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --add item separator_media right \
|
|
||||||
--set separator_media \
|
|
||||||
icon="|" \
|
|
||||||
label="" \
|
|
||||||
background.drawing=off \
|
|
||||||
padding_left=5 \
|
|
||||||
padding_right=5
|
|
||||||
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --add item volume right \
|
${pkgs.sketchybar}/bin/sketchybar --add item volume right \
|
||||||
--set volume \
|
--set volume \
|
||||||
background.color=$ITEM_BG \
|
background.color=$ITEM_BG \
|
||||||
@@ -448,14 +435,6 @@ in
|
|||||||
script="$PLUGIN_DIR/battery.sh" \
|
script="$PLUGIN_DIR/battery.sh" \
|
||||||
--subscribe battery system_woke power_source_change
|
--subscribe battery system_woke power_source_change
|
||||||
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --add item separator_sys right \
|
|
||||||
--set separator_sys \
|
|
||||||
icon="|" \
|
|
||||||
label="" \
|
|
||||||
background.drawing=off \
|
|
||||||
padding_left=5 \
|
|
||||||
padding_right=5
|
|
||||||
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --add item memory right \
|
${pkgs.sketchybar}/bin/sketchybar --add item memory right \
|
||||||
--set memory \
|
--set memory \
|
||||||
update_freq=5 \
|
update_freq=5 \
|
||||||
@@ -528,8 +507,15 @@ in
|
|||||||
# Get list of empty workspaces
|
# Get list of empty workspaces
|
||||||
EMPTY_WORKSPACES=$(${pkgs.aerospace}/bin/aerospace list-workspaces --monitor all --empty)
|
EMPTY_WORKSPACES=$(${pkgs.aerospace}/bin/aerospace list-workspaces --monitor all --empty)
|
||||||
|
|
||||||
# Clean up the workspace number parameter
|
# Get workspace number - from $1 if provided (event-triggered), otherwise extract from $NAME (routine update)
|
||||||
|
# $NAME is always available (e.g., "space.1", "space.2", etc.)
|
||||||
|
# $1 is only available when called via event trigger with positional argument
|
||||||
|
if [ -n "$1" ]; then
|
||||||
WORKSPACE_NUM=$(echo "$1" | tr -d ' \n\r')
|
WORKSPACE_NUM=$(echo "$1" | tr -d ' \n\r')
|
||||||
|
else
|
||||||
|
# Extract number from item name: "space.1" -> "1", "space.10" -> "10"
|
||||||
|
WORKSPACE_NUM=$(echo "$NAME" | sed 's/space\.//')
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if workspace has windows (is NOT empty)
|
# Check if workspace has windows (is NOT empty)
|
||||||
IS_EMPTY=false
|
IS_EMPTY=false
|
||||||
@@ -543,37 +529,55 @@ in
|
|||||||
IS_FOCUSED=true
|
IS_FOCUSED=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Determine display value (workspace 10 displays as "0")
|
||||||
|
if [ "$WORKSPACE_NUM" = "10" ]; then
|
||||||
|
DISPLAY="0"
|
||||||
|
else
|
||||||
|
DISPLAY="$WORKSPACE_NUM"
|
||||||
|
fi
|
||||||
|
|
||||||
# Determine visibility and styling
|
# Determine visibility and styling
|
||||||
# Always show focused workspace (even if empty) with fixed width
|
# Always show focused workspace (even if empty) with fixed width
|
||||||
# Hide non-focused empty workspaces by setting width to 0 (collapsed)
|
# Hide non-focused empty workspaces by setting width to 0 (collapsed)
|
||||||
# Show non-focused non-empty workspaces with fixed width and inactive styling
|
# Show non-focused non-empty workspaces with fixed width and inactive styling
|
||||||
|
|
||||||
if [ "$IS_FOCUSED" = "true" ]; then
|
if [ "$IS_FOCUSED" = "true" ]; then
|
||||||
# Focused workspace - always show with focused styling
|
# Focused workspace - always show with focused styling and bold font
|
||||||
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
||||||
drawing=on \
|
drawing=on \
|
||||||
|
icon="$DISPLAY" \
|
||||||
width=32 \
|
width=32 \
|
||||||
icon.padding_left=13 \
|
icon.padding_left=13 \
|
||||||
icon.padding_right=11 \
|
icon.padding_right=11 \
|
||||||
icon.align=center \
|
icon.align=center \
|
||||||
background.color=$FOCUSED_COLOR \
|
background.color=$FOCUSED_COLOR \
|
||||||
background.drawing=on \
|
background.drawing=on \
|
||||||
icon.color=$TEXT
|
icon.color=$TEXT \
|
||||||
|
icon.font="Fira Code:Bold:13.0"
|
||||||
elif [ "$IS_EMPTY" = "true" ]; then
|
elif [ "$IS_EMPTY" = "true" ]; then
|
||||||
# Empty workspace (not focused) - hide by turning off drawing
|
# Empty workspace (not focused) - hide by collapsing width and clearing content
|
||||||
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
# Using width=0 with drawing=on so updates=when_shown continues to run the script
|
||||||
drawing=off
|
|
||||||
else
|
|
||||||
# Non-empty workspace (not focused) - show with inactive styling
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
||||||
drawing=on \
|
drawing=on \
|
||||||
|
icon="" \
|
||||||
|
label="" \
|
||||||
|
width=0 \
|
||||||
|
icon.padding_left=0 \
|
||||||
|
icon.padding_right=0 \
|
||||||
|
background.drawing=off
|
||||||
|
else
|
||||||
|
# Non-empty workspace (not focused) - show with inactive styling and white text
|
||||||
|
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
||||||
|
drawing=on \
|
||||||
|
icon="$DISPLAY" \
|
||||||
width=32 \
|
width=32 \
|
||||||
icon.padding_left=13 \
|
icon.padding_left=13 \
|
||||||
icon.padding_right=11 \
|
icon.padding_right=11 \
|
||||||
icon.align=center \
|
icon.align=center \
|
||||||
background.color=$ITEM_BG \
|
background.color=$ITEM_BG \
|
||||||
background.drawing=on \
|
background.drawing=on \
|
||||||
icon.color=$GRAY
|
icon.color=$TEXT \
|
||||||
|
icon.font="Fira Code:Regular:13.0"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@@ -595,21 +599,28 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
# SketchyBar memory monitoring plugin
|
# SketchyBar memory monitoring plugin
|
||||||
|
# Shows actual memory pressure (excludes file cache/inactive pages)
|
||||||
home.file.".config/sketchybar/plugins/memory.sh" = mkIf cfg.sketchybar.enable {
|
home.file.".config/sketchybar/plugins/memory.sh" = mkIf cfg.sketchybar.enable {
|
||||||
executable = true;
|
executable = true;
|
||||||
text = ''
|
text = ''
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
MEMORY_STATS=$(vm_stat)
|
# Use awk for all arithmetic to avoid bash integer overflow on large RAM systems
|
||||||
PAGES_FREE=$(echo "$MEMORY_STATS" | grep "Pages free" | awk '{print $3}' | tr -d '.')
|
# Memory pressure = Anonymous (app memory) + Wired + Compressor RAM
|
||||||
PAGES_ACTIVE=$(echo "$MEMORY_STATS" | grep "Pages active" | awk '{print $3}' | tr -d '.')
|
# - Anonymous pages: app-allocated memory (heap, stack) - matches Activity Monitor's "App Memory"
|
||||||
PAGES_INACTIVE=$(echo "$MEMORY_STATS" | grep "Pages inactive" | awk '{print $3}' | tr -d '.')
|
# - Wired: kernel/system memory that can't be paged out
|
||||||
PAGES_WIRED=$(echo "$MEMORY_STATS" | grep "Pages wired down" | awk '{print $4}' | tr -d '.')
|
# - Pages occupied by compressor: actual RAM used by compressor (NOT "stored in compressor")
|
||||||
PAGES_COMPRESSED=$(echo "$MEMORY_STATS" | grep "Pages stored in compressor" | awk '{print $5}' | tr -d '.')
|
TOTAL_RAM=$(sysctl -n hw.memsize)
|
||||||
|
MEMORY_PERCENT=$(vm_stat | awk -v total_ram="$TOTAL_RAM" '
|
||||||
TOTAL_PAGES=$((PAGES_FREE + PAGES_ACTIVE + PAGES_INACTIVE + PAGES_WIRED + PAGES_COMPRESSED))
|
/page size of/ { page_size = $8 }
|
||||||
USED_PAGES=$((PAGES_ACTIVE + PAGES_INACTIVE + PAGES_WIRED + PAGES_COMPRESSED))
|
/Anonymous pages/ { anon = $3 + 0 }
|
||||||
MEMORY_PERCENT=$((USED_PAGES * 100 / TOTAL_PAGES))
|
/Pages wired/ { wired = $4 + 0 }
|
||||||
|
/Pages occupied by compressor/ { compressor = $5 + 0 }
|
||||||
|
END {
|
||||||
|
used = (anon + wired + compressor) * page_size
|
||||||
|
printf "%.0f", used / total_ram * 100
|
||||||
|
}
|
||||||
|
')
|
||||||
|
|
||||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$MEMORY_PERCENT%"
|
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$MEMORY_PERCENT%"
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -4,4 +4,8 @@
|
|||||||
imports = [
|
imports = [
|
||||||
../aerospace
|
../aerospace
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Override to use -d instead of --delete-older-than on Darwin due to launchd bug
|
||||||
|
# https://github.com/nix-community/home-manager/issues/7211
|
||||||
|
nix.gc.options = "-d";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,17 @@ in
|
|||||||
tree
|
tree
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Automatic garbage collection for user profile (home-manager generations).
|
||||||
|
# This complements system-level gc which only cleans system generations.
|
||||||
|
# - Linux: Uses --delete-older-than to keep 10-day rollback window
|
||||||
|
# - Darwin: Overridden to use -d in base-darwin role to avoid launchd bug
|
||||||
|
# (https://github.com/nix-community/home-manager/issues/7211)
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
randomizedDelaySec = mkIf pkgs.stdenv.isLinux "14m";
|
||||||
|
options = lib.mkDefault "--delete-older-than 10d";
|
||||||
|
};
|
||||||
|
|
||||||
# Essential programs everyone needs
|
# Essential programs everyone needs
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -41,9 +52,9 @@ in
|
|||||||
|
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "John Ogle";
|
settings = {
|
||||||
userEmail = "john@ogle.fyi";
|
user.name = "John Ogle";
|
||||||
extraConfig = {
|
user.email = "john@ogle.fyi";
|
||||||
safe.directory = "/etc/nixos";
|
safe.directory = "/etc/nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -58,8 +69,11 @@ in
|
|||||||
|
|
||||||
programs.ssh = {
|
programs.ssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
addKeysToAgent = "yes";
|
enableDefaultConfig = false;
|
||||||
matchBlocks = {
|
matchBlocks = {
|
||||||
|
"*" = {
|
||||||
|
addKeysToAgent = "yes";
|
||||||
|
};
|
||||||
"nucdeb1" = {
|
"nucdeb1" = {
|
||||||
hostname = "nucdeb1.oglehome";
|
hostname = "nucdeb1.oglehome";
|
||||||
user = "root";
|
user = "root";
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
# Platform-specific roles are imported via base-linux or base-darwin
|
# Platform-specific roles are imported via base-linux or base-darwin
|
||||||
# in each home configuration file
|
# in each home configuration file
|
||||||
imports = [
|
imports = [
|
||||||
|
./3d-printing
|
||||||
./base
|
./base
|
||||||
./communication
|
./communication
|
||||||
./desktop
|
./desktop
|
||||||
./development
|
./development
|
||||||
|
./email
|
||||||
./gaming
|
./gaming
|
||||||
./kdeconnect
|
./kdeconnect
|
||||||
./kubectl
|
./kubectl
|
||||||
|
|||||||
@@ -81,6 +81,45 @@ in
|
|||||||
enable = true;
|
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
|
# KDE environment variables for proper integration
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
QT_QPA_PLATFORMTHEME = "kde";
|
QT_QPA_PLATFORMTHEME = "kde";
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ let
|
|||||||
doomEmacs = pkgs.fetchFromGitHub {
|
doomEmacs = pkgs.fetchFromGitHub {
|
||||||
owner = "doomemacs";
|
owner = "doomemacs";
|
||||||
repo = "doomemacs";
|
repo = "doomemacs";
|
||||||
rev = "8f55404781edacf66fa330205533b002de3fb5ee";
|
rev = "762f47805ac2a6411e11747f86f7c19a03da326e";
|
||||||
sha256 = "sha256-vHwgENjip2+AFzs4oZfnKEAJKwf5Zid7fakImvxxQUw=";
|
sha256 = "sha256-0w0eXGB2cgxu/hr5wTiJSZDJw0NF+fZvLbzEylH5URU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Shared emacs packages
|
# Shared emacs packages
|
||||||
|
|||||||
@@ -159,6 +159,32 @@
|
|||||||
(dolist (module '("bbdb" "buffer" "elisp" "emacs" "gnus" "os" "search-and-replace" "url"))
|
(dolist (module '("bbdb" "buffer" "elisp" "emacs" "gnus" "os" "search-and-replace" "url"))
|
||||||
(gptel-tool-library-load-module module)))
|
(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
|
;; 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.
|
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -177,7 +177,7 @@
|
|||||||
|
|
||||||
:email
|
:email
|
||||||
;;(mu4e +org +gmail)
|
;;(mu4e +org +gmail)
|
||||||
;;notmuch
|
notmuch
|
||||||
;;(wanderlust +gmail)
|
;;(wanderlust +gmail)
|
||||||
|
|
||||||
:app
|
: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" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -343,7 +343,7 @@ in {
|
|||||||
|
|
||||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||||
modules-center = [ ];
|
modules-center = [ ];
|
||||||
modules-right = [ "disk" "cpu" "memory" "pulseaudio" "backlight" "network" "battery" "tray" "clock" ];
|
modules-right = [ "disk" "cpu" "memory" "pulseaudio" "custom/backlight-ddc" "backlight" "network" "battery" "tray" "clock" ];
|
||||||
|
|
||||||
"sway/workspaces" = {
|
"sway/workspaces" = {
|
||||||
disable-scroll = true;
|
disable-scroll = true;
|
||||||
@@ -400,6 +400,23 @@ in {
|
|||||||
tooltip = false;
|
tooltip = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"custom/backlight-ddc" = {
|
||||||
|
exec = pkgs.writeShellScript "waybar-backlight-ddc" ''
|
||||||
|
if command -v ddcutil &>/dev/null; then
|
||||||
|
# Display current brightness
|
||||||
|
brightness=$(ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}')
|
||||||
|
if [ -n "$brightness" ]; then
|
||||||
|
echo "☀️ $brightness%"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
interval = 5;
|
||||||
|
format = "{}";
|
||||||
|
on-scroll-up = "ddcutil setvcp 10 + 5 2>/dev/null &";
|
||||||
|
on-scroll-down = "ddcutil setvcp 10 - 5 2>/dev/null &";
|
||||||
|
tooltip = false;
|
||||||
|
};
|
||||||
|
|
||||||
"network" = {
|
"network" = {
|
||||||
format-wifi = "📶 {essid} ({signalStrength}%)";
|
format-wifi = "📶 {essid} ({signalStrength}%)";
|
||||||
format-ethernet = "🔌 {ipaddr}";
|
format-ethernet = "🔌 {ipaddr}";
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ with lib;
|
|||||||
enable = true;
|
enable = true;
|
||||||
autologin = true;
|
autologin = true;
|
||||||
wayland = true;
|
wayland = true;
|
||||||
|
jellyfinScaleFactor = 2.5;
|
||||||
};
|
};
|
||||||
users.enable = true;
|
users.enable = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [
|
||||||
[ # Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
#./virtual-surround.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
roles = {
|
roles = {
|
||||||
|
|||||||
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
|
let
|
||||||
version = "2.0.53";
|
version = "2.0.75";
|
||||||
|
|
||||||
srcs = {
|
srcs = {
|
||||||
aarch64-darwin = {
|
aarch64-darwin = {
|
||||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/darwin-arm64/claude";
|
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 = {
|
x86_64-darwin = {
|
||||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/darwin-x64/claude";
|
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 = {
|
x86_64-linux = {
|
||||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/linux-x64/claude";
|
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 = {
|
aarch64-linux = {
|
||||||
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/linux-arm64/claude";
|
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 {};
|
vulkanHDRLayer = pkgs.callPackage ./vulkan-hdr-layer {};
|
||||||
tea-rbw = pkgs.callPackage ./tea-rbw {};
|
tea-rbw = pkgs.callPackage ./tea-rbw {};
|
||||||
app-launcher-server = pkgs.callPackage ./app-launcher-server {};
|
app-launcher-server = pkgs.callPackage ./app-launcher-server {};
|
||||||
claude-code = pkgs.callPackage ./claude-code {};
|
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -14,6 +14,11 @@ in
|
|||||||
wayland = mkOption {
|
wayland = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
jellyfinScaleFactor = mkOption {
|
||||||
|
type = types.nullOr types.float;
|
||||||
|
default = null;
|
||||||
|
description = "Scale factor for Jellyfin Media Player UI (e.g., 1.5 for 150% scaling)";
|
||||||
|
};
|
||||||
appLauncherServer = {
|
appLauncherServer = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
@@ -37,6 +42,28 @@ in
|
|||||||
steam-library
|
steam-library
|
||||||
youtube
|
youtube
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
jellyfinMediaPlayerPkg =
|
||||||
|
if cfg.jellyfinScaleFactor != null
|
||||||
|
then pkgs.symlinkJoin {
|
||||||
|
name = "jellyfin-media-player-scaled";
|
||||||
|
paths = [ pkgs.jellyfin-media-player ];
|
||||||
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
|
postBuild = ''
|
||||||
|
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;
|
||||||
in mkIf cfg.enable
|
in mkIf cfg.enable
|
||||||
{
|
{
|
||||||
users.extraUsers.kodi = {
|
users.extraUsers.kodi = {
|
||||||
@@ -50,11 +77,18 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
jellyfinMediaPlayerPkg
|
||||||
kodiPkg
|
kodiPkg
|
||||||
wget
|
wget
|
||||||
firefox
|
firefox
|
||||||
] ++ optional cfg.appLauncherServer.enable pkgs.custom.app-launcher-server;
|
] ++ optional cfg.appLauncherServer.enable pkgs.custom.app-launcher-server;
|
||||||
|
|
||||||
|
nixpkgs.config.permittedInsecurePackages = lib.warn
|
||||||
|
"Allowing insecure package qtwebengine-5.15.19 as a jellyfin-media-player dependency. Remove this once jellyfin is updated to use qt6"
|
||||||
|
[
|
||||||
|
"qtwebengine-5.15.19"
|
||||||
|
];
|
||||||
|
|
||||||
programs.kdeconnect.enable = true;
|
programs.kdeconnect.enable = true;
|
||||||
|
|
||||||
systemd.user.services = mkIf cfg.appLauncherServer.enable {
|
systemd.user.services = mkIf cfg.appLauncherServer.enable {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ in
|
|||||||
users.users.johno = {
|
users.users.johno = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "John Ogle";
|
description = "John Ogle";
|
||||||
extraGroups = [ "wheel" "networkmanager" "audio" "video" ] ++ cfg.extraGroups;
|
extraGroups = [ "wheel" "networkmanager" "audio" "video" "i2c" ] ++ cfg.extraGroups;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.eli = mkIf cfg.kids {
|
users.users.eli = mkIf cfg.kids {
|
||||||
|
|||||||
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