Compare commits

..

1 commit

Author SHA1 Message Date
1f1c30f57c restructure with nixos modules 2023-10-08 11:44:31 +02:00
25 changed files with 359 additions and 402 deletions

8
alacritty/default.nix Normal file
View file

@ -0,0 +1,8 @@
{
config = {
programs.alacritty = {
enable = true;
settings = import ./config.nix;
};
};
}

19
bash/default.nix Normal file
View file

@ -0,0 +1,19 @@
{
config = {
programs.bash = {
enable = true;
shellAliases = {
htop = "btop";
gp = "git push";
gco = "git checkout";
gd = "git diff";
gc = "git commit";
gpl = "git pull";
gb = "git branch";
ga = "git add";
gl = "git log";
gs = "git status";
};
};
};
}

9
direnv/default.nix Normal file
View file

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

View file

@ -1,7 +1,7 @@
{nurpkgs, lib, ...}@args: {nurpkgs, lib, ...}@args:
let let
rycee-addons = nurpkgs.repos.rycee.firefox-addons; rycee-addons = nurpkgs.repos.rycee.firefox-addons;
own-addons = import ./derivations.nix args; custom-addons = import ./custom-addons.nix args;
in in
{ {
default = lib.concatLists [ default = lib.concatLists [
@ -18,7 +18,7 @@ in
boring-rss boring-rss
# rycee.bypass-paywalls-clean # rycee.bypass-paywalls-clean
]) ])
(with own-addons; [ (with custom-addons; [
http-version-indicator http-version-indicator
indicatetls indicatetls
sixindicator sixindicator
@ -28,6 +28,6 @@ in
ublock-origin ublock-origin
istilldontcareaboutcookies istilldontcareaboutcookies
keepassxc-browser keepassxc-browser
own-addons.simple-style-fox-2 custom-addons.simple-style-fox-2
]; ];
} }

51
firefox/default.nix Normal file
View file

@ -0,0 +1,51 @@
{ pkgs, ...}@args:
let
nurpkgs = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { inherit pkgs; };
firefoxAddons = import ./addons.nix (args // {inherit nurpkgs; });
firefoxSettings = {
"browser.aboutConfig.showWarning" = false;
"browser.toolbars.bookmarks.visibility" = "always";
"browser.tabs.firefox-view" = false;
"browser.shell.checkDefaultBrowser" = false;
};
in
{
config = {
programs.firefox = {
enable = true;
profiles = {
default = {
id = 0;
isDefault = true;
settings = firefoxSettings;
extensions = firefoxAddons.default;
};
sue = {
id = 1;
settings = firefoxSettings;
extensions = firefoxAddons.sue;
};
};
};
xdg.desktopEntries.firefox-sue = {
categories = [ "Network" "WebBrowser" ];
exec = "firefox -P sue --name firefox %U";
genericName = "Web Browser";
icon = "firefox";
mimeType = [
"text/html"
"text/xml"
"application/xhtml+xml"
"application/vnd.mozilla.xul+xml"
"x-scheme-handler/http"
"x-scheme-handler/https"
];
name = "Firefox | Sue";
startupNotify = true;
terminal = false;
type = "Application";
};
};
}

8
fzf/default.nix Normal file
View file

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

12
git/default.nix Normal file
View file

@ -0,0 +1,12 @@
{
config = {
programs.git = {
enable = true;
userName = "Pim Kunis";
userEmail = "pim@kunis.nl";
extraConfig = {
push.autoSetupRemote = true;
};
};
};
}

257
home.nix
View file

@ -1,23 +1,26 @@
{ pkgs, lib, ... }@args: { pkgs, ... }:
let
nurpkgs = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { inherit pkgs; };
firefox-addons = import ./firefox-addons (args // {inherit nurpkgs; });
homeDirectory = "/home/pim";
firefoxSettings = {
"browser.aboutConfig.showWarning" = false;
"browser.toolbars.bookmarks.visibility" = "always";
"browser.tabs.firefox-view" = false;
"browser.shell.checkDefaultBrowser" = false;
};
in
{ {
imports = [
./bash
./neovim
./firefox
./ssh
./syncthing
./alacritty
./keepassxc
./git
./direnv
./thunderbird
./fzf
];
home = { home = {
username = "pim"; username = "pim";
homeDirectory = homeDirectory; homeDirectory = "/home/pim";
stateVersion = "23.05"; stateVersion = "23.05";
packages = with pkgs; [ packages = with pkgs; [
keepassxc
moonlight-qt moonlight-qt
vlc vlc
nicotine-plus nicotine-plus
@ -31,204 +34,9 @@ in
]; ];
}; };
services = {
syncthing.enable = true;
};
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
chromium.enable = true; chromium.enable = true;
neovim =
let
toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in
{
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraPackages = with pkgs; [
luajitPackages.lua-lsp
rnix-lsp
xclip
wl-clipboard
];
plugins = with pkgs.vimPlugins; [
{
plugin = nvim-lspconfig;
config = toLuaFile ./nvim/plugin/lsp.lua;
}
{
plugin = comment-nvim;
config = toLua "require(\"Comment\").setup()";
}
{
plugin = gruvbox-nvim;
config = "colorscheme gruvbox";
}
neodev-nvim
nvim-cmp
{
plugin = nvim-cmp;
config = toLuaFile ./nvim/plugin/cmp.lua;
}
{
plugin = telescope-nvim;
config = toLuaFile ./nvim/plugin/telescope.lua;
}
telescope-fzf-native-nvim
cmp_luasnip
cmp-nvim-lsp
luasnip
friendly-snippets
lualine-nvim
nvim-web-devicons
{
plugin = (nvim-treesitter.withPlugins (p: [
p.tree-sitter-nix
p.tree-sitter-vim
p.tree-sitter-bash
p.tree-sitter-lua
p.tree-sitter-python
p.tree-sitter-json
]));
config = toLuaFile ./nvim/plugin/treesitter.lua;
}
vim-nix
# {
# plugin = vimPlugins.own-onedark-nvim;
# config = "colorscheme onedark";
# }
];
extraLuaConfig = ''
${builtins.readFile ./nvim/options.lua}
'';
};
alacritty = {
enable = true;
settings = import ./alacritty.nix;
};
firefox = {
enable = true;
profiles = {
default = {
id = 0;
isDefault = true;
settings = firefoxSettings;
extensions = firefox-addons.default;
};
sue = {
id = 1;
settings = firefoxSettings;
extensions = firefox-addons.sue;
};
};
};
bash = {
enable = true;
shellAliases = {
htop = "btop";
gp = "git push";
gco = "git checkout";
gd = "git diff";
gc = "git commit";
gpl = "git pull";
gb = "git branch";
ga = "git add";
gl = "git log";
gs = "git status";
};
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
git = {
enable = true;
userName = "Pim Kunis";
userEmail = "pim@kunis.nl";
extraConfig = {
core.editor = "nvim";
push.autoSetupRemote = true;
};
};
fzf = {
enable = true;
enableBashIntegration = true;
};
ssh = {
enable = true;
extraConfig = "User root";
matchBlocks = {
gitlab-sue = lib.hm.dag.entryBefore [ "*" ] {
hostname = "gitlab.com";
identityFile = "~/.ssh/sue_ed25519";
identitiesOnly = true;
};
github = lib.hm.dag.entryBefore [ "*" ] {
hostname = "github.com";
user = "pizzapim";
identitiesOnly = true;
};
lewis = lib.hm.dag.entryBefore [ "*" ] {
hostname = "lewis.hyp";
};
atlas = lib.hm.dag.entryBefore [ "*" ] {
hostname = "atlas.hyp";
};
jefke = lib.hm.dag.entryBefore [ "*" ] {
hostname = "jefke.hyp";
};
hermes = lib.hm.dag.entryBefore [ "*" ] {
hostname = "hermes.dmz";
};
maestro = lib.hm.dag.entryBefore [ "*" ] {
hostname = "maestro.dmz";
};
bancomart = lib.hm.dag.entryBefore [ "*" ] {
hostname = "bancomart.dmz";
};
handjecontantje = lib.hm.dag.entryBefore [ "*" ] {
hostname = "handjecontantje.dmz";
};
};
};
thunderbird = {
enable = true;
profiles.default = {
isDefault = true;
};
};
}; };
# Let home-manager manage the X session # Let home-manager manage the X session
@ -236,34 +44,5 @@ in
enable = true; enable = true;
}; };
xdg = { xdg.userDirs.enable = true;
configFile = {
"keepassxc/keepassxc.ini".text = lib.generators.toINI {} (import ./keepassxc.nix);
"syncthing/config.xml".source = ./syncthing.xml;
};
userDirs = {
enable = true;
music = "${homeDirectory}/sync/Music";
};
desktopEntries.firefox-sue = {
categories = [ "Network" "WebBrowser" ];
exec = "firefox -P sue --name firefox %U";
genericName = "Web Browser";
icon = "firefox";
mimeType = [
"text/html"
"text/xml"
"application/xhtml+xml"
"application/vnd.mozilla.xul+xml"
"x-scheme-handler/http"
"x-scheme-handler/https"
];
name = "Firefox | Sue";
startupNotify = true;
terminal = false;
type = "Application";
};
};
} }

8
keepassxc/default.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, lib, ...}:
{
config = {
home.packages = [ pkgs.keepassxc ];
xdg.configFile."keepassxc/keepassxc.ini".text = lib.generators.toINI {} (import ./config.nix);
};
}

36
neovim/default.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
config = {
home.packages = with pkgs; [
nil
nodePackages.pyright
neofetch
gopls
];
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
plugins = with pkgs.vimPlugins; [
nvim-lspconfig
gruvbox-nvim
leap-nvim
telescope-nvim
vim-commentary
vim-sleuth
gitsigns-nvim
nvim-cmp
cmp-nvim-lsp
friendly-snippets
neodev-nvim
];
extraLuaConfig = builtins.readFile ./neovim.lua;
};
programs.git.extraConfig.core.editor = "nvim";
};
}

124
neovim/neovim.lua Normal file
View file

@ -0,0 +1,124 @@
--[ GLOBAL ]--
vim.o.background = "dark"
vim.cmd([[colorscheme gruvbox]])
vim.g.mapleader = ";"
vim.o.signcolumn = "yes"
vim.wo.number = true
vim.wo.relativenumber = true
vim.wo.cursorline = true
--[ LSPCONFIG ]--
local on_attach = function(_, bufnr)
local bufmap = function(keys, func)
vim.keymap.set('n', keys, func, { buffer = bufnr })
end
bufmap('<leader>r', vim.lsp.buf.rename)
bufmap('<leader>a', vim.lsp.buf.code_action)
bufmap('gd', vim.lsp.buf.definition)
bufmap('gD', vim.lsp.buf.declaration)
bufmap('gI', vim.lsp.buf.implementation)
bufmap('<leader>D', vim.lsp.buf.type_definition)
bufmap('gr', require('telescope.builtin').lsp_references)
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
bufmap('K', vim.lsp.buf.hover)
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, {})
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require('neodev').setup()
require'lspconfig'.nil_ls.setup{ on_attach = on_attach, capabilities = capabilities }
require'lspconfig'.pyright.setup{ on_attach = on_attach, capabilities = capabilities }
require'lspconfig'.gopls.setup{ on_attach = on_attach, capabilities = capabilities }
--[ LEAP ]--
require('leap').add_default_mappings()
-- Don't remap 'x' in visual mode.
vim.keymap.del({'x', 'o'}, 'x')
vim.keymap.del({'x', 'o'}, 'X')
--[ TELESCOPE ]--
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, {})
require('telescope').setup{
pickers = {
find_files = {
theme = "dropdown"
},
live_grep = {
theme = "dropdown"
},
buffers = {
theme = "dropdown"
},
lsp_references = {
theme = "dropdown"
},
lsp_document_symbols = {
theme = "dropdown"
}
}
}
--[ COMMENTARY ]--
vim.cmd([[autocmd FileType nix setlocal commentstring=#\ %s]])
--[ GITSIGNS ]--
require("gitsigns").setup()
--[ CMP ]--
-- For snippets: look at https://github.com/vimjoyer/nvim-nix-video/blob/main/nvim/plugin/cmp.lua
local cmp = require('cmp')
cmp.setup {
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<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' },
},
}

View file

@ -1,19 +0,0 @@
vim.g.mapleader = ';'
vim.g.maplocalleader = ';'
vim.o.clipboard = 'unnamedplus'
vim.o.number = true
-- vim.o.relativenumber = true
vim.o.signcolumn = 'yes'
vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.updatetime = 300
vim.o.termguicolors = true
vim.o.mouse = 'a'

View file

@ -1,46 +0,0 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}

View file

@ -1,48 +0,0 @@
local on_attach = function(_, bufnr)
local bufmap = function(keys, func)
vim.keymap.set('n', keys, func, { buffer = bufnr })
end
bufmap('<leader>r', vim.lsp.buf.rename)
bufmap('<leader>a', vim.lsp.buf.code_action)
bufmap('gd', vim.lsp.buf.definition)
bufmap('gD', vim.lsp.buf.declaration)
bufmap('gI', vim.lsp.buf.implementation)
bufmap('<leader>D', vim.lsp.buf.type_definition)
bufmap('gr', require('telescope.builtin').lsp_references)
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
bufmap('K', vim.lsp.buf.hover)
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, {})
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require('neodev').setup()
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = function()
return vim.loop.cwd()
end,
cmd = { "lua-lsp" },
settings = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
}
}
require('lspconfig').rnix.setup {
on_attach = on_attach,
capabilities = capabilities,
}

View file

@ -1,11 +0,0 @@
-- Lualine
require("lualine").setup({
icons_enabled = true,
theme = 'onedark',
})
-- Colorscheme
vim.cmd("colorscheme gruvbox")
-- Comment
require("Comment").setup()

View file

@ -1,27 +0,0 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, {})
require('telescope').setup{
pickers = {
find_files = {
theme = "dropdown"
},
live_grep = {
theme = "dropdown"
},
buffers = {
theme = "dropdown"
},
lsp_references = {
theme = "dropdown"
},
lsp_document_symbols = {
theme = "dropdown"
}
}
}

View file

@ -1,9 +0,0 @@
require('nvim-treesitter.configs').setup {
ensure_installed = {},
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
}

44
ssh/default.nix Normal file
View file

@ -0,0 +1,44 @@
{ lib, ...}:
{
config = {
programs.ssh = {
enable = true;
extraConfig = "User root";
matchBlocks = {
gitlab-sue = lib.hm.dag.entryBefore [ "*" ] {
hostname = "gitlab.com";
identityFile = "~/.ssh/sue_ed25519";
identitiesOnly = true;
};
github = lib.hm.dag.entryBefore [ "*" ] {
hostname = "github.com";
user = "pizzapim";
identitiesOnly = true;
};
lewis = lib.hm.dag.entryBefore [ "*" ] {
hostname = "lewis.hyp";
};
atlas = lib.hm.dag.entryBefore [ "*" ] {
hostname = "atlas.hyp";
};
jefke = lib.hm.dag.entryBefore [ "*" ] {
hostname = "jefke.hyp";
};
hermes = lib.hm.dag.entryBefore [ "*" ] {
hostname = "hermes.dmz";
};
maestro = lib.hm.dag.entryBefore [ "*" ] {
hostname = "maestro.dmz";
};
bancomart = lib.hm.dag.entryBefore [ "*" ] {
hostname = "bancomart.dmz";
};
handjecontantje = lib.hm.dag.entryBefore [ "*" ] {
hostname = "handjecontantje.dmz";
};
};
};
};
}

9
syncthing/default.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, ... }:
{
config = {
services.syncthing.enable = true;
xdg.configFile."syncthing/config.xml".source = ./syncthing.xml;
xdg.userDirs.music = "${config.home.homeDirectory}/sync/Music";
};
}

10
thunderbird/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
config = {
programs.thunderbird = {
enable = true;
profiles.default = {
isDefault = true;
};
};
};
}