1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-10 23:00:39 +02:00

chore: update flake

This commit is contained in:
oddlama 2025-03-15 12:44:18 +01:00
parent 74ef27adcf
commit 605b6279ca
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
8 changed files with 267 additions and 1057 deletions

665
flake.lock generated

File diff suppressed because it is too large Load diff

View file

@ -82,7 +82,7 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
nixvim = {
url = "github:nix-community/nixvim";

View file

@ -1,54 +0,0 @@
{
"name": "clock-weather-card",
"version": "2.8.7",
"description": "Lovelace clock-weather-card",
"keywords": [
"home-assistant",
"homeassistant",
"hass",
"automation",
"lovelace",
"custom-cards"
],
"module": "clock-weather-card.js",
"repository": "git@github.com:pkissling/clock-weather-card.git",
"author": "Patrick Kissling <patrick.kissling@gmx.de>",
"license": "MIT",
"type": "module",
"dependencies": {
"custom-card-helpers": "^1.8.0",
"home-assistant-js-websocket": "^9.0.0",
"lit": "^2.8.0",
"luxon": "^3.4.3"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-image": "^3.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@types/luxon": "^3.3.2",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^43.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 || ^17.0.0",
"eslint-plugin-promise": "^7.0.0",
"rollup": "^4.0.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-gzip": "^4.0.0",
"rollup-plugin-serve": "^3.0.0",
"@rollup/plugin-terser": "^0.4.0",
"rollup-plugin-typescript2": "^0.36.0",
"typescript": "*"
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
"build": "yarn rollup",
"lint": "eslint **/*.ts --max-warnings 0",
"rollup": "rollup -c"
}
}

View file

@ -1,52 +0,0 @@
{
lib,
fetchFromGitHub,
mkYarnPackage,
fetchYarnDeps,
}:
mkYarnPackage rec {
pname = "clock-weather-card";
version = "2.8.7";
src = fetchFromGitHub {
owner = "pkissling";
repo = "clock-weather-card";
rev = "v${version}";
hash = "sha256-ylJNI0DE+3j8EZFpUmuuBnII8nBMrJ5bhlGVh3M25eo=";
};
packageJSON = ./package.json;
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-EUuPF2kS6CaJ2MUYoBocLOQyOgkhRHd34ul+efJua7Q=";
};
buildPhase = ''
runHook preBuild
yarn build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir $out
cp ./deps/clock-weather-card/dist/clock-weather-card.js $out/
runHook postInstall
'';
doDist = false;
meta = with lib; {
description = "A Home Assistant Card indicating today's date/time, along with an iOS inspired weather forecast for the next days with animated icons";
homepage = "https://github.com/pkissling/clock-weather-card";
changelog = "https://github.com/pkissling/clock-weather-card/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ oddlama ];
mainProgram = "clock-weather-card";
platforms = platforms.linux;
};
}

View file

@ -65,15 +65,13 @@ in
];
customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [
(builtins.trace "soon upstreamed" (
pkgs.callPackage ./hass-lovelace/clock-weather-card/package.nix { }
))
(pkgs.callPackage ./hass-lovelace/config-template-card/package.nix { })
(pkgs.callPackage ./hass-lovelace/hui-element/package.nix { })
apexcharts-card
bubble-card
button-card
card-mod
clock-weather-card
hourly-weather
lg-webos-remote-control
mini-graph-card

View file

@ -1,192 +0,0 @@
{
config,
lib,
pkgs,
utils,
...
}:
let
cfg = config.services.wyoming.piper;
inherit (lib)
mkOption
mkEnableOption
mkPackageOption
types
;
inherit (builtins)
toString
;
inherit (utils)
escapeSystemdExecArgs
;
in
{
options.services.wyoming.piper = with types; {
package = mkPackageOption pkgs "wyoming-piper" { };
servers = mkOption {
default = { };
description = ''
Attribute set of wyoming-piper instances to spawn.
'';
type = types.attrsOf (
types.submodule (_: {
options = {
enable = mkEnableOption "Wyoming Piper server";
piper = mkPackageOption pkgs "piper-tts" { };
voice = mkOption {
type = str;
example = "en-us-ryan-medium";
description = ''
Name of the voice model to use. See the following website for samples:
https://rhasspy.github.io/piper-samples/
'';
};
uri = mkOption {
type = strMatching "^(tcp|unix)://.*$";
example = "tcp://0.0.0.0:10200";
description = ''
URI to bind the wyoming server to.
'';
};
speaker = mkOption {
type = ints.unsigned;
default = 0;
description = ''
ID of a specific speaker in a multi-speaker model.
'';
apply = toString;
};
noiseScale = mkOption {
type = numbers.between 0.0 1.0;
default = 0.667;
description = ''
Generator noise value.
'';
apply = toString;
};
noiseWidth = mkOption {
type = numbers.between 0.0 1.0;
default = 0.333;
description = ''
Phoneme width noise value.
'';
apply = toString;
};
lengthScale = mkOption {
type = numbers.between 0.0 1.0;
default = 1.0;
description = ''
Phoneme length value.
'';
apply = toString;
};
extraArgs = mkOption {
type = listOf str;
default = [ ];
description = ''
Extra arguments to pass to the server commandline.
'';
};
};
})
);
};
};
config =
let
inherit (lib)
mapAttrs'
mkIf
nameValuePair
;
in
mkIf (cfg.servers != { }) {
systemd.services = mapAttrs' (
server: options:
nameValuePair "wyoming-piper-${server}" {
inherit (options) enable;
description = "Wyoming Piper server instance ${server}";
wants = [
"network-online.target"
];
after = [
"network-online.target"
];
wantedBy = [
"multi-user.target"
];
serviceConfig = {
DynamicUser = true;
User = "wyoming-piper";
StateDirectory = [ "wyoming/piper" ];
# https://github.com/home-assistant/addons/blob/master/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run
ExecStart = escapeSystemdExecArgs (
[
(lib.getExe cfg.package)
"--data-dir"
"/var/lib/wyoming/piper"
"--uri"
options.uri
"--piper"
(lib.getExe options.piper)
"--voice"
options.voice
"--speaker"
options.speaker
"--length-scale"
options.lengthScale
"--noise-scale"
options.noiseScale
"--noise-w"
options.noiseWidth
]
++ options.extraArgs
);
CapabilityBoundingSet = "";
DeviceAllow = "";
DevicePolicy = "closed";
LockPersonality = true;
MemoryDenyWriteExecute = true;
PrivateDevices = true;
PrivateUsers = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
ProtectProc = "invisible";
ProcSubset = "pid";
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
];
RestrictNamespaces = true;
RestrictRealtime = true;
SystemCallArchitectures = "native";
SystemCallFilter = [
"@system-service"
"~@privileged"
];
UMask = "0077";
};
}
) cfg.servers;
};
}

View file

@ -1,346 +0,0 @@
{
config,
lib,
pkgs,
utils,
...
}:
let
cfg = config.services.wyoming.faster-whisper;
inherit (lib)
mkOption
mkEnableOption
mkPackageOption
types
;
inherit (builtins)
toString
;
inherit (utils)
escapeSystemdExecArgs
;
in
{
options.services.wyoming.faster-whisper = with types; {
package = mkPackageOption pkgs "wyoming-faster-whisper" { };
servers = mkOption {
default = { };
description = ''
Attribute set of wyoming-faster-whisper instances to spawn.
'';
type = types.attrsOf (
types.submodule (_: {
options = {
enable = mkEnableOption "Wyoming faster-whisper server";
model = mkOption {
type = str;
default = "tiny-int8";
example = "Systran/faster-distil-whisper-small.en";
description = ''
Name of the voice model to use. Can also be a HuggingFace model ID or a path to
a custom model directory.
Compressed models (`int8`) are slightly less accurate, but smaller and faster.
Available models:
- `tiny-int8` (compressed)
- `tiny`
- `tiny.en` (English only)
- `base-int8` (compressed)
- `base`
- `base.en` (English only)
- `small-int8` (compressed)
- `distil-small.en` (distilled, English only)
- `small`
- `small.en` (English only)
- `medium-int8` (compressed)
- `distil-medium.en` (distilled, English only)
- `medium`
- `medium.en` (English only)
- `large`
- `large-v1`
- `distil-large-v2` (distilled, English only)
- `large-v2`
- `distil-large-v3` (distilled, English only)
- `large-v3`
- `turbo` (faster than large-v3)
'';
};
uri = mkOption {
type = strMatching "^(tcp|unix)://.*$";
example = "tcp://0.0.0.0:10300";
description = ''
URI to bind the wyoming server to.
'';
};
device = mkOption {
# https://opennmt.net/CTranslate2/python/ctranslate2.models.Whisper.html#
type = types.enum [
"cpu"
"cuda"
"auto"
];
default = "cpu";
description = ''
Determines the platform faster-whisper is run on. CPU works everywhere, CUDA requires a compatible NVIDIA GPU.
'';
};
language = mkOption {
type = enum [
# https://github.com/home-assistant/addons/blob/master/whisper/config.yaml#L20
"auto"
"af"
"am"
"ar"
"as"
"az"
"ba"
"be"
"bg"
"bn"
"bo"
"br"
"bs"
"ca"
"cs"
"cy"
"da"
"de"
"el"
"en"
"es"
"et"
"eu"
"fa"
"fi"
"fo"
"fr"
"gl"
"gu"
"ha"
"haw"
"he"
"hi"
"hr"
"ht"
"hu"
"hy"
"id"
"is"
"it"
"ja"
"jw"
"ka"
"kk"
"km"
"kn"
"ko"
"la"
"lb"
"ln"
"lo"
"lt"
"lv"
"mg"
"mi"
"mk"
"ml"
"mn"
"mr"
"ms"
"mt"
"my"
"ne"
"nl"
"nn"
"no"
"oc"
"pa"
"pl"
"ps"
"pt"
"ro"
"ru"
"sa"
"sd"
"si"
"sk"
"sl"
"sn"
"so"
"sq"
"sr"
"su"
"sv"
"sw"
"ta"
"te"
"tg"
"th"
"tk"
"tl"
"tr"
"tt"
"uk"
"ur"
"uz"
"vi"
"yi"
"yue"
"yo"
"zh"
];
example = "en";
description = ''
The language used to to parse words and sentences.
'';
};
initialPrompt = mkOption {
type = nullOr str;
default = null;
example = ''
The following conversation takes place in the universe of Wizard of Oz. Key terms include 'Yellow Brick Road' (the path to follow), 'Emerald City' (the ultimate goal), and 'Ruby Slippers' (the magical tools to succeed). Keep these in mind as they guide the journey.
'';
description = ''
Optional text to provide as a prompt for the first window. This can be used to provide, or
"prompt-engineer" a context for transcription, e.g. custom vocabularies or proper nouns
to make it more likely to predict those word correctly.
'';
};
beamSize = mkOption {
type = ints.unsigned;
default = 0;
example = 5;
description = ''
The number of beams to use in beam search.
Use `0` to automatically select a value based on the CPU.
'';
apply = toString;
};
extraArgs = mkOption {
type = listOf str;
default = [ ];
description = ''
Extra arguments to pass to the server commandline.
'';
};
};
})
);
};
};
config =
let
inherit (lib)
mapAttrs'
mkIf
nameValuePair
;
in
mkIf (cfg.servers != { }) {
systemd.services = mapAttrs' (
server: options:
nameValuePair "wyoming-faster-whisper-${server}" {
inherit (options) enable;
description = "Wyoming faster-whisper server instance ${server}";
wants = [
"network-online.target"
];
after = [
"network-online.target"
];
wantedBy = [
"multi-user.target"
];
# https://github.com/rhasspy/wyoming-faster-whisper/issues/27
environment."HF_HUB_CACHE" = "/tmp";
serviceConfig = {
DynamicUser = true;
User = "wyoming-faster-whisper";
StateDirectory = [ "wyoming/faster-whisper" ];
# https://github.com/home-assistant/addons/blob/master/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run
ExecStart = escapeSystemdExecArgs (
[
(lib.getExe cfg.package)
"--data-dir"
"/var/lib/wyoming/faster-whisper"
"--uri"
options.uri
"--device"
options.device
"--model"
options.model
"--language"
options.language
"--beam-size"
options.beamSize
]
++ lib.optionals (options.initialPrompt != null) [
"--initial-prompt"
options.initialPrompt
]
++ options.extraArgs
);
CapabilityBoundingSet = "";
DeviceAllow =
if
builtins.elem options.device [
"cuda"
"auto"
]
then
[
# https://docs.nvidia.com/dgx/pdf/dgx-os-5-user-guide.pdf
"char-nvidia-uvm"
"char-nvidia-frontend"
"char-nvidia-caps"
"char-nvidiactl"
]
else
"";
DevicePolicy = "closed";
LockPersonality = true;
MemoryDenyWriteExecute = true;
PrivateUsers = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
ProtectProc = "invisible";
# "all" is required because faster-whisper accesses /proc/cpuinfo to determine cpu capabilities
ProcSubset = "all";
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
];
RestrictNamespaces = true;
RestrictRealtime = true;
SystemCallArchitectures = "native";
SystemCallFilter = [
"@system-service"
"~@privileged"
];
UMask = "0077";
};
}
) cfg.servers;
};
}

View file

@ -1,13 +1,4 @@
{
disabledModules = [
"services/home-automation/wyoming/faster-whisper.nix"
"services/home-automation/wyoming/piper.nix"
];
imports = [
(builtins.trace "remove after next flake update" ./wfw.nix)
(builtins.trace "remove after next flake update" ./pip.nix)
];
environment.persistence."/persist".directories = [
{
directory = "/var/lib/private/wyoming";