begin to modularise
This commit is contained in:
parent
bbd26675f8
commit
a1175ba492
10 changed files with 311 additions and 93 deletions
49
lib/modules/editor.nix
Normal file
49
lib/modules/editor.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{ user }: { lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
editor = config.programs.editor;
|
||||
terminal = "foot";
|
||||
menu = "wofi --show dmenu";
|
||||
in
|
||||
{
|
||||
options.programs = {
|
||||
editor = {
|
||||
enable = mkEnableOption "editor";
|
||||
package = mkPackageOption pkgs "vscodium" {
|
||||
default = pkgs.vscodium;
|
||||
example = "pkgs.vscode";
|
||||
};
|
||||
command = mkOption {
|
||||
default = "/bin/codium";
|
||||
};
|
||||
neovim = mkEnableOption "neovim mode";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf editor.enable {
|
||||
home-manager.users.${user}.imports = [{
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
package = editor.package;
|
||||
};
|
||||
}];
|
||||
|
||||
programs.scripts = [{
|
||||
name = "open-code";
|
||||
text = ''
|
||||
code_dir=~/Documents/code
|
||||
cd $code_dir
|
||||
repo=$({ ls && echo clone-repo; } | ${menu})
|
||||
case $repo in
|
||||
clone-repo)
|
||||
url=$(wl-paste)
|
||||
${terminal} -e -- git clone "$url" ;;
|
||||
*) [ -e "$repo" ] && ${editor.package}${editor.command} $repo ;;
|
||||
esac
|
||||
'';
|
||||
install = false;
|
||||
hotkey = "C";
|
||||
}];
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue