restructured and added font

This commit is contained in:
2023-08-27 00:27:36 +02:00
parent 91adefc48e
commit 1c2fa46bce
20 changed files with 23 additions and 11 deletions

11
modules/bash.nix Normal file
View File

@ -0,0 +1,11 @@
{...}: {
config.programs.bash = {
enable = true;
shellAliases = {
ll = "ls -lh";
la = "ls -lah";
".." = "cd ..";
};
};
}

8
modules/direnv.nix Normal file
View File

@ -0,0 +1,8 @@
{...}: {
config.programs.direnv = {
enable = true;
nix-direnv.enable = true;
enableBashIntegration = true;
};
}

23
modules/firefox.nix Normal file
View File

@ -0,0 +1,23 @@
{config, ...}: {
config.programs.firefox = {
enable = true;
profiles.kristian = {
isDefault = true;
search.default = "DuckDuckGo";
search.force = true;
extensions = with config.nur.repos.rycee.firefox-addons; [
ublock-origin
umatrix
sponsorblock
sidebery
];
settings = {
"extensions.pocket.enabled" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
};
};
}

9
modules/fonts.nix Normal file
View File

@ -0,0 +1,9 @@
{pkgs, ...}: {
config = {
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
nerdfonts
];
};
}

11
modules/git.nix Normal file
View File

@ -0,0 +1,11 @@
{...}: {
config.programs.git = {
enable = true;
userName = "Kristian Krsnik";
userEmail = "git@krsnik.at";
extraConfig = {
init.defaultBranch = "main";
};
};
}

95
modules/gnome.nix Normal file
View File

@ -0,0 +1,95 @@
{
pkgs,
wallpaper,
...
}: {
config = {
home.packages = with pkgs.gnomeExtensions; [
quick-settings-audio-panel
tray-icons-reloaded
espresso
pano
];
dconf.settings = {
# Use `dconf watch /` to track stateful changes you are doing, then set them here.
"org/gnome/shell" = {
disable-user-extensions = false;
enabled-extensions = [
"quick-settings-audio-panel@rayzeq.github.io"
"places-menu@gnome-shell-extensions.gcampax.github.com"
"launch-new-instance@gnome-shell-extensions.gcampax.github.com"
"trayIconsReloaded@selfmade.pl"
"espresso@coadmunkee.github.com"
"pano@elhan.io"
];
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
gtk-theme = "Adwaita-dark";
};
"org/gnome/desktop/background" = let
width = 3840;
height = 2160;
in {
picture-uri = "file://${wallpaper.override {
preset = "nord-snow-aurora";
inherit width;
inherit height;
}}/share/wallpapers/nixos-wallpaper.png";
picture-uri-dark = "file://${wallpaper.override {
preset = "nord-night-aurora";
inherit width;
inherit height;
}}/share/wallpapers/nixos-wallpaper.png";
};
"org/gnome/desktop/wm/keybindings" = {
switch-to-workspace-left = ["<Alt>1"];
switch-to-workspace-right = ["<Alt>2"];
move-to-workspace-left = ["<Shift><Alt>1"];
move-to-workspace-right = ["<Shift><Alt>2"];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Shift><Alt>a";
command = "kgx";
name = "Console";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Shift><Alt>f";
command = "nautilus";
name = "File Manager";
};
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
];
};
"org/gnome/settings-daemon/plugins/power" = {
sleep-inactive-ac-type = "nothing"; # Automatic suspend/hibernation creates a suspend/hibernation loop
power-button-action = "suspend";
};
"org/gnome/mutter" = {
edge-tiling = true;
dynamic-workspaces = true;
};
"org/gnome/Console" = {
theme = "auto";
};
"org/gnome/simple-scan" = {
text-dpi = 300;
};
};
};
}

64
modules/nvim/cmp.lua Normal file
View File

@ -0,0 +1,64 @@
-- Set up nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- { name = 'vsnip' }, -- For vsnip users.
{ name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
require('lspconfig')['pyright'].setup {
capabilities = capabilities
}

11
modules/nvim/colors.lua Normal file
View File

@ -0,0 +1,11 @@
require('tokyonight').setup({style = 'moon',})
function ColorMyPencils(color)
color = color or 'tokyonight'
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
end
ColorMyPencils()

54
modules/nvim/default.nix Normal file
View File

@ -0,0 +1,54 @@
{pkgs, ...}: {
config.programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins;
[
telescope-nvim # fuzzy finder
tokyonight-nvim # theme
undotree # undotree
vim-fugitive # git integration
nvim-treesitter # syntax highlighting
# Autocomplete and LSP
nvim-lspconfig
nvim-cmp
cmp-nvim-lsp
luasnip
]
++ (with pkgs.vimPlugins.nvim-treesitter-parsers; [
# Parsers for syntax highlighting
nix
zig
python
vim
vimdoc
markdown
dockerfile
yaml
json
toml
lua
c
glsl
bash
]);
extraPackages = [pkgs.nodePackages.pyright];
extraLuaConfig =
builtins.readFile ./keybinds.lua
+ builtins.readFile ./colors.lua
+ builtins.readFile ./undotree.lua
+ builtins.readFile ./fugitive.lua
+ builtins.readFile ./treesitter.lua
+ builtins.readFile ./telescope.lua
+ builtins.readFile ./cmp.lua
+ builtins.readFile ./lspconfig.lua;
extraConfig = "set number relativenumber";
};
}

View File

@ -0,0 +1 @@
vim.keymap.set('n', '<leader>gs', vim.cmd.Git)

View File

@ -0,0 +1,2 @@
vim.g.mapleader = ' '
vim.keymap.set('n', '<leader>pv', vim.cmd.Ex)

View File

@ -0,0 +1,40 @@
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<C-p>', vim.diagnostic.goto_prev)
vim.keymap.set('n', '<C-n>', vim.diagnostic.goto_next)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})

View File

@ -0,0 +1,7 @@
local telescope = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', telescope.find_files, {})
vim.keymap.set('n', '<C-p>', telescope.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
telescope.grep_string({ search = vim.fn.input("Grep > ")});
end)

View File

@ -0,0 +1,8 @@
-- Treesitter
require'nvim-treesitter.configs'.setup {
highlight = {
-- `false` will disable the whole extension
enable = true,
additional_vim_regex_highlighting = false,
},
}

View File

@ -0,0 +1 @@
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)

47
modules/packages.nix Normal file
View File

@ -0,0 +1,47 @@
{
pkgs,
lib,
...
}: {
config.nixpkgs.config = {
allowUnfree = false;
allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"vscode"
"vscode-extension-MS-python-vscode-pylance"
"vscode-extension-github-copilot"
"osu-lazer"
];
};
config.home.packages = with pkgs; [
# Basic utils
unzip
magic-wormhole
# Important graphical applications
keepassxc
logseq
xournalpp
onlyoffice-bin
# Communication
webcord
telegram-desktop
signal-desktop
element-desktop
# Creative software
gimp
davinci-resolve
# Games
osu-lazer
# Misc
comma # Run any binary from the repos with a comma `, cowsay neato`
gnome-decoder
tor-browser-bundle-bin
];
}

9
modules/thunderbird.nix Normal file
View File

@ -0,0 +1,9 @@
{...}: {
config.programs.thunderbird = {
enable = true;
profiles.kristian = {
isDefault = true;
};
};
}

70
modules/vscode.nix Normal file
View File

@ -0,0 +1,70 @@
{pkgs, ...}: {
config.programs.vscode = {
enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
keybindings = [
{
key = "alt+a";
command = "editor.action.commentLine";
when = "editorTextFocus && !editorReadonly";
}
];
extensions = with pkgs.vscode-extensions; [
jnoortheen.nix-ide
arrterian.nix-env-selector
mkhl.direnv
ms-python.python
ms-python.vscode-pylance
james-yu.latex-workshop
github.copilot
davidanson.vscode-markdownlint
tamasfe.even-better-toml
asciidoctor.asciidoctor-vscode
];
userSettings = {
"window.menuBarVisibility" = "hidden";
"[nix]" = {
"editor.formatOnSave" = true;
"editor.formatOnSaveMode" = "file"; # modificationsIfAvailable does not work
};
"[python]" = {
"editor.formatOnSave" = true;
"editor.formatOnSaveMode" = "modificationsIfAvailable";
};
"[latex]" = {
"editor.formatOnSave" = true;
"editor.formatOnSaveMode" = "file"; # modificationsIfAvailable does not work
};
"[toml]" = {
"editor.formatOnSave" = true;
"editor.modificationsIfAvailable" = "file";
};
"python.formatting.autopep8Path" = "${pkgs.python311Packages.autopep8}/bin/autopep8";
"nix.enableLanguageServer" = true;
"nix.serverPath" = "${pkgs.nil}/bin/nil";
"nix.serverSettings" = {
nil = {
formatting = {command = ["${pkgs.alejandra}/bin/alejandra"];};
};
};
"direnv.path.executable" = "${pkgs.direnv}/bin/direnv";
"latex-workshop.latex.outDir" = "%DIR%/out";
"terminal.integrated.profiles.linux" = {
"bash" = {
"path" = "${pkgs.bashInteractive}/bin/bash";
"args" = [];
};
};
"terminal.integrated.defaultProfile.linux" = "bash";
"editor.fontFamily" = "'FiraCode Nerd Font'";
"editor.fontLigatures" = true;
};
};
}