commit dc51937822d9671581dc617c6fc853159b2243a8 Author: Pim Kunis Date: Sun Sep 24 14:57:48 2023 +0200 init diff --git a/alacritty.nix b/alacritty.nix new file mode 100644 index 0000000..65884af --- /dev/null +++ b/alacritty.nix @@ -0,0 +1,29 @@ +{ + # Gruvbox theme (https://github.com/alacritty/alacritty-theme/blob/master/themes/gruvbox_dark.yaml) + colors = { + primary = { + background = "0x282828"; + foreground = "0xebdbb2"; + }; + normal = { + black = "0x282828"; + red = "0xcc241d"; + green = "0x98971a"; + yellow = "0xd79921"; + blue = "0x458588"; + magenta = "0xb16286"; + cyan = "0x689d6a"; + white = "0xa89984"; + }; + bright = { + black = "0x928374"; + red = "0xfb4934"; + green = "0xb8bb26"; + yellow = "0xfabd2f"; + blue = "0x83a598"; + magenta = "0xd3869b"; + cyan = "0x8ec07c"; + white = "0xebdbb2"; + }; + }; +} diff --git a/firefox-addons/addons.json b/firefox-addons/addons.json new file mode 100644 index 0000000..4a11eba --- /dev/null +++ b/firefox-addons/addons.json @@ -0,0 +1,12 @@ +[ + { + "slug": "sixindicator" + }, + { + "slug": "indicatetls" + }, + { + "pname": "http-version-indicator", + "slug": "http2-indicator" + } +] diff --git a/firefox-addons/default.nix b/firefox-addons/default.nix new file mode 100644 index 0000000..f11a808 --- /dev/null +++ b/firefox-addons/default.nix @@ -0,0 +1,22 @@ +{pkgs, ...}@args: +let +rycee-addons = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + clearurls + cookie-autodelete + istilldontcareaboutcookies + keepassxc-browser + redirector + ublacklist + umatrix + violentmonkey + boring-rss + bypass-paywalls-clean +]; +own-addons = with import ./derivations.nix args; [ + http-version-indicator + indicatetls + sixindicator +]; +in +rycee-addons ++ own-addons diff --git a/firefox-addons/derivations.nix b/firefox-addons/derivations.nix new file mode 100644 index 0000000..915cfc7 --- /dev/null +++ b/firefox-addons/derivations.nix @@ -0,0 +1,74 @@ +{ pkgs, lib, ... }: +let + # Stolen from: https://github.com/nix-community/nur-combined/blob/master/repos/rycee/pkgs/firefox-addons/default.nix + buildFirefoxXpiAddon = lib.makeOverridable ({ stdenv ? pkgs.stdenv, fetchurl ? pkgs.fetchurl, + pname, version, addonId, url, sha256, meta, ... }: stdenv.mkDerivation { + name = "${pname}-${version}"; + + inherit meta; + + src = fetchurl { inherit url sha256; }; + + preferLocalBuild = true; + allowSubstitutes = true; + + buildCommand = '' + dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" + mkdir -p "$dst" + install -v -m644 "$src" "$dst/${addonId}.xpi" + ''; + }); +in + { + "http-version-indicator" = buildFirefoxXpiAddon { + pname = "http-version-indicator"; + version = "3.2.1"; + addonId = "spdyindicator@chengsun.github.com"; + url = "https://addons.mozilla.org/firefox/downloads/file/3767224/http2_indicator-3.2.1.xpi"; + sha256 = "be9518017334ce502a1da514542c2ca4f974217d0c8e6c7c31d518aba57c09a8"; + meta = with lib; + { + homepage = "https://github.com/bsiegel/http-version-indicator"; + description = "An indicator showing the HTTP version used to load the page in the address bar."; + mozPermissions = [ "" "tabs" "webNavigation" "webRequest" ]; + platforms = platforms.all; + }; + }; + "indicatetls" = buildFirefoxXpiAddon { + pname = "indicatetls"; + version = "0.3.0"; + addonId = "{252ee273-8c8d-4609-b54d-62ae345be0a1}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3608595/indicatetls-0.3.0.xpi"; + sha256 = "7a3b7edb1085f7b15d279c1013fac1d68f5247cfd6312d5275cb053e24a79465"; + meta = with lib; + { + homepage = "https://github.com/jannispinter/indicatetls"; + description = "Displays negotiated SSL/TLS protocol version and additional security information in the address bar"; + license = licenses.mpl20; + mozPermissions = [ + "tabs" + "webNavigation" + "webRequest" + "webRequestBlocking" + "http://*/*" + "https://*/*" + ]; + platforms = platforms.all; + }; + }; + "sixindicator" = buildFirefoxXpiAddon { + pname = "sixindicator"; + version = "1.3.0"; + addonId = "{8c9cad02-c069-4e93-909d-d874da819c49}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3493442/sixindicator-1.3.0.xpi"; + sha256 = "415ab83ed4ac94d1efe114752a09df29536d1bd54cc9b7e5ce5d9ee55a84226d"; + meta = with lib; + { + homepage = "https://github.com/HostedDinner/SixIndicator"; + description = "Shows a simple icon, if IPv6 or IPv4 was used for the request of the site. When clicking on the icon, more information is shown, like the number of requests per domain and if these requests were made via IPv6 or IPv4."; + license = licenses.mit; + mozPermissions = [ "tabs" "webRequest" "" ]; + platforms = platforms.all; + }; + }; + } diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..bf6e82e --- /dev/null +++ b/home.nix @@ -0,0 +1,86 @@ +{ pkgs, lib, stateVersion, ... }@args: +{ + home = { + username = "pim"; + homeDirectory = "/home/pim"; + stateVersion = stateVersion; + + packages = with pkgs; [ + keepassxc + nil + moonlight-qt + wakeonlan + cowsay + ]; + }; + + programs = { + home-manager.enable = true; + 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 + ]; + extraLuaConfig = builtins.readFile ./neovim.lua; + }; + alacritty = { + enable = true; + settings = (import ./alacritty.nix); + }; + + firefox = { + enable = true; + profiles.default = { + id = 0; + isDefault = true; + settings = { + "browser.aboutConfig.showWarning" = false; + }; + extensions = import ./firefox-addons args; + }; + }; + + 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"; + }; + }; + + direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + + git = { + enable = true; + userName = "Pim Kunis"; + userEmail = "pim@kunis.nl"; + extraConfig.core.editor = "nvim"; + }; + }; + + # Let home-manager manage the X session + xsession = { + enable = true; + }; + + # xdg.configFile."keepassxc/keepassxc.ini".text = pkgs.lib.generators.toINI {} (import ./keepassxc.nix); +} diff --git a/keepassxc.nix b/keepassxc.nix new file mode 100644 index 0000000..8a01d85 --- /dev/null +++ b/keepassxc.nix @@ -0,0 +1,43 @@ +{ + General = { + ConfigVersion = 2; + }; + Browser = { + Enabled = true; + CustomProxyLocation = ""; + }; + FdoSecrets = { + Enabled = true; + ConfirmAccessItem = false; + ConfirmDeleteItem = false; + }; + GUI = { + AdvancedSettings = true; + MinimizeOnClose = true; + MinimizeOnStartup = true; + ShowTrayIcon = true; + TrayIconAppearance = "colorful"; + }; + KeeShare = { + Active = "\"\\n\\n \\n\\n\""; + Foreign = "\"\\n\\n \\n\\n\""; + Own = "\"\\n\\n \\n \\n\\n\""; + QuietSuccess = true; + }; + PasswordGenerator = { + AdditionalChars = ""; + AdvancedMode = false; + ExcludedChars = ""; + Length = 40; + SpecialChars = false; + Type = 0; + UpperCase = true; + }; + SSHAgent = { + Enabled = true; + }; + Security = { + ClearClipboardTimeout = 30; + ClearSearch = false; + }; +} diff --git a/neovim.lua b/neovim.lua new file mode 100644 index 0000000..1f89b87 --- /dev/null +++ b/neovim.lua @@ -0,0 +1,67 @@ +--[ 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 opts = { noremap=true, silent=true } +local on_attach = function(client, bufnr) + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + local bufopts = { noremap=true, silent=true, buffer=bufnr } + vim.keymap.set('n', 'D', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'h', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'i', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', 's', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'c', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'fmt', function() vim.lsp.buf.format { async = true } end, bufopts) +end + +require'lspconfig'.nil_ls.setup{ on_attach = on_attach } + +--[ 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', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fb', builtin.buffers, {}) +vim.keymap.set('n', 'fr', builtin.lsp_references, {}) +vim.keymap.set('n', '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]])