Add laptop module and remove unused dotfiles

This commit is contained in:
2024-06-25 13:12:17 -05:00
parent dee11161e8
commit 4424978387
25 changed files with 139 additions and 525 deletions

View File

@@ -115,6 +115,11 @@
system = "x86_64-linux";
common.nixpkgs = "unstable";
laptop = {
powersave.enable = true;
backlight.enable = true;
};
audio = {
pipewire.enable = true;
music.enable = true;

View File

@@ -1,9 +0,0 @@
require('config/keymaps')
require('config/settings')
require('config/plugins')
require('config/plugins/lualine')
require('config/plugins/lspconfig')
local vimscriptpath = vim.fn.stdpath("config") .. "/lua/config/vimscript/"
vim.cmd('source' .. vimscriptpath .. 'init.vim')

View File

@@ -1,15 +0,0 @@
{
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"fzf-lua": { "branch": "main", "commit": "b442569ab827f72e344236c598b02cb9dc754e9f" },
"kanagawa.nvim": { "branch": "master", "commit": "860e4f80df71221d18bf2cd9ef1deb4d364274d2" },
"lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
"nvim-lspconfig": { "branch": "master", "commit": "b972e7154bc94ab4ecdbb38c8edbccac36f83996" },
"nvim-surround": { "branch": "main", "commit": "79aaa42da1f698ed31bcbe7f83081f69dca7ba17" },
"nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"typst.vim": { "branch": "main", "commit": "d9a7650e76c85f8ba437e056d08dd43b01b8bfd6" }
}

View File

@@ -1,15 +0,0 @@
vim.g.mapleader=','
vim.g.maplocalleader=','
vim.keymap.set('n', '<C-h>', '<C-w>h')
vim.keymap.set('n', '<C-j>', '<C-w>j')
vim.keymap.set('n', '<C-k>', '<C-w>k')
vim.keymap.set('n', '<C-l>', '<C-w>l')
vim.keymap.set('n', '<leader>ff', ':FzfLua files<CR>')
vim.keymap.set('n', '<leader>fb', ':FzfLua buffers<CR>')
vim.keymap.set('n', '<leader>rg', ':FzfLua grep<CR>')
vim.keymap.set('i', '<S-Tab>', '<C-d>')
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)

View File

@@ -1,45 +0,0 @@
local plugins = {
'rebelot/kanagawa.nvim',
'nvim-lualine/lualine.nvim',
'kyazdani42/nvim-web-devicons',
'kylechui/nvim-surround',
'ibhagwan/fzf-lua',
'neovim/nvim-lspconfig',
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'rust-lang/rust.vim',
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts={},
},
{
'kaarmu/typst.vim',
ft = 'typst',
lazy = false,
},
}
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup(plugins, opts)

View File

@@ -1,59 +0,0 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = false;
local lspconfig = require('lspconfig')
lspconfig.rust_analyzer.setup {
capabilities = capabilities,
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
imports = {
group = {
enable = false,
},
},
completion = {
postfix = {
enable = false,
},
},
},
},
}
local servers = {'ccls', 'typst_lsp'}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
capabilities = capabilities
}
end
local cmp = require 'cmp'
cmp.setup {
preselect = cmp.PreselectMode.None,
mapping = cmp.mapping.preset.insert({
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
},
}

View File

@@ -1,36 +0,0 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'wombat',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {
lualine_a = {'buffers'},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {'tabs'}
},
extensions = {}
}

View File

@@ -1,38 +0,0 @@
vim.opt.cursorline=true
vim.opt.relativenumber=true
vim.opt.number=true
vim.opt.scrolloff=10
vim.opt.autoindent=true
vim.opt.expandtab=true
vim.opt.softtabstop=4
vim.opt.shiftwidth=4
vim.opt.shiftround=true
vim.opt.backspace={'indent','eol','start'}
vim.opt.hidden=true
vim.opt.laststatus=2
vim.opt.display='lastline'
vim.opt.showmode=true
vim.opt.showcmd=true
vim.opt.incsearch=true
vim.opt.ignorecase=true
vim.opt.smartcase=true
vim.opt.ttyfast=true
vim.opt.updatetime=300
vim.opt.splitright=true
vim.opt.wrapscan=true
vim.opt.report=0
vim.opt.list=true
vim.opt.completeopt=menuone,noselect
vim.opt.undofile=true
vim.g['loaded_perl_provider']=0

View File

@@ -1,9 +0,0 @@
filetype plugin indent on
syntax on
colorscheme kanagawa
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:,precedes:,nbsp:±'
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
endif

View File

@@ -36,9 +36,8 @@
boot.loader.efi.efiSysMountPoint = "/efi";
boot.loader.efi.canTouchEfiVariables = true;
powerManagement.powertop.enable = true;
hardware.graphics.enable = true;
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
fileSystems = {
"/".options = [ "compress=zstd" ];

View File

@@ -1,9 +0,0 @@
require('config/keymaps')
require('config/settings')
require('config/plugins')
require('config/plugins/lualine')
require('config/plugins/lspconfig')
local vimscriptpath = vim.fn.stdpath("config") .. "/lua/config/vimscript/"
vim.cmd('source' .. vimscriptpath .. 'init.vim')

View File

@@ -1,17 +0,0 @@
vim.g.mapleader=','
vim.g.maplocalleader=','
vim.keymap.set('n', '<C-h>', '<C-w>h')
vim.keymap.set('n', '<C-j>', '<C-w>j')
vim.keymap.set('n', '<C-k>', '<C-w>k')
vim.keymap.set('n', '<C-l>', '<C-w>l')
vim.keymap.set('n', '<leader>ff', ':FzfLua files<CR>')
vim.keymap.set('n', '<leader>fb', ':FzfLua buffers<CR>')
vim.keymap.set('n', '<leader>rg', ':FzfLua grep_project<CR>')
vim.keymap.set('i', '<S-Tab>', '<C-d>')
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)

View File

@@ -1,53 +0,0 @@
local plugins = {
'rebelot/kanagawa.nvim',
'nvim-lualine/lualine.nvim',
'kyazdani42/nvim-web-devicons',
'kylechui/nvim-surround',
'ibhagwan/fzf-lua',
'neovim/nvim-lspconfig',
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'L3MON4D3/LuaSnip',
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {},
},
{
'kaarmu/typst.vim',
ft = 'typst',
lazy = false,
},
'jalvesaq/Nvim-R',
{
'RaafatTurki/hex.nvim',
config = function()
require('hex').setup()
end
},
}
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup(plugins, opts)

View File

@@ -1,67 +0,0 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = false;
local lspconfig = require('lspconfig')
lspconfig.rust_analyzer.setup {
capabilities = capabilities,
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
imports = {
group = {
enable = false,
},
},
completion = {
postfix = {
enable = false,
},
},
},
},
}
lspconfig.omnisharp.setup {
cmd = { "dotnet", "/usr/lib/omnisharp-roslyn/OmniSharp.dll"}
}
local default_servers = {'pylsp', 'ccls', 'typst_lsp', 'r_language_server', 'lua_ls', 'nil_ls'}
for _, lsp in ipairs(default_servers) do
lspconfig[lsp].setup {
capabilities = capabilities
}
end
local luasnip = require 'luasnip'
local cmp = require 'cmp'
cmp.setup {
preselect = cmp.PreselectMode.None,
mapping = cmp.mapping.preset.insert({
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
},
}

View File

@@ -1,36 +0,0 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'wombat',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {
lualine_a = {'buffers'},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {'tabs'}
},
extensions = {}
}

View File

@@ -1,38 +0,0 @@
vim.opt.cursorline=true
vim.opt.relativenumber=true
vim.opt.number=true
vim.opt.scrolloff=10
vim.opt.autoindent=true
vim.opt.expandtab=true
vim.opt.softtabstop=4
vim.opt.shiftwidth=4
vim.opt.shiftround=true
vim.opt.backspace={'indent','eol','start'}
vim.opt.hidden=true
vim.opt.laststatus=2
vim.opt.display='lastline'
vim.opt.showmode=true
vim.opt.showcmd=true
vim.opt.incsearch=true
vim.opt.ignorecase=true
vim.opt.smartcase=true
vim.opt.ttyfast=true
vim.opt.updatetime=300
vim.opt.splitright=true
vim.opt.wrapscan=true
vim.opt.report=0
vim.opt.list=true
vim.opt.completeopt=menuone,noselect
vim.opt.undofile=true
vim.g['loaded_perl_provider']=0

View File

@@ -1,9 +0,0 @@
filetype plugin indent on
syntax on
colorscheme kanagawa
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:,precedes:,nbsp:±'
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
endif

View File

@@ -8,6 +8,7 @@
with lib; let
gui = config.simmer.gui;
laptop = config.simmer.laptop;
modifier = "Mod4";
in
{
@@ -29,73 +30,81 @@ in
config = {
modifier = modifier;
keybindings = {
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86AudioPause" = "exec playerctl play-pause";
"XF86AudioNext" = "exec playerctl next";
"XF86AudioPrev" = "exec playerctl previous";
"${modifier}+space" = "exec \"kickoff-dot-desktop | ${pkgs.kickoff}/bin/kickoff --from-stdin --stdout | xargs -d '\\n' ${pkgs.sway}/bin/swaymsg exec\"";
"${modifier}+Return" = "exec alacritty ";
"${modifier}+Control+f" = "exec MOZ_ENABLE_WAYLAND=1 firefox";
"${modifier}+Control+s" = "exec steam";
"${modifier}+Control+t" = "exec thunar";
"${modifier}+Control+d" = "exec vesktop --enable-features=WebRTCPipeWireCapturer";
"${modifier}+Control+x" = "exec feishin";
"${modifier}+Control+h" = "exec helvum";
"${modifier}+Control+p" = "exec pavucontrol";
"${modifier}+Shift+s" = "exec grip -g $(slurp)";
"${modifier}+Shift+q" = "kill";
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
"${modifier}+b" = "split h";
"${modifier}+v" = "split v";
"${modifier}+r" = "mode 'resize'";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+s" = "layout stacking";
"${modifier}+w" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+a" = "focus parent";
"${modifier}+1" = "workspace 1 ";
"${modifier}+2" = "workspace 2";
"${modifier}+3" = "workspace 3";
"${modifier}+4" = "workspace 4";
"${modifier}+5" = "workspace 5";
"${modifier}+6" = "workspace 6";
"${modifier}+7" = "workspace 7";
"${modifier}+8" = "workspace 8";
"${modifier}+9" = "workspace 9";
"${modifier}+0" = "workspace 10";
"${modifier}+Shift+1" = "move container to workspace 1";
"${modifier}+Shift+2" = "move container to workspace 2";
"${modifier}+Shift+3" = "move container to workspace 3";
"${modifier}+Shift+4" = "move container to workspace 4";
"${modifier}+Shift+5" = "move container to workspace 5";
"${modifier}+Shift+6" = "move container to workspace 6";
"${modifier}+Shift+7" = "move container to workspace 7";
"${modifier}+Shift+8" = "move container to workspace 8";
"${modifier}+Shift+9" = "move container to workspace 9";
"${modifier}+Shift+0" = "move container to workspace 10";
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+Shift+c" = "reload";
};
keybindings = mkMerge [
{
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"${modifier}+space" = "exec \"kickoff-dot-desktop | ${pkgs.kickoff}/bin/kickoff --from-stdin --stdout | xargs -d '\\n' ${pkgs.sway}/bin/swaymsg exec\"";
"${modifier}+Return" = "exec alacritty ";
"${modifier}+Control+f" = "exec MOZ_ENABLE_WAYLAND=1 firefox";
"${modifier}+Control+t" = "exec thunar";
"${modifier}+Control+h" = "exec helvum";
"${modifier}+Control+p" = "exec pavucontrol";
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
"${modifier}+b" = "split h";
"${modifier}+v" = "split v";
"${modifier}+r" = "mode 'resize'";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+s" = "layout stacking";
"${modifier}+w" = "layout tabbed";
"${modifier}+e" = "layout toggle split";
"${modifier}+a" = "focus parent";
"${modifier}+1" = "workspace 1 ";
"${modifier}+2" = "workspace 2";
"${modifier}+3" = "workspace 3";
"${modifier}+4" = "workspace 4";
"${modifier}+5" = "workspace 5";
"${modifier}+6" = "workspace 6";
"${modifier}+7" = "workspace 7";
"${modifier}+8" = "workspace 8";
"${modifier}+9" = "workspace 9";
"${modifier}+0" = "workspace 10";
"${modifier}+Shift+1" = "move container to workspace 1";
"${modifier}+Shift+2" = "move container to workspace 2";
"${modifier}+Shift+3" = "move container to workspace 3";
"${modifier}+Shift+4" = "move container to workspace 4";
"${modifier}+Shift+5" = "move container to workspace 5";
"${modifier}+Shift+6" = "move container to workspace 6";
"${modifier}+Shift+7" = "move container to workspace 7";
"${modifier}+Shift+8" = "move container to workspace 8";
"${modifier}+Shift+9" = "move container to workspace 9";
"${modifier}+Shift+0" = "move container to workspace 10";
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+s" = "exec grim -g $(slurp)";
"${modifier}+Shift+q" = "kill";
"XF86AudioPause" = "exec playerctl play-pause";
"XF86AudioNext" = "exec playerctl next";
"XF86AudioPrev" = "exec playerctl previous";
}
(mkIf gui.sway.desktop {
"${modifier}+Control+s" = "exec steam";
"${modifier}+Control+d" = "exec vesktop --enable-features=WebRTCPipeWireCapturer";
"${modifier}+Control+x" = "exec feishin";
})
(mkIf laptop.backlight.enable {
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
})
];
startup = []
++ optionals gui.sway.desktop [

View File

@@ -13,5 +13,6 @@
./common.nix
./networking.nix
./games.nix
./laptop.nix
];
}

View File

@@ -36,6 +36,8 @@ in
xdg.portal.config.common = [ "wlr" "gtk" ];
programs.thunar.enable = true;
hardware.graphics.enable = true;
fonts = {
packages = with pkgs; [
liberation_ttf

28
modules/nix/laptop.nix Normal file
View File

@@ -0,0 +1,28 @@
{ lib
, pkgs
, config
, ...
}:
with lib; let
cfg = config.simmer.laptop;
in
{
config.programs.light.enable = mkIf cfg.backlight.enable true;
config.powerManagement.powertop.enable = mkIf cfg.powersave.enable true;
config.services.auto-cpufreq = mkIf cfg.powersave.enable {
enable = true;
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
}

View File

@@ -14,5 +14,6 @@
./networking.nix
./openssh.nix
./system.nix
./laptop.nix
];
}

View File

@@ -0,0 +1,24 @@
{ lib
, pkgs
, config
, ...
}:
with lib; let
cfg = config.simmer.gui;
in
{
options.simmer.laptop = {
backlight.enable = mkOption {
description = "Whether to enable backlight control";
type = types.bool;
default = false;
};
powersave.enable = mkOption {
description = "Whether to enable powersaving programs";
type = types.bool;
default = false;
};
};
}