Refactor the entire configuration

With the release of the Nvidia 555 beta drivers and their improvements to
the Wayland experience I've finally decided to return to NixOS with
Hyprland again after 2 years of running Gentoo and Opensuse Tumbleweed
on X11. So this is me committing the work done so far from the last
couple of days. Future commits will be more incremental.
This commit is contained in:
caem 2024-05-24 21:33:00 +02:00
parent 97c86fb014
commit 75b13ac379
Signed by: caem
GPG key ID: 69A830D03203405F
72 changed files with 2045 additions and 196 deletions

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
# TODO: config
programs.ags = {
enable = true;
configDir = ./config;
extraPackages = with pkgs; [
gtksourceview
webkitgtk
accountsservice
];
};
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
# Todo: Make pretty
services.dunst.enable = true;
}

View file

@ -0,0 +1,389 @@
{ config, pkgs, ... }:
{
stylix.targets.firefox.enable = false;
programs.firefox = {
enable = true;
package = pkgs.firefox-esr;
policies = {
EnableTrackingProtection = {
Value = true;
Cryptomining = true;
Fingerprinting = true;
EmailTracking = true;
};
DisableTelemetry = true;
DisablePocket = true;
DisableFirefoxStudies = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DontCheckDefaultBrowser = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
NoDefaultBookmarks = true;
Cookies = {
Behaviour = "reject-foreign";
BehaviourPrivateBrowsing = "reject-foreign";
};
SearchEngines = { # ESR only
Remove = [ "Bing" "Google" "DuckDuckGo" "Wikipedia (en)" ];
};
ExtensionSettings = {
"wikipedia@search.mozilla.org" = {
installation_mode = "blocked";
};
"google@search.mozilla.org" = {
installation_mode = "blocked";
};
"bing@search.mozilla.org" = {
installation_mode = "blocked";
};
"ddg@search.mozilla.org" = {
installation_mode = "blocked";
};
};
"3rdparty".Extensions = {
"uBlock0@raymondhill.net".adminSettings = {
userSettings = {
importedLists = [
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt"
];
externalLists = "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt";
};
selectedFilterLists = [
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt"
"user-filters"
"ublock-filters"
"ublock-badware"
"ublock-privacy"
"ublock-quick-fixes"
"ublock-unbreak"
"easylist"
"adguard-generic"
"adguard-mobile"
"easyprivacy"
"adguard-spyware"
"adguard-spyware-url"
"block-lan"
"urlhaus-1"
"curben-phishing"
"plowe-0"
"dpollock-0"
"fanboy-cookiemonster"
"ublock-cookies-easylist"
"adguard-cookies"
"ublock-cookies-adguard"
"fanboy-social"
"adguard-social"
"fanboy-thirdparty_social"
"easylist-chat"
"easylist-newsletters"
"easylist-notifications"
"easylist-annoyances"
"adguard-mobile-app-banners"
"adguard-other-annoyances"
"adguard-popup-overlays"
"adguard-widgets"
"ublock-annoyances"
"ALB-0"
"BGR-0"
"CHN-0"
"CZE-0"
"DEU-0"
"EST-0"
"ara-0"
"spa-1"
"spa-0"
"FIN-0"
"FRA-0"
"GRC-0"
"HRV-0"
"HUN-0"
"IDN-0"
"ISR-0"
"IND-0"
"IRN-0"
"ISL-0"
"ITA-0"
"JPN-1"
"KOR-1"
"LTU-0"
"LVA-0"
"MKD-0"
"NLD-0"
"NOR-0"
"POL-0"
"POL-2"
"ROU-1"
"RUS-0"
"SWE-1"
"SVN-0"
"THA-0"
"TUR-0"
"VIE-1"
];
};
};
};
profiles.shaga = {
isDefault = true;
search = {
default = "Gruble";
order = [ "Gruble" "Nix Packages" "Home-manager options" ];
engines = {
"Gruble" = {
urls = [
{
template = "https://gruble.de/search";
params = [
{ name = "q"; value = "{searchTerms}"; }
];
}
];
iconUpdateURL = "https://gruble.de/favicon.ico";
updateInterval = 7 * 24 * 60 * 60 * 1000; # Weekly
definedAliases = [ "@g" ];
};
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
iconUpdateURL = "https://nixos.org/favicon.png";
updateInterval = 7 * 24 * 60 * 60 * 1000; # Weekly
definedAliases = [ "@np" ];
};
"Home-manager options" = {
urls = [{
template = "https://home-manager-options.extranix.com";
params = [
{ name = "release"; value = "master"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png";
updateInterval = 7 * 24 * 60 * 60 * 1000; # Weekly
definedAliases = [ "@ho" ];
};
};
force = true;
};
extensions = with config.nur.repos.rycee.firefox-addons; [
ublock-origin
image-search-options
bitwarden
skip-redirect
];
settings = {
"browser.urlbar.quicksuggest.contextualOptIn.topPosition" = false;
"extensions.postDownloadThirdPartyPrompt" = false;
"extensions.getAddons.cache.enabled" = false;
"browser.search.update" = false;
"extensions.autoDisableScopes" = 0;
"browser.startup.page" = 0;
"browser.startup.homepage" = "about:blank";
"browser.newtabpage.enabled" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.default.sites" = "";
"geo.provider.use_gpsd" = false;
"extensions.getAddons.showPane" = false;
"htmlaboutaddons.recommendations.enabled" = false;
"discovery.enabled" = false;
"browser.shopping.experience2023.enabled" = false;
"app.shield.optoutstudies.enabled" = false;
"app.normandy.enabled" = false;
"app.normandy.api_url" = "";
"breakpad.reportURL" = "";
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.search.serpEventTelemetry.enabled" = false;
"dom.security.unexpected_system_load_telemetry_enabled" = false;
"network.trr.confirmation_telemetry_enabled" = false;
"security.app_menu.recordEventTelemetry" = false;
"security.certerrors.recordEventTelemetry" = false;
"security.protectionspopup.recordEventTelemetry" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.pioneer-new-studies-available" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"toolkit.telemetry.server" = "127.0.0.1";
"browser.newtabpage.activity-stream.telemetry.structuredIngestion.endpoint" = "127.0.0.1";
"browser.tabs.crashReporting.sendReport" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
"captivedetect.canonicalURL" = "";
"network.captive-portal-service.enabled" = false;
"network.connectivity-service.enabled" = false;
"browser.safebrowsing.downloads.remote.enabled" = false;
"browser.urlbar.speculativeConnect.enabled" = false;
"browser.search.suggest.enabled" = false;
"browser.urlbar.suggest.quicksuggest.nonsponsored" = false;
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
"browser.urlbar.suggest.searches" = false;
"browser.urlbar.suggest.bookmark" = false;
"browser.urlbar.suggest.addons" = false;
"browser.urlbar.suggest.calculator" = false;
"browser.urlbar.suggest.clipboard" = false;
"browser.urlbar.suggest.engines" = false;
"browser.urlbar.suggest.history" = false;
"browser.urlbar.suggest.mdn" = false;
"browser.urlbar.suggest.openpage" = false;
"browser.urlbar.suggest.pocket" = false;
"browser.urlbar.suggest.recentsearches" = false;
"browser.urlbar.suggest.remotetab" = false;
"browser.urlbar.suggest.topsites" = false;
"browser.urlbar.suggest.trending" = false;
"browser.urlbar.suggest.weather" = false;
"browser.urlbar.suggest.yelp" = false;
"browser.urlbar.richSuggestions.tail" = false;
"browser.urlbar.quicksuggest.shouldShowOnboardingDialog" = false;
"browser.urlbar.quicksuggest.rustEnabled" = false;
"browser.urlbar.richSuggestions.featureGate" = false;
"browser.urlbar.trending.featureGate" = false;
"browser.urlbar.addons.featureGate" = false;
"browser.urlbar.mdn.featureGate" = false;
"browser.urlbar.pocket.featureGate" = false;
"browser.urlbar.weather.featureGate" = false;
"browser.formfill.enable" = false;
"dom.forms.autocomplete.formautofill" = false;
"extensions.formautofill.addresses.capture.enabled" = false;
"extensions.formautofill.creditCards.enabled" = false;
"signon.autofillForms" = false;
"signon.rememberSignons" = false;
"signon.formlessCapture.enabled" = false;
"network.auth.subresource-http-auth-allow" = 1;
"dom.security.https_only_mode" = true;
"network.http.referer.XOriginTrimmingPolicy" = 2;
"privacy.userContext.enabled" = true;
"privacy.userContext.ui.enabled" = true;
"privacy.sanitize.sanitizeOnShutdown" = true;
"privacy.clearHistory.siteSettings" = true;
"media.peerconnection.ice.no_host" = true;
"browser.download.start_downloads_in_tmp_dir" = true;
"browser.helperApps.deleteTempFileOnExit" = true;
"browser.uitour.enabled" = false;
"pdfjs.enableScripting" = false;
"browser.download.useDownloadDir" = false;
"browser.download.alwaysOpenPanel" = true;
"browser.download.manager.addToRecentDocs" = false;
"browser.download.always_ask_before_handling_new_types" = true;
"browser.contentblocking.category" = "strict";
"privacy.clearOnShutdown.cache" = true;
"privacy.clearOnShutdown.downloads" = true;
"privacy.clearOnShutdown.formdata" = true;
"privacy.clearOnShutdown.history" = true;
"privacy.clearOnShutdown.sessions" = true;
"privacy.clearOnShutdown.cookies" = true;
"privacy.clearOnShutdown.offlineApps" = true;
"privacy.clearSiteData.historyFormDataAndDownloads" = true;
"browser.startup.homepage_override.mstone" = "ignore";
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"browser.messaging-system.whatsNewPanel.enabled" = false;
"browser.urlbar.showSearchTerms.enabled" = false;
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned" = "";
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.searchEngines" = "";
# Options for the firefox-ui-fix using Photon
# https://github.com/black7375/Firefox-UI-Fix/blob/master/user.js
"userChrome.tab.connect_to_window" = true;
"userChrome.tab.color_like_toolbar" = true;
"userChrome.tab.lepton_like_padding" = false;
"userChrome.tab.photon_like_padding" = true;
"userChrome.tab.dynamic_separator" = false;
"userChrome.tab.static_separator" = true;
"userChrome.tab.static_separator.selected_accent" = false;
"userChrome.tab.newtab_button_like_tab" = false;
"userChrome.tab.newtab_button_smaller" = true;
"userChrome.tab.newtab_button_proton" = false;
"userChrome.icon.panel_full" = false;
"userChrome.icon.panel_photon" = true;
"userChrome.icon.panel_sparse" = false;
"userChrome.tab.box_shadow" = false;
"userChrome.tab.bottom_rounded_corner" = false;
"userChrome.tab.photon_like_contextline" = true;
"userChrome.rounding.square_tab" = true;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"svg.context-properties.content.enabled" = true;
"browser.compactmode.show" = true;
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar" = false;
"layout.css.has-selector.enabled" = true;
"userChrome.compatibility.theme" = true;
"userChrome.compatibility.os" = true;
"userChrome.theme.built_in_contrast" = true;
"userChrome.theme.system_default" = true;
"userChrome.theme.proton_color" = true;
"userChrome.theme.proton_chrome" = true;
"userChrome.theme.fully_color" = true;
"userChrome.theme.fully_dark" = true;
"userChrome.decoration.cursor" = true;
"userChrome.decoration.field_border" = true;
"userChrome.decoration.download_panel" = true;
"userChrome.decoration.animate" = true;
"userChrome.padding.tabbar_width" = true;
"userChrome.padding.tabbar_height" = true;
"userChrome.padding.toolbar_button" = true;
"userChrome.padding.navbar_width" = true;
"userChrome.padding.urlbar" = true;
"userChrome.padding.bookmarkbar" = true;
"userChrome.padding.infobar" = true;
"userChrome.padding.menu" = true;
"userChrome.padding.bookmark_menu" = true;
"userChrome.padding.global_menubar" = true;
"userChrome.padding.panel" = true;
"userChrome.padding.popup_panel" = true;
"userChrome.tab.multi_selected" = true;
"userChrome.tab.unloaded" = true;
"userChrome.tab.letters_cleary" = true;
"userChrome.tab.close_button_at_hover" = true;
"userChrome.tab.sound_hide_label" = true;
"userChrome.tab.sound_with_favicons" = true;
"userChrome.tab.pip" = true;
"userChrome.tab.container" = true;
"userChrome.tab.crashed" = true;
"userChrome.fullscreen.overlap" = true;
"userChrome.fullscreen.show_bookmarkbar" = true;
"userChrome.icon.library" = true;
"userChrome.icon.panel" = true;
"userChrome.icon.menu" = true;
"userChrome.icon.context_menu" = true;
"userChrome.icon.global_menu" = true;
"userChrome.icon.global_menubar" = true;
"userChrome.icon.1-25px_stroke" = true;
"userContent.player.ui" = true;
"userContent.player.icon" = true;
"userContent.player.noaudio" = true;
"userContent.player.size" = true;
"userContent.player.click_to_play" = true;
"userContent.player.animate" = true;
"userContent.newTab.full_icon" = true;
"userContent.newTab.animate" = true;
"userContent.newTab.pocket_to_last" = true;
"userContent.newTab.searchbar" = true;
"userContent.page.field_border" = true;
"userContent.page.illustration" = true;
"userContent.page.proton_color" = true;
"userContent.page.dark_mode" = true;
"userContent.page.proton" = true;
};
};
};
}

View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
{
programs.foot = {
enable = true;
settings = {
main = {
pad = "8x8 center";
};
mouse = {
hide-when-typing = "yes";
};
scrollback = {
lines = 10000;
};
};
};
}

View file

@ -1,13 +1,14 @@
{ config, lib, pkgs, ... }:
{ ... }:
{
programs.git = {
enable = true;
userName = "caem";
userEmail = "caem@dirae.org";
userEmail = "me@caem.dev";
signing = {
key = "D125101DC74D392FEFDFD54AF4F7229F8B860E9F";
key = "E50FC66B5062070DC462661C69A830D03203405F";
signByDefault = true;
};
};
}

View file

@ -0,0 +1,98 @@
{ config, lib, pkgs, ... }:
{
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.systemd.enable = true;
wayland.windowManager.hyprland.systemd.variables = ["--all"];
wayland.windowManager.hyprland.settings = {
"$mod" = "SUPER";
"$terminal" = "foot";
"$menu" = "rofi -show drun";
monitor = "DP-3,1920x1080@144,auto,1";
input = {
kb_layout = "gb:altgr-intl";
follow_mouse = 1;
};
general = {
gaps_in = 5;
gaps_out = 10;
border_size = 1;
layout = "master";
};
master = {
new_is_master = false;
mfact = 0.5;
};
decoration = {
rounding = 5;
blur = {
enabled = true;
size = 3;
passes = 1;
};
};
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
bind = [
"$mod, P, exec, $menu"
"$mod, RETURN, exec, $terminal"
"$mod SHIFT, C, killactive"
"$mod, SPACE, togglefloating"
"$mod SHIFT, M, exit,"
"$mod SHIFT, RETURN, layoutmsg, swapwithmaster"
"$mod SHIFT, h, layoutmsg, mfact -0.05"
"$mod SHIFT, l, layoutmsg, mfact +0.05"
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
];
};
services.hyprpaper = {
enable = true;
settings = {
ipc = "off";
splash = false;
preload = [
"/nix/config/assets/wallpaper.png"
];
wallpaper = [
",/nix/config/assets/wallpaper.png"
];
};
};
}

9
users/hu/packages/nh.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
programs.nh = {
enable = true;
flake = "/nix/config";
};
}

View file

@ -0,0 +1,3 @@
require"settings"
require"plugins"

View file

@ -0,0 +1,7 @@
return {
"m4xshen/autoclose.nvim",
config = function()
require"autoclose".setup()
end
}

View file

@ -0,0 +1,55 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
{
"tamago324/cmp-zsh",
config = function()
require"cmp_zsh".setup {
zshrc = true,
filetypes = { "bash", "zsh", "sh" },
}
end,
},
"ray-x/cmp-treesitter",
"hrsh7th/cmp-nvim-lua",
"andersevenrud/cmp-tmux",
},
config = function()
local cmp = require"cmp"
cmp.setup {
snippet = {
expand = function(args)
require"luasnip".lsp_expand(args.body)
end,
},
view = {
entries = "native",
},
mapping = cmp.mapping.preset.insert {
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-j>'] = cmp.mapping.select_next_item(),
['<A-j>'] = cmp.mapping.scroll_docs(4),
['<A-k>'] = cmp.mapping.scroll_docs(-4),
['<S-CR>'] = cmp.mapping.complete(),
['<C-Space>'] = cmp.mapping.confirm({ select = true }),
['<C-e>'] = cmp.mapping.abort(),
},
sources = {
{ name = "path" },
{ name = "luasnip" },
{ name = "zsh" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "treesitter" },
{ name = "nvim-lua" },
{ name = "tmux" },
},
}
end
}

View file

@ -0,0 +1,5 @@
return {
"numToStr/Comment.nvim",
opts = {},
lazy = false
}

View file

@ -0,0 +1,4 @@
return {
"stevearc/dressing.nvim",
opts = {}
}

View file

@ -0,0 +1,12 @@
return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
require"gruvbox".setup {
transparent_mode = true,
contrast = "soft",
}
vim.cmd("colorscheme gruvbox")
end,
}

View file

@ -0,0 +1,11 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {},
opts = {
indent = {
char = ""
}
}
}

View file

@ -0,0 +1,22 @@
if vim.fn.executable("git") ~= 1 then
vim.notify("git is not installed. Skipping plugins.", vim.log.levels.WARN)
return
end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or 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)
plugins = require"util.require_dir"(vim.fn.stdpath("config").."/lua/plugins/", true)
require"lazy".setup(plugins)

View file

@ -0,0 +1,12 @@
return {}
-- Currently using gruvbox
--[[return {
"rebelot/kanagawa.nvim",
config = function()
require"kanagawa".setup {
transparent = true
}
vim.cmd("colorscheme kanagawa-dragon")
end
}
]]--

View file

@ -0,0 +1,5 @@
return function ()
require"lspconfig".clangd.setup {
capabilities = require"cmp_nvim_lsp".default_capabilities()
}
end

View file

@ -0,0 +1,24 @@
return function()
require'lspconfig'.lua_ls.setup {
capabilities = require"cmp_nvim_lsp".default_capabilities(),
on_init = function(client)
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
return
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
version = 'LuaJIT'
},
workspace = {
checkThirdParty = false,
library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
}
}
end

View file

@ -0,0 +1,6 @@
return function ()
require"lspconfig".nil_ls.setup {
capabilities = require"cmp_nvim_lsp".default_capabilities()
}
end

View file

@ -0,0 +1,5 @@
return function ()
require"lspconfig".intelephense. setup {
capabilities = require"cmp_nvim_lsp".default_capabilities(),
}
end

View file

@ -0,0 +1,29 @@
return {
"neovim/nvim-lspconfig",
config = function()
local require_dir = require"util.require_dir"
local lspees = require_dir(vim.fn.stdpath("config").."/lua/plugins/lsp/", "plugins.lsp")
for _, lspee in ipairs(lspees) do
lspee()
end
local map = require"util.map"
local vlb = vim.lsp.buf
local format = function()
vlb.format { async = true }
end
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function()
map("n", "<leader>lgD", vlb.declaration, "[l]sp [g]o to [D]eclaration")
map("n", "<leader>lgd", vlb.definition, "[l]sp [g]o to [d]definition")
map("n", "<leader>lgi", vlb.implementation, "[l]sp [g]o to [i]mplementation")
map("n", "<leader>lgr", vlb.references, "[l]sp [g]o to [r]eferences")
map("n", "<leader>lh", vlb.hover, "[l]sp [h]over over selection")
map("n", "<leader>lfm", format, "[l]sp [f]or[m]at file")
map("n", "<leader>lca", vlb.code_action, "[l]sp [C]ode [a]ction")
end,
})
end
}

View file

@ -0,0 +1,139 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
-- Inspired by https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/evil_lualine.lua
local rgb_to_hex = require"util.rgb_to_hex"
local hl = require"util.hl"
local config = {
options = {
component_separators = "",
section_separators = "",
theme = {
normal = {
c = {
fg = rgb_to_hex(hl("Normal").fg),
bg = rgb_to_hex(hl("Normal").bg),
},
},
inactive = {
c = {
fg = rgb_to_hex(hl("Normal").fg),
bg = rgb_to_hex(hl("Normal").bg),
},
},
},
},
sections = {
lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, -- Remove defaults
lualine_c = {}, lualine_x = {}, -- Extend these later
},
inactive_sections = {
lualine_a = {}, lualine_b = {}, lualine_c = {}, lualine_x = {}, lualine_y = {}, lualine_z = {},
},
}
local function buffer_not_empty()
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end
local function ins_l(component)
table.insert(config.sections.lualine_c, component)
end
local function ins_r(component)
table.insert(config.sections.lualine_x, component)
end
local distro = require"util.get_distro"()
ins_l {
function()
return ""
end,
padding = {
left = 0,
right = 0,
},
color = {
fg = rgb_to_hex(hl("Comment").fg),
},
}
ins_l {
function()
return distro.traits.icon
end,
color = {
fg = distro.traits.color,
},
}
ins_l {
"filename",
cond = buffer_not_empty,
color = {
fg = rgb_to_hex(hl("Operator").fg),
}
}
ins_l {
"filesize",
cond = buffer_not_empty,
}
ins_l {
"o:encoding",
cond = buffer_not_empty,
}
ins_l {
"fileformat",
icons_enabled = false,
cond = buffer_not_empty,
}
ins_r { "diagnostics" }
ins_r { "diff" }
ins_r {
"branch",
padding = {
right = 0,
},
color = {
fg = rgb_to_hex(hl("Constant").fg)
}
}
ins_r {
"location",
}
ins_r {
"mode",
fmt = string.lower,
color = {
fg = rgb_to_hex(hl("String").fg),
}
}
ins_r {
function()
return ""
end,
padding = {
left = 0,
right = 0,
},
color = {
fg = rgb_to_hex(hl("Comment").fg),
}
}
require"lualine".setup(config)
end
}

View file

@ -0,0 +1,6 @@
return {
"norcalli/nvim-colorizer.lua",
config = function()
require"colorizer".setup()
end,
}

View file

@ -0,0 +1,30 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require"telescope".setup {}
local tb = require"telescope.builtin"
local map = require"util.map"
-- Default pickers
map("n", "<leader>tf", function()
if vim.fn.isdirectory(".git") ~= 0 then
tb.git_files()
else
tb.find_files()
end
end, "[T]elescope [f]iles")
map("n", "<leader>tg", tb.live_grep, "[T]elescope [g]rep")
map("n", "<leader>tb", tb.buffers, "[T]elescope [b]uffers")
map("n", "<leader>tm", function()
tb.man_pages({ "ALL" })
end, "[T]elescope [m]an pages")
map("n", "<leader>tk", tb.keymaps, "[T]elescope [k]eymaps")
map("n", "<leader>tk", tb.keymaps, "[T]elescope [k]eymaps")
-- LSP pickers
map("n", "<leader>tld", tb.diagnostics, "[T]elescope [l]sp [d]iagnostics")
map("n", "<leader>tlr", tb.lsp_references, "[T]elescope [l]sp [r]eferences")
end,
}

View file

@ -0,0 +1,15 @@
return {
"nvim-treesitter/nvim-treesitter",
config = function()
require"nvim-treesitter.configs".setup {
ensure_installed = "all", -- pipebomb
highlight = {
enable = true,
},
indent = {
enable = true,
},
}
end,
run = ":TSUpdate",
}

View file

@ -0,0 +1,10 @@
-- 2 indentation languages
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.lua", "*.nix"},
callback = function()
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
end
})

View file

@ -0,0 +1,3 @@
require"settings.options"
require"settings.autocmds"
require"settings.keymaps"

View file

@ -0,0 +1,7 @@
local map = require"util.map"
map("n", "<Space>", "<Nop>", "Mapleader")
vim.g.mapleader = " "
map("n", "<leader>df", vim.diagnostic.open_float, "[D]iagnostics [f]loat")

View file

@ -0,0 +1,25 @@
local options = {
tabstop = 4,
softtabstop = 4,
shiftwidth = 4,
expandtab = true,
number = true,
relativenumber = true,
fileencoding = "utf-8",
cursorline = true,
wrap = false,
signcolumn = "yes",
swapfile = false,
errorbells = false,
undofile = true,
incsearch = true,
hlsearch = false,
backup = false,
}
for option, value in pairs(options) do
pcall(function()
vim.opt[option] = value
end)
end

View file

@ -0,0 +1,59 @@
local function distro_traits(name)
local icons = {
[ "unknown" ] = {
icon = "",
color = "#f3be25",
},
[ "debian" ] = {
icon = "",
color = "#d70a53",
},
[ "gentoo" ] = {
icon = "",
color = "#54487A",
},
[ "nixos" ] = {
icon = "",
color = "#5277C3",
},
[ "\"opensuse-tumbleweed\"" ] = {
icon = "",
color = "#73ba25",
},
}
local icon = icons[name]
if icon == nil then
icon = icons["unknown"]
end
return icon
end
return function()
local release_file = io.open("/etc/os-release", "rb")
if release_file == nil then
return {
name = "unknown",
traits = distro_traits("unknown"),
}
end
local content = vim.split(release_file:read("*a"), "\n")
local distro_id = nil
for _, line in ipairs(content) do
if string.sub(line, 0, 3) == "ID=" then
distro_id = string.sub(line, 4, -1)
goto distro_id_found
end
end
::distro_id_found::
release_file:close()
return {
name = distro_id,
traits = distro_traits(distro_id)
}
end

View file

@ -0,0 +1,7 @@
return function (name)
local hl = vim.api.nvim_get_hl(0, { name = name })
while hl.link ~= nil do
hl = vim.api.nvim_get_hl(0, { name = hl.link })
end
return hl
end

View file

@ -0,0 +1,9 @@
return function(mode, key, mapping, comment)
local opts = {
noremap = true,
silent = true,
desc = comment
}
vim.keymap.set(mode, key, mapping, opts)
end

View file

@ -0,0 +1,27 @@
return function(dir, skip_init)
local returns = {}
local lua_files = vim.split(vim.fn.glob(dir.."/*.lua"), "\n")
local namespace = string.gsub(dir, vim.fn.stdpath("config").."/lua/", "")
namespace = string.gsub(namespace, "%/", ".")
for _, file in ipairs(lua_files) do
file = string.gsub(file, "%.lua", "")
file = string.gsub(file, dir.."/", namespace)
if skip_init and file == namespace.."init" then
goto continue
end
local require_ok, require_return = pcall(require, file)
if require_ok then
table.insert(returns, require_return)
else
vim.notify("Could not require file: '"..file.."': "..require_return, vim.log.levels.WARNING)
end
::continue::
end
return returns
end

View file

@ -0,0 +1,11 @@
return function(rgb)
if rgb == nil then
return nil
end
local r = string.format("%02x", (rgb / 65536) % 256)
local g = string.format("%02x", (rgb / 256) % 256)
local b = string.format("%02x", rgb % 256)
return "#"..r..g..b
end

View file

@ -0,0 +1,22 @@
{ pkgs, config, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
extraPackages = with pkgs; [
lua-language-server
nodePackages.intelephense
clang-tools
ripgrep
nil
gcc
];
};
home.file."${config.xdg.configHome}/nvim" = {
source = ./config;
recursive = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, pkgs, stylix, ... }:
{
stylix.targets.rofi.enable = false;
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
theme = "gruvbox-dark-hard";
};
}

View file

@ -0,0 +1,39 @@
{ pkgs, ... }:
{
stylix = {
image = ../../../assets/wallpaper.png;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
fonts = {
monospace = {
package = pkgs.nerdfonts;
name = "Go Mono Nerd Font";
};
};
fonts = {
sizes = {
terminal = 13;
popups = 13;
applications = 10;
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
targets = {
grub.enable = false;
};
opacity = {
terminal = 0.9;
popups = 0.9;
};
};
}

View file

@ -1,6 +1,7 @@
{ pkgs, ... }:
{ ... }:
{
# TODO: Port changes over from dots and streamline workflow
programs.tmux = {
enable = true;
prefix = "C-Space";

View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
# Prefetch paths
source "$ZDOTDIR/conf.d/path.zsh"
for file in $ZDOTDIR/conf.d/*; do
if [[ "$file" == *"path.zsh" ]]; then
continue
fi
source "$file"
done

View file

@ -0,0 +1,4 @@
#!/usr/bin/env zsh
alias reload="exec zsh"

View file

@ -0,0 +1,11 @@
#!/usr/bin/env zsh
alias ls='ls --color=auto'
alias ll='ls -lah --color=auto'
alias grep='grep --color=auto'
term_name=$(ps -o comm= "$PPID")
if [ "$term_name" = "xterm" ] && [ -n "$(command -v "transset")" ]; then
transset -a 0.95 > /dev/null
fi

View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
if [ -z "$FZF_TAB_FILE" ] && [ ! -d "$HOME/.cache/fzf-tab" ]; then
echo "Installing fzf-tab"
git clone "https://github.com/Aloxaf/fzf-tab" "$HOME/.cache/fzf-tab"
FZF_TAB_FILE="$HOME/.cache/fzf-tab/fzf-tab.plugin.zsh"
fi
autoload -Uz compinit
compinit
source "$FZF_TAB_FILE"
zstyle ':completion:*:git-checkout:*' sort false
if [ -n "$TMUX" ]; then
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
fi

View file

@ -0,0 +1,6 @@
#!/usr/bin/env zsh
if [ -n "$(command -v qt5ct)" ] && [ -z "$DESKTOP_SESSION" ]; then
export QT_QPA_PLATFORMTHEME=qt5ct
fi

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
if [ -n "$(command -v thefuck)" ]; then
fuck() {
eval $(thefuck --alias)
fuck
}
fi

View file

@ -0,0 +1,5 @@
#!/usr/bin/env zsh
GPG_TTY=$(tty)
export GPG_TTY

View file

@ -0,0 +1,6 @@
#!/usr/bin/env zsh
if [ -n "$(command -v "nvim")" ]; then
export MANPAGER='nvim +Man!'
fi

View file

@ -0,0 +1,46 @@
#!/usr/bin/env zsh
add_to_path() {
if [ -d "$1" ] && [[ "$PATH" != *"$1"* ]]; then
PATH="$PATH:$1"
fi
}
add_to_path "$HOME/.local/bin"
# Language package mangers
if [ -n "$(command -v go)" ]; then
export GOPATH="$HOME/.local/share/go"
add_to_path "$HOME/.local/share/go/bin"
fi
if [ -n "$(command -v npm)" ]; then
if [ -f "$HOME/.npmrc" ]; then
if [ -z "$(grep prefix "$HOME/.npmrc")" ]; then
npm config set prefix "$HOME/.local/share/npm"
fi
else
npm config set prefix "$HOME/.local/share/npm"
fi
add_to_path "$HOME/.local/share/npm/bin"
fi
if [ -n "$(command -v cargo)" ]; then
export CARGO_HOME="$HOME/.local/share/cargo"
add_to_path "$HOME/.local/share/cargo/bin"
fi
if [ -n "$(command -v pip3)" ] && [ -n "$(command -v virtualenv)" ]; then
if [ ! -d "$HOME/.local/share/python3-venv" ]; then
python3 -m venv "$HOME/.local/share/python3-venv"
fi
if [ "$(grep "executable" "$HOME/.local/share/python3-venv/pyvenv.cfg" | awk '{print $3}')" \
!= "$(realpath $(command -v python3))" ]; then
python3 -m venv --upgrade "$HOME/.local/share/python3-venv"
fi
export VIRTUAL_ENV_DISABLE_PROMPT=true
source "$HOME/.local/share/python3-venv/bin/activate"
fi

View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
distro=$(cat /etc/os-release | grep -w 'ID=.*' | sed -e 's/ID=//g' | awk '{print $1}')
case "$distro" in
"debian") dicon="%F{red}%f" ;;
"gentoo") dicon="%F{magenta}%f" ;;
"\"opensuse-tumbleweed\"") dicon="%F{green} %f" ;;
"nixos") dicon="%F{cyan}%f" ;;
*) dicon="%F{yellow}[󰘧]%f" ;;
esac
setopt prompt_subst
autoload -Uz vcs_info
precmd () { vcs_info }
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f'
export PS1='$dicon %n@%m %F{green}%~%f$vcs_info_msg_0_> '

View file

@ -0,0 +1,11 @@
#!/usr/bin/env zsh
if [ -z "$DESKTOP_SESSION" ]; then
if [ -z "$(pidof gnome-keyring-daemon)" ] && [ -n "$(command -v gnome-keyring-daemon)" ]; then
{ eval $(gnome-keyring-daemon --start); } > /dev/null 2>&1
export SSH_AUTH_SOCK
else
{ eval $(ssh-agent -s); } > /dev/null 2>&1
fi
fi

View file

@ -0,0 +1,29 @@
#!/usr/bin/env zsh
export HISTFILE=~/.cache/zsh_history
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
if [ -z "$AUTOSUGGEST_FILE" ]; then
import_file="/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
else
import_file="$AUTOSUGGEST_FILE"
fi
if [ ! -f "$import_file" ]; then
if [ ! -d "$HOME/.cache/zsh-autosuggestions" ]; then
echo "Installing zsh-autosuggestions..."
git clone "https://github.com/zsh-users/zsh-autosuggestions.git" "$HOME/.cache/zsh-autosuggestions"
fi
import_file="$HOME/.cache/zsh-autosuggestions/zsh-autosuggestions.zsh"
fi
source "$import_file"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)

View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
if [ -z "$SYNTAX_FILE" ]; then
import_file="/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
else
import_file="$SYNTAX_FILE"
fi
if [ ! -f "$import_file" ]; then
if [ ! -d "$HOME/.cache/zsh-syntax-highlighting" ]; then
echo "Installing zsh-syntax-highlighting..."
git clone "https://github.com/zsh-users/zsh-syntax-highlighting.git" "$HOME/.cache/zsh-syntax-highlighting"
fi
import_file="$HOME/.cache/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
source "$import_file"

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
# Disabled until I fix my tmux config
return
if [ "$TERM" = "xterm-256color" ] && [ -x "$(command -v tmux)" ]; then
tmux new-session
fi

View file

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
home.file."/home/hu/.config/zsh/conf.d" = {
source = ./config/conf.d;
recursive = true;
};
home.file."/home/hu/.config/zsh/.zshrc" = {
text = ''
#!/usr/bin/env zsh
SYNTAX_FILE="${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
FZF_TAB_FILE="${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh"
AUTOSUGGEST_FILE="${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
'' + (builtins.readFile config/.zshrc);
};
}

View file

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
{
programs.zsh.enable = true;
environment.variables = {
ZDOTDIR = "${config.users.users.hu.home}/.config/zsh";
};
environment.systemPackages = with pkgs; [
fzf
zsh-fzf-tab
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
nix-zsh-completions
thefuck
];
}