feat: whisper
This commit is contained in:
parent
be92190ff5
commit
6fae26733d
6 changed files with 133 additions and 3 deletions
|
|
@ -367,7 +367,11 @@ return {
|
||||||
})
|
})
|
||||||
vim.g.preview = {
|
vim.g.preview = {
|
||||||
debug = false,
|
debug = false,
|
||||||
github = true,
|
github = {
|
||||||
|
output = function(ctx)
|
||||||
|
return '/tmp/' .. vim.fn.fnamemodify(ctx.file, ':t:r') .. '.html'
|
||||||
|
end,
|
||||||
|
},
|
||||||
typst = { open = { 'sioyek', '--new-instance' } },
|
typst = { open = { 'sioyek', '--new-instance' } },
|
||||||
plantuml = true,
|
plantuml = true,
|
||||||
mermaid = true,
|
mermaid = true,
|
||||||
|
|
|
||||||
55
flake.lock
generated
55
flake.lock
generated
|
|
@ -39,6 +39,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -202,9 +220,46 @@
|
||||||
"neovim-nightly": "neovim-nightly",
|
"neovim-nightly": "neovim-nightly",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_3",
|
"nixpkgs": "nixpkgs_3",
|
||||||
|
"whisper-dictation": "whisper-dictation",
|
||||||
"zen-browser": "zen-browser"
|
"zen-browser": "zen-browser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"whisper-dictation": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1771198514,
|
||||||
|
"narHash": "sha256-5Dd0zVTh+nUf3lxrDpgQSHbr0pU40hGh/hUuRbwG790=",
|
||||||
|
"owner": "jacopone",
|
||||||
|
"repo": "whisper-dictation",
|
||||||
|
"rev": "20190a148d8bce6f0d0b78a56cc22afe02844e8f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "jacopone",
|
||||||
|
"repo": "whisper-dictation",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"zen-browser": {
|
"zen-browser": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager_2",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@
|
||||||
zen-browser.url = "github:0xc000022070/zen-browser-flake";
|
zen-browser.url = "github:0xc000022070/zen-browser-flake";
|
||||||
claude-code.url = "github:ryoppippi/claude-code-overlay";
|
claude-code.url = "github:ryoppippi/claude-code-overlay";
|
||||||
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
|
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
|
||||||
|
whisper-dictation = {
|
||||||
|
url = "github:jacopone/whisper-dictation";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
|
@ -21,6 +25,7 @@
|
||||||
zen-browser,
|
zen-browser,
|
||||||
claude-code,
|
claude-code,
|
||||||
neovim-nightly,
|
neovim-nightly,
|
||||||
|
whisper-dictation,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -87,7 +92,7 @@
|
||||||
home-manager.lib.homeManagerConfiguration {
|
home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = mkPkgs hostConfig.platform [ ];
|
pkgs = mkPkgs hostConfig.platform [ ];
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit zen-browser hostConfig;
|
inherit zen-browser whisper-dictation hostConfig;
|
||||||
};
|
};
|
||||||
modules = [ ./home/home.nix ];
|
modules = [ ./home/home.nix ];
|
||||||
};
|
};
|
||||||
|
|
@ -139,7 +144,7 @@
|
||||||
home-manager.backupFileExtension = "bak";
|
home-manager.backupFileExtension = "bak";
|
||||||
home-manager.users.barrett = import ./home/home.nix;
|
home-manager.users.barrett = import ./home/home.nix;
|
||||||
home-manager.extraSpecialArgs = {
|
home-manager.extraSpecialArgs = {
|
||||||
inherit zen-browser;
|
inherit zen-browser whisper-dictation;
|
||||||
hostConfig = xps15Config;
|
hostConfig = xps15Config;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
++ lib.optionals hostConfig.isLinux [
|
++ lib.optionals hostConfig.isLinux [
|
||||||
./modules/hyprland.nix
|
./modules/hyprland.nix
|
||||||
./modules/ui.nix
|
./modules/ui.nix
|
||||||
|
./modules/dictation.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
||||||
51
home/modules/dictation.nix
Normal file
51
home/modules/dictation.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
hostConfig,
|
||||||
|
whisper-dictation,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
modelDir = "${config.home.homeDirectory}/.local/share/whisper-models";
|
||||||
|
model = "ggml-base.bin";
|
||||||
|
modelUrl = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${model}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.packages = [
|
||||||
|
whisper-dictation.packages.${hostConfig.platform}.default
|
||||||
|
];
|
||||||
|
|
||||||
|
home.activation.downloadWhisperModel = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
if [ ! -f "${modelDir}/${model}" ]; then
|
||||||
|
run mkdir -p "${modelDir}"
|
||||||
|
run ${pkgs.curl}/bin/curl -L -o "${modelDir}/${model}" "${modelUrl}"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
xdg.configFile."whisper-dictation/config.yaml".text = builtins.toJSON {
|
||||||
|
whisper = {
|
||||||
|
model = "base";
|
||||||
|
language = "auto";
|
||||||
|
};
|
||||||
|
hotkey = {
|
||||||
|
key = "KEY_DOT";
|
||||||
|
modifiers = [ "KEY_LEFTMETA" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.services.whisper-dictation = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Whisper Dictation speech-to-text daemon";
|
||||||
|
After = [ "graphical-session.target" "ydotoold.service" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${whisper-dictation.packages.${hostConfig.platform}.default}/bin/whisper-dictation";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 5;
|
||||||
|
};
|
||||||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -95,10 +95,24 @@ in
|
||||||
"libvirt"
|
"libvirt"
|
||||||
"storage"
|
"storage"
|
||||||
"power"
|
"power"
|
||||||
|
"input"
|
||||||
];
|
];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hardware.uinput.enable = true;
|
||||||
|
|
||||||
|
systemd.user.services.ydotoold = {
|
||||||
|
description = "ydotool daemon";
|
||||||
|
wantedBy = [ "graphical-session.target" ];
|
||||||
|
partOf = [ "graphical-session.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.ydotool}/bin/ydotoold";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
programs.chromium = {
|
programs.chromium = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraOpts = {
|
extraOpts = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue