feat: bluetooth, better keybinds for vim and direnv?
This commit is contained in:
parent
5c93d9dbed
commit
79b65f3640
|
@ -47,18 +47,6 @@
|
|||
manual.manpages.enable = false;
|
||||
};
|
||||
|
||||
hardware = {
|
||||
pulseaudio = {
|
||||
enable = true;
|
||||
|
||||
# NixOS allows either a lightweight build (default) or full build of PulseAudio to be installed.
|
||||
# Only the full build has Bluetooth support, so it must be selected here.
|
||||
package = pkgs.pulseaudioFull;
|
||||
|
||||
# Extra codecs
|
||||
extraModules = [ pkgs.pulseaudio-modules-bt ];
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "21.11";
|
||||
|
||||
|
|
|
@ -11,5 +11,6 @@ function fish_user_key_bindings
|
|||
|
||||
# Use jj to exit insert mode
|
||||
bind -e -M insert \e # unbinds esc
|
||||
bind -M insert -m default jj 'commandline -f repaint'
|
||||
bind -M insert -m default jk 'commandline -f repaint'
|
||||
bind -M insert -m default kj 'commandline -f repaint'
|
||||
end
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
(defcfg
|
||||
;; For Linux
|
||||
;; input (device-file "$DEVICE") ;; gets dynamically replaced by nix
|
||||
input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
|
||||
output (uinput-sink "My KMonad output"
|
||||
;; To understand the importance of the following line, see the section on
|
||||
;; Compose-key sequences at the near-bottom of this file.
|
||||
"/run/current-system/sw/bin/sleep 1 && /run/current-system/sw/bin/setxkbmap -option compose:ralt")
|
||||
"/run/current-system/sw/bin/sleep 1 && /run/current-system/sw/bin/setxkbmap" -option compose:ralt")
|
||||
cmp-seq ralt ;; Set the compose key to `RightAlt'
|
||||
cmp-seq-delay 5 ;; 5ms delay between each compose-key sequence press
|
||||
|
||||
|
@ -27,9 +28,6 @@
|
|||
|#
|
||||
|
||||
(defalias
|
||||
mth (layer-toggle math)
|
||||
Mth (layer-toggle capital-math)
|
||||
|
||||
ga #(ralt a h) ;; alpha
|
||||
gb #(ralt b h) ;; beta
|
||||
gg #(ralt g h) ;; gamma
|
||||
|
@ -60,14 +58,30 @@
|
|||
ex #(ralt l e) ;; ∃
|
||||
lar #(ralt < -) ;; ←
|
||||
rar #(ralt - >) ;; →
|
||||
and #(ralt l c) ;; and symbol
|
||||
or #(ralt l d) ;; or symbol
|
||||
eq #(ralt e q) ;; Equivalence
|
||||
|
||||
alp #(ralt f \( ) ;; angled left parenthesis
|
||||
arp #(ralt f \) ) ;; angled right parenthesis
|
||||
|
||||
shrugFace #(ralt l s h r) ;; shrug face
|
||||
topBar #(ralt t -) ;; ¯
|
||||
)
|
||||
|
||||
;; layers
|
||||
(defalias
|
||||
mth (layer-toggle math)
|
||||
Mth (layer-toggle capital-math)
|
||||
mathExtra (layer-toggle math-extra)
|
||||
)
|
||||
|
||||
;; more "special" stuff
|
||||
(defalias
|
||||
shr #(@topBar \ \_ \_ \( @shrugFace \) \_ / @topBar) ;; ¯\_(ツ)_/¯
|
||||
|
||||
ml (tap-hold-next-release 200 @gl @mathExtra)
|
||||
mll l
|
||||
)
|
||||
|
||||
(defsrc
|
||||
|
@ -92,8 +106,17 @@
|
|||
_ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ @ex _ _ _ _ _ @alp @arp @neg _ _
|
||||
_ @shr @go @ge _ @gt _ @gu _ @go @gp _ _ _
|
||||
_ @ga @gs _ _ @gg @gth @gps @gph @gl _ _ _
|
||||
_ @ga @gs _ _ @gg @gth @gps @gph @ml _ _ _
|
||||
@Mth _ @gx _ @fal @gb _ @gm @lar @rar _ _
|
||||
_ _ _ _ @mathExtra _ _
|
||||
)
|
||||
|
||||
(deflayer math-extra
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ @eq _ _ _ _ _ @or _ _ _ _
|
||||
_ @and _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _ _ _ _ _ _
|
||||
_ _ _ _ _ _ _
|
||||
)
|
||||
|
||||
|
@ -106,4 +129,3 @@
|
|||
_ _ _ _ _ _ _
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -38,3 +38,8 @@
|
|||
<Multi_key> <f> <parenleft> : "⟨" U0357 # FANCY LEFT PAREN
|
||||
<Multi_key> <f> <parenright> : "⟩" U0358 # FANCY RIGHT PAREN
|
||||
|
||||
<Multi_key> <e> <q> : "⟷" U0359 # LOGICAL EQUIVALENCE
|
||||
<Multi_key> <l> <c> : "∧" U0360 # LOGICAL CONJUNCTION
|
||||
<Multi_key> <l> <d> : "∨" U0361 # LOGICAL DISJUNCTION
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ Table of my own keybinds. Here as documentation for myself. I am yet to include
|
|||
| ---------------- | ------------------------------------------- | ------------------ |
|
||||
| vv | Create vertical split | |
|
||||
| \<Space>\<Space> | Save | |
|
||||
| jj | Exit insert mode | |
|
||||
| _jk_ | Exit insert mode | |
|
||||
| _\<leader>k_ | Insert digraph | |
|
||||
| _\<leader>a_ | Swap last 2 used buffers | |
|
||||
| C-n | Open tree | nvim-tree |
|
||||
|
|
|
@ -21,16 +21,15 @@ function M.mapSilent(mode, lhs, rhs, opts)
|
|||
end
|
||||
|
||||
function M.setup()
|
||||
M.map("i", "jj", "<Esc>") -- Remap Esc to jj
|
||||
M.map("n", "<Space><Space>", ":w<cr>") -- Double space to sace
|
||||
M.map("n", "vv", "<C-w>v") -- Create vertical split
|
||||
|
||||
if arpeggio ~= nil then
|
||||
-- Create chords
|
||||
arpeggio.chord("n", "jl", ":w<cr>") -- Double space to sace
|
||||
arpeggio.chord("i", "jk", "<Esc>") -- Remap Esc to jk
|
||||
arpeggio.chord("i", "<Leader>k", "<C-k><cr>") -- Rebind digraph insertion to leader+k
|
||||
arpeggio.chord("inv", "<Leader>a", "<C-6><cr>") -- Rebind switching to the last pane using leader+a
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -35,8 +35,8 @@ function M.setup()
|
|||
arpeggio.chord("inv", "mo", '<Plug>MarkersJumpOutside')
|
||||
|
||||
for key, brackets in pairs(extraBrackets) do
|
||||
for _, v in ipairs(brackets) do
|
||||
A.augroup('custom-brackets' .. key, function()
|
||||
A.augroup('custom-brackets' .. key, function()
|
||||
for _, v in ipairs(brackets) do
|
||||
local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "")
|
||||
local glob = '*.' .. key
|
||||
|
||||
|
@ -46,8 +46,8 @@ function M.setup()
|
|||
end
|
||||
|
||||
A.autocmd('BufEnter', glob, action)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
./neovim.nix
|
||||
./tmux.nix
|
||||
./kmonad.nix
|
||||
./direnv.nix
|
||||
];
|
||||
}
|
||||
|
||||
|
|
10
modules/applications/direnv.nix
Normal file
10
modules/applications/direnv.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
# https://github.com/nix-community/nix-direnv
|
||||
{ pkgs, ... }: {
|
||||
home-manager.users.adrielus = {
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
|
||||
# optional for nix flakes support in home-manager 21.11, not required in home-manager unstable or 22.05
|
||||
programs.direnv.nix-direnv.enableFlakes = true;
|
||||
};
|
||||
}
|
|
@ -1,12 +1,33 @@
|
|||
{ pkgs, ... }:
|
||||
let kmonadRoot = ../../dotfiles/kmonad; in
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
kmonadRoot = ../../dotfiles/kmonad;
|
||||
kmonadInstances = [{
|
||||
config = kmonadRoot + "/keymap.kbd";
|
||||
inputDevices = [
|
||||
"/dev/input/by-path/platform-i8042-serio-0-event-kbd"
|
||||
];
|
||||
}];
|
||||
|
||||
createKmonadInstances = ({ config, inputDevices }:
|
||||
let
|
||||
configContent = builtins.readFile config;
|
||||
in
|
||||
lib.lists.map
|
||||
(device:
|
||||
"${pkgs.writeTextDir "configs/kmonad.kbd" (builtins.replaceStrings [ "$DEVICE" ] [ device ] configContent)}/kmonad.kbd"
|
||||
)
|
||||
inputDevices
|
||||
|
||||
);
|
||||
in
|
||||
{
|
||||
users.extraUsers.adrielus.extraGroups = [ "input" "uinput" ];
|
||||
|
||||
services = {
|
||||
kmonad = {
|
||||
enable = true;
|
||||
configfiles = [ (kmonadRoot + "/keymap.kbd") ];
|
||||
# configfiles = lib.lists.concatMap createKmonadInstances kmonadInstances;
|
||||
configfiles = lib.lists.map ({ config, ... }: config) kmonadInstances;
|
||||
};
|
||||
|
||||
xserver = {
|
||||
|
|
|
@ -64,6 +64,7 @@ in
|
|||
purescript-vim # purescript syntax highlighting
|
||||
nvim-comment # allows toggling line-comments
|
||||
nvim-treesitter # use treesitter for syntax highlighting
|
||||
nvim-treesitter-textobjects # the lean plugin told me to add this
|
||||
startup-nvim # splash screen
|
||||
vim-devicons # nice looking icons
|
||||
nvim-web-devicons # fork of vim-devicons?
|
||||
|
|
|
@ -7,6 +7,7 @@ let
|
|||
themePackage = builtins.getAttr theme pkgs.myFishPlugins.themes; # Dynamically pick the theme path
|
||||
in
|
||||
{
|
||||
users.defaultUserShell = pkgs.fish;
|
||||
home-manager.users.adrielus = {
|
||||
# Source every file in the theme
|
||||
xdg.configFile."fish/conf.d/plugin-${theme}.fish".text = lib.mkAfter ''
|
||||
|
|
48
modules/bluetooth.nix
Normal file
48
modules/bluetooth.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Taken from https://nixos.wiki/wiki/Bluetooth
|
||||
{ pkgs, ... }: {
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
settings = {
|
||||
General = {
|
||||
Enable = "Source,Sink,Media,Socket";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.blueman.enable = true;
|
||||
|
||||
# TODO: investigate why this does not work
|
||||
# systemd.user.services.mpris-proxy = {
|
||||
# Unit.Description = "Mpris proxy";
|
||||
# Unit.After = [ "network.target" "sound.target" ];
|
||||
# Service.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
|
||||
# Install.WantedBy = [ "default.target" ];
|
||||
# };
|
||||
|
||||
hardware = {
|
||||
pulseaudio = {
|
||||
enable = true;
|
||||
|
||||
# NixOS allows either a lightweight build (default) or full build of PulseAudio to be installed.
|
||||
# Only the full build has Bluetooth support, so it must be selected here.
|
||||
package = pkgs.pulseaudioFull;
|
||||
|
||||
# Extra codecs
|
||||
extraModules = [ pkgs.pulseaudio-modules-bt ];
|
||||
|
||||
configFile = pkgs.writeText "default.pa" ''
|
||||
load-module module-bluetooth-policy
|
||||
load-module module-bluetooth-discover
|
||||
## module fails to load with
|
||||
## module-bluez5-device.c: Failed to get device path from module arguments
|
||||
## module.c: Failed to load module "module-bluez5-device" (argument: ""): initialization failed.
|
||||
# load-module module-bluez5-device
|
||||
# load-module module-bluez5-discover
|
||||
'';
|
||||
|
||||
extraConfig = ''
|
||||
load-module module-switch-on-connect
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -9,5 +9,6 @@
|
|||
./xserver.nix
|
||||
./users.nix
|
||||
./nix.nix
|
||||
./bluetooth.nix
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue