From 85241ed529961d237ee3c36cc4d827478d226758 Mon Sep 17 00:00:00 2001 From: wieerwill Date: Thu, 22 May 2025 21:07:56 +0200 Subject: [PATCH] experimenting new editor settings --- firefox.nix | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++ fonts.nix | 22 ++++++- git.nix | 23 +++++-- home.nix | 13 ++-- programs.nix | 25 ++++--- security.nix | 50 ++++++++++++++ sway.nix | 28 +++++++- terminal.nix | 79 ++++++++++++++++++++++ vim.nix | 53 +++++++++++++-- vscode.nix | 94 +++++++++++++++++++++++++++ 10 files changed, 534 insertions(+), 33 deletions(-) create mode 100644 firefox.nix create mode 100644 security.nix create mode 100644 vscode.nix diff --git a/firefox.nix b/firefox.nix new file mode 100644 index 0000000..9426a26 --- /dev/null +++ b/firefox.nix @@ -0,0 +1,180 @@ +{ config, pkgs, lib, ... }: +{ + + programs.firefox = { + enable = true; + + policies = { + DisablePocket = true; + DisplayBookmarksToolbar = true; + DisableFirefoxStudies = true; + DisableTelemetry = true; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = false; + Highlights = false; + SponsoredPocket = false; + SponsoredTopSites = false; + }; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + + ExtensionSettings = { + "jid1-MnnxcxisBPnSXQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; + installation_mode = "force_installed"; + }; + "firefox@ghostery.com" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ghostery/latest.xpi"; + installation_mode = "force_installed"; + }; + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + "{446900e4-71c2-419f-a6a7-df9c091e268b}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + }; + + profiles = { + Personal = { + id = 0; + + search = { + force = true; + engines = { + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + ]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + } + ]; + }; + "Nix Options" = { + urls = [ + { + template = "https://search.nixos.org/options"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + ]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@no" ]; + } + ]; + }; + }; + }; + + bookmarks = [ + { + name = "Toolbar"; + toolbar = true; + bookmarks = [ + { + name = "Development"; + bookmarks = [ + { + name = "Web"; + bookmarks = [ + { + name = "TypeScript docs"; + url = "https://www.typescriptlang.org/docs/"; + } + ]; + } + { + name = "Typst"; + bookmarks = [ + { + name = "Typst docs"; + url = "https://typst.app/docs/"; + } + ]; + } + { + name = "Nix"; + bookmarks = [ + { + name = "Nix(OS) manual (stable)"; + url = "https://nixos.org/manual/nixos/stable/"; + } + { + name = "Home manager options"; + url = "https://nix-community.github.io/home-manager/options.xhtml"; + } + { + name = "Noogle"; + url = "https://noogle.dev/"; + } + { + name = "Nixpkgs"; + url = "https://github.com/nixos/nixpkgs"; + } + ]; + } + { + name = "GitHub"; + url = "https://github.com/"; + } + ]; + } + { + name = "Radio"; + bookmarks = [ + { + name = "Meshtastic client"; + url = "https://client.meshtastic.org/"; + } + { + name = "Meshmap"; + url = "https://meshmap.net"; + } + ]; + } + ]; + } + { + name = "Entertainment"; + bookmarks = [ + { + name = "YouTube"; + url = "https://youtube.com/"; + } + ]; + } + ]; + }; + }; + }; + + home = { + sessionVariables.BROWSER = "firefox"; + persistence."/persist/home/wieerwill" = { + directories = [ + ".mozilla/firefox" + ]; + }; + }; + +} \ No newline at end of file diff --git a/fonts.nix b/fonts.nix index 7b502e9..9550ac3 100644 --- a/fonts.nix +++ b/fonts.nix @@ -1,10 +1,30 @@ { config, pkgs, lib, ... }: { - # Configure fonts fonts = { fontconfig = { enable = true; + defaultFonts = { + emoji = [emojione]; + monospace = [nerd-fonts._0xproto]; + sansSerif = [nerd-fonts.open-dyslexic]; + serif = [nerd-fonts.open-dyslexic]; + }; }; + + packages = with pkgs; [ + emojione + nerd-fonts._0xproto + #nerd-fonts.anonymice + #nerd-fonts.atkynson-mono + #nerd-fonts.code-new-roman + nerd-fonts.droid-sans-mono + nerd-fonts.hack + nerd-fonts.noto + nerd-fonts.open-dyslexic + nerd-fonts.symbols-only + nerd-fonts.ubuntu + ]; }; + } \ No newline at end of file diff --git a/git.nix b/git.nix index de57c86..d750e0f 100644 --- a/git.nix +++ b/git.nix @@ -3,12 +3,25 @@ programs.git = { enable = true; - userName = "wieerwill"; - userEmail = "robert.jeutter@gmx.de"; + userName = "wie" + "erwill"; + userEmail = "robert"+ ".jeutter@" + "gmx.de"; + lfs.enable = true; + aliases = { }; + signing = { + key = "ssh-ed25519 ..."; + signByDefault = true; + }; extraConfig = { - credential.helper = "${ - pkgs.git.override { withLibsecret = true; } - }/bin/git-credential-libsecret"; + gpg = { + format = "ssh"; + }; + init.defaultBranch = "main"; + push.autoSetupRemote = true; + credential.helper = "libsecret"; + #credential.helper = "${ + # pkgs.git.override { withLibsecret = true; } + # }/bin/git-credential-libsecret"; }; }; + } \ No newline at end of file diff --git a/home.nix b/home.nix index dd0c7ba..fdf75d1 100644 --- a/home.nix +++ b/home.nix @@ -1,24 +1,25 @@ { config, pkgs, lib, ... }: - -let -in { + imports = [ + ./firefox.nix ./fonts.nix ./git.nix ./programs.nix + ./security.nix ./sway.nix ./terminal.nix ./vim.nix + ./vscode.nix ]; - # Home Manager needs a bit of information about you and the paths it should - # manage. + # Home Manager needs a bit of information about you + # and the paths it should manage. home = { username = "wieerwill"; homeDirectory = "/home/wieerwill"; enableNixpkgsReleaseCheck = false; - stateVersion = "24.05"; # Please read the comment before changing. + stateVersion = "24.05"; # read DOCs before changing. file = { # ".screenrc".source = dotfiles/screenrc; diff --git a/programs.nix b/programs.nix index daeb86d..20d69c9 100644 --- a/programs.nix +++ b/programs.nix @@ -1,22 +1,21 @@ { config, pkgs, lib, ... }: { -# The home.packages option allows you to install Nix packages into your - # environment. + + # The home.packages option allows you to install + # Nix packages into your environment. home.packages = with pkgs; [ # List of programs thunderbird signal-desktop - vscodium + #vscodium vlc keepassxc - alacritty logseq okular - firefox + #firefox borgbackup # utility - htop pulsemixer brightnessctl gammastep # color temperature @@ -24,18 +23,16 @@ xwayland grim # screenshot functionality slurp # screenshot functionality - wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout + wl-clipboard # copy/paste from stdin / stdout mako # notification system developed by swaywm maintainer - - # steam deck touch compability in non-steam games - #caribou + #caribou # steam deck touch compability in non-steam games #evtest # for input key testing - # # It is sometimes useful to fine-tune packages, for example, by applying - # # overrides. You can do that directly here, just don't forget the - # # parentheses. Maybe you want to install Nerd Fonts with a limited number of - # # fonts? + # install Nerd Fonts with a limited number of fonts (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) ]; + + programs.direnv.enable = true; + } diff --git a/security.nix b/security.nix new file mode 100644 index 0000000..584b51f --- /dev/null +++ b/security.nix @@ -0,0 +1,50 @@ +{ config, pkgs, lib, ... }: +{ + + networking.firewall = { + enable = true; + allowedTCPPorts = [ 22 ]; + }; + + services.fail2ban = { + enable = true; + maxretry = 3; # Ban IP after 3 failures + bantime = "24h"; # Ban IPs for one day on the first ban + bantime-increment = { + enable = true; # increment of bantime after each violation + formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)"; + multipliers = "1 2 4 8 16 32 64"; + maxtime = "168h"; # Do not ban for more than 1 week + overalljails = true; # bantime based on all violations + }; + }; + + programs.gpg = { + enable = true; + mutableKeys = true; # allow changes in keys or trust + mutableTrust = true; + publicKeys = [ + { + source = ""; #./path/to/key.a; + trust = "ultimate"; + } + ]; + }; + + programs.ssh = { + enable = true; + addKeysToAgent = "yes"; # let home manager manage ssh keys + }; + + services.openssh = { + enable = true; + ##Ports = [ 5432 ]; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PermitRootLogin = "no"; + #AllowUsers = [ "wieerwill" ] + }; + }; + +} \ No newline at end of file diff --git a/sway.nix b/sway.nix index e117f89..5efebf2 100644 --- a/sway.nix +++ b/sway.nix @@ -3,7 +3,7 @@ let # Define variables for your workspaces and displays display1 = "card1-eDP-1"; - touchDisplay = "10248:4117:FTS3528:00_2808:1015"; + touchDisplay = "10248:4117:FTS3528:00_2808:1015"; #steamdeck workspace1 = "1:Web"; workspace2 = "2:App"; workspace3 = "3:Chat"; @@ -179,4 +179,28 @@ in }; }; }; -} + + services.swayidle = { + enable = true; + timeouts = [ + { + timeout = 60 * 4; + command = lib.getExe config.programs.swaylock.package; + } + ]; + }; + + programs.swaylock = { + enable = true; + #package = pkgs.swaylock-effects; + settings = { + font = "hack"; + screenshots = true; + clock = true; + show-failed-attempts = true; + indicator-idle-visible = true; + effect-blur = "8x5"; + }; + }; + +} \ No newline at end of file diff --git a/terminal.nix b/terminal.nix index c33d655..f523f91 100644 --- a/terminal.nix +++ b/terminal.nix @@ -3,5 +3,84 @@ programs.alacritty = { enable = true; + settings = { + font.normal = { family = "hack", style = "Regular" }; + size = "12"; + colors.primary = { + foreground = "#d8d8d8"; # RRGGBB + background = "#181818"; + dim_foreground = "#828482"; + }; + #shell = { program = "/bin/zsh", args = ["-l"] }; + }; }; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + # autosuggestion.highlight = null; # Custom styles for autosuggestion highlighting + syntaxHighlighting = { + enable = true; + highlighters = [ "main" "brackets" "cursor" ]; + patterns = { "rm -rf *" = "fg=white,bold,bg=red"; }; + }; + enableVteIntegration = true; # let the terminal track the current working directory + autocd = null; # Automatically enter into a directory if typed directly into shell. + sessionVariables = { # Environment variables that will be set for zsh session + isZSH = true + }; + + ohMyZsh = { + enable = true; + plugins = [ + "alias-finder" # learn alias easier + "colorize" + "cp" + "direnv" + "git" + "git-extras" + "git-lfs" + "history" + "rust" + "ssh" + "sudo" + "vscode" + "z" + ]; + theme = "jonathan"; # "amuse"; #"robbyrussell"; + }; + + shellAliases = { + ll = "ls -l"; + edit = "sudo -e"; + ".." = "cd .."; + update = "sudo nixos-rebuild switch"; + }; + + history = { + ignoreAllDups = true; + expireDuplicatesFirst = true; + ignorePatterns = ["rm *" "pkill *"]; + save = 10000; # number of history lines + }; + histSize = 10000; + histFile = "$HOME/.zsh_history"; + setOptions = [ + "HIST_IGNORE_ALL_DUPS" + ]; + }; + + programs.btop = { + enable = true; + settings = { + color_theme = "tokyo-night"; # "Default"; + truecolor = true; + }; + }; + + programs.htop = { + enable = true; + }; + } \ No newline at end of file diff --git a/vim.nix b/vim.nix index a029b86..38772f9 100644 --- a/vim.nix +++ b/vim.nix @@ -5,9 +5,52 @@ enable = true; viAlias = true; vimAlias = true; - #defaultEditor = true; - #extraConfig = '' - # set number relativenumber - #''; - }; + vimdiffAlias = true; + defaultEditor = true; + extraConfig = '' + set number relativenumber + ''; + + plugins = let + nvim-treesitter-with-plugins = pkgs.vimPlugins.nvim-treesitter.withPlugins (treesitter-plugins: + with treesitter-plugins; [ + astro + bash + c + css + cpp + dockerfile + git_config + git_rebase + gitattributes + gitcommit + gitignore + html + http + javascript + json + latex + markdown + nix + python + rust + sql + sway + typescript + vim + zig + ]); + in + with pkgs.vimPlugins; [ + # vim-nerdtree?? + vim-rainbrow + vim-colors-solarized + # vim-lightline + # syntastic + vim-nix + nvim-lspconfig + nvim-treesitter-with-plugins + ]; + }; + } \ No newline at end of file diff --git a/vscode.nix b/vscode.nix new file mode 100644 index 0000000..6455f1d --- /dev/null +++ b/vscode.nix @@ -0,0 +1,94 @@ +{ config, pkgs, lib, ... }: +{ + + programs.vscode = { + enable = true; + + profiles.default = { + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + + userSettings = { + "editor.formatOnSave" = true; + "editor.inlineSuggest.enabled" = true; + "editor.minimap.enabled" = false, + "editor.minimap.autohide" = true; + "editor.minimap.renderCharacters" = false; + "explorer.autoReveal" = false; + "explorer.excludeGitIgnore" = true; + "extensions.autoUpdate" = false; + "git.autofetch" = true; + "git.suggestSmartCommit" = false; + "git.confirmSync" = false; + "security.workspace.trust.enabled" = false; + "security.workspace.trust.untrustedFiles" = "open"; + "workbench.colorTheme" = "SynthWave '84"; + "workbench.iconTheme" = "material-icon-theme"; + "workbench.startupEditor" = "none"; + "workbench.tree.indent" = 16; + "rust-analyzer.lens.implementations.enable" = false; + + "[typescript]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[vue]" = { + "editor.defaultFormatter" = "Vue.volar"; + }; + "[mdx]" = { + "editor.defaultFormatter" = "unifiedjs.vscode-mdx"; + }; + "[astro]" = { + "editor.defaultFormatter" = "astro-build.astro-vscode"; + }; + "[nix]" = { + "editor.defaultFormatter" = "jnoortheen.nix-ide"; + }; + }; + + extensions = with pkgs.vscode-extensions; [ + # Nix + bbenoist.nix + jnoortheen.nix-ide + #kamadorueda.alejandra + + # Rust + rust-lang.rust-analyzer + tamasfe.even-better-toml + probe-rs.probe-rs-debugger + Swellaby.vscode-rust-test-adapter + + # Python + ms-python.python + ms-python.debugpy + + # JS/TS + codeandstuff.package-json-upgrade + dbaeumer.vscode-eslint + esbenp.prettier-vscode + Vue.volar + astro-build.astro-vscode + + # Misc + yzhang.markdown-all-in-one + unifiedjs.vscode-mdx + James-Yu.latex-workshop + fill-labs.dependi + alefragnani.project-manager + foxundermoon.shell-format + usernamehw.errorlens + + # Git + waderyan.gitblame + mhutchie.git-graph + donjayamanne.githistory + felipecaputo.git-project-manager + codezombiech.gitignore + + # Theme + RobbOwen.synthwave-vscode + PKief.material-icon-theme + ]; + }; + }; + +} \ No newline at end of file