commit 8d0bddf68068315901578ad7e66dc9428b4aa7c2 Author: Anton Date: Thu Nov 20 22:13:05 2025 +0100 feat: initial commit; NixOS Era diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef6c6c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env.nix +hardware-configuration.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a37461 --- /dev/null +++ b/README.md @@ -0,0 +1,126 @@ +# BluePlum's dotfiles + +Sup. This repository is representative of my personal configuration files +(available [here at https://github.com/antonw51/dotfiles](https://github.com/antonw51/dotfiles)). + +Feel free to look at, pick and choose, fork, or do whatever you want with +these. That's kind of the point. + +See what I consider my dotfiles to be at [the Preferences section](#Preferences) + +## Installation + +### NixOS + +This entire repository is representative of a `/etc/nixos` directory for use +with NixOS. Installing these dotfiles is hence easiest on NixOS. + +To do so, you'll need `git`, your favorite editor and the root priviliges for +your system. (For a bare NixOS system `nix-shell` suffices:) + +```bash +$ nix-shell -p git +``` + +Clone this repository into a folder that's ideally owned by your user account +rather than root (or just use `sudo` for the following steps). Then copy its +contents into the `/etc/nixos` directory. + +```bash +# Remove existing configuration +$ [ -f /etc/nixos/configuration.nix ] + && sudo rm /etc/nixos/configuration.nix + +$ git clone https://github.com/antonw51/dotfiles ~/dotfiles +$ sudo cp -r ~/dotfiles/* /etc/nixos +``` + +You will also need to make a `.env.nix` file for device specific configuration. +`nixos-rebuild build` will tell you which keys need to be filled out, but the +current minimal config looks like (`/etc/nixos/.env.nix`): + +```nix +{ ... }: + +{ + hostname = "pinklilac" +} +``` + +> [!INFO] +> +> This `.env.nix` file configures some keys shared across the configuration. +> Namely this `hostname` property which declares `system.networking.hostname` +> _and_ adds a nix file at `/etc/nixos/{hostname}.nix` (where `{hostname}` is +> your hostname) to `configuration.nix` module `imports`. +> +> With this you can configure per-device specifics, such as displays, or +> additional configuration. See `blueplum.nix` for an example. + +Thereafter you can run `sudo nixos-rebuild boot` to build the configuration and +`reboot` to apply it appropriately. + +If you forked or own the repository and want to cleanly keep the git repository +seperated from write-protected `/etc/` files to commit to the repository, you +can move the `git` file and `.git` directories contents to another more +permanent directory: + +```bash +# In this example, the persistent directory will be ~/dev/nixos + +$ mkdir -p ~/dev/nixos +$ mv -r ~/dotfiles/.git/* ~/dev/nixos +$ mv ~/dotfiles/git ~/dev/nixos && chmod +x ~/dev/nixos/git + +# Optionally remove the originally cloned directory: +$ rm -r ~/dotfiles # git metadata is preserved. +``` + +Then use the `git` executable (with `fish`) in the new directory to interact with the repository held in `/etc/nixos`: + +```bash +$ cd ~/dev/nixos +$ ./git add . +$ ./git commit +$ ./git push +# ... +``` + +### Other + +NixOS allows for reproducible and easily configurable configuration files both +system- and user-wide. It makes the installation process a lot easier. + +Without NixOS to manage your system, you'll have to configure and "generate" +configs yourself. For most things, `git`, `i3`, and packages alike this +consists of essentially translating the contents of files such as `home.nix` or +`home/i3.nix` into equivilant configuration. + +However, program configurations within the `pkgs` directory don't have this +constraint, as they're defined as traditional configs and then simply copied. +These you can copy or symlink to quickly set up the appropriate software. (For +instance, to set up Fish, you can link `pkgs/fish` to your local +`$__fish_config_dir`.) + +If you choose this approach, set up symlinks, and want to commit/contribute to +the git repository contained within the dotfiles, you may do so within the +cloned repository; no need to move anything or use any special git scripts. + +## Preferences + +While I don't _necessarily_ follow any specific ideologies when +making/modifying my dotfiles, I do typically: + +- Try and keep things to essentials (not minimalistic, but nothing overkill) +- Personally familiar (keyboard shortcuts might not be to your liking) +- With _some_ expansion in mind (`.env.nix` for example) +- Somewhat consistent (The IBM Carbon colors are currently a personal favorite + of mine) +- Formatted and linted consistently (Lua, Nix, and Fish files are all + formatted, and I try to keep them up to high, consistent standard) +- Ephermeral (I won't live forever, duh, and this ain't a group project) +- Somewhat informational? (You're reading this `README`, afterall) +- Redacted (You won't find sensitive things here, perhaps outside of my name, + which is rather obvious already) +- Fine-tuned (Irks, even minor I do my best to iron out while trying to keep + away from hacky patches) diff --git a/blueplum.nix b/blueplum.nix new file mode 100644 index 0000000..b51fd62 --- /dev/null +++ b/blueplum.nix @@ -0,0 +1,42 @@ +{ + config, + pkgs, + lib ? pkgs.lib, + ... +}: + +let + concat = strings: lib.concatStringsSep " " strings; +in +{ + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + modesetting.enable = true; + + open = true; + + nvidiaSettings = true; + + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + services.xserver.displayManager.setupCommands = concat [ + "${lib.getExe pkgs.xorg.xrandr}" + concat + [ + "--output DP-0" + "--mode 1920x1080" + "--pos 0x0" + "--rate 144" + "--primary" + ] + concat + [ + "--output HDMI-0" + "--mode 1920x1080" + "--pos 1920x0" + "--rate 144" + ] + ]; +} diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..33a4c11 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,227 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + stateVersion = "25.05"; + env = import ./.env.nix { inherit pkgs; }; +in +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + (import (./. + "/${env.hostname}.nix")) + ( + let + home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${stateVersion}.tar.gz"; + in + import "${home-manager}/nixos" + ) + ]; + + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = [ + (import "${fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"}/overlay.nix") + ]; + + environment.systemPackages = with pkgs; [ + chromium + + libsecret + gnome-keyring + adwaita-icon-theme + gtk3 + + vim + git + xh + jq + + (fenix.complete.withComponents [ + "rustc" + "cargo" + "clippy" + "rust-src" + "rustfmt" + "rust-analyzer" + ]) + nodejs-slim_latest + pnpm + nixd + nixfmt-rfc-style + clang + llvmPackages.bintools + stylua + ]; + + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + jetbrains-mono + nerd-fonts.symbols-only + inter + times-newer-roman + (import ./pkgs/monaco-font/default.nix { inherit pkgs; }) + ]; + + fonts.fontconfig = { + enable = true; + defaultFonts = { + monospace = [ + "JetBrains Mono" + "Symbols Nerd Font" + "Liberation Mono" + "Monaco" + ]; + sansSerif = [ + "Inter" + "Noto Sans" + ]; + serif = [ "Times Newer Roman" ]; + }; + }; + + services = { + xserver = { + enable = true; + + windowManager.i3 = { + enable = true; + + extraPackages = with pkgs; [ + rofi + i3status + ]; + }; + + displayManager.startx.enable = true; + tty = 7; + + # Configure keymap in X11 + xkb = { + layout = "us"; + variant = ""; + options = "caps:super"; + }; + + excludePackages = with pkgs; [ xterm ]; + }; + greetd = { + enable = true; + vt = config.services.xserver.tty; + restart = false; + settings = { + default_session = { + command = lib.concatStringsSep " " [ + "${lib.getExe pkgs.greetd.tuigreet}" + "--remember" + "--asterisks" + "--time" + ]; + user = "greeter"; + }; + }; + }; + }; + + programs.chromium = import ./home/chromium.nix; + + programs.fish.enable = true; + programs.bash.interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.anton = { + isNormalUser = true; + description = "anton"; + shell = pkgs.bash; + extraGroups = [ + "networkmanager" + "wheel" + ]; + }; + + home-manager.useUserPackages = true; + home-manager.useGlobalPkgs = true; + home-manager.users.anton = import ./home.nix; + + # programs.home-manager.enable = true; + programs.dconf.enable = true; + qt = { + enable = true; + platformTheme = "gnome"; + style = "adwaita-dark"; + }; + + hardware.graphics.enable = true; + + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + + settings = { + General = { + Experimental = true; + FastConnectable = true; + }; + Policy.AutoEnable = true; + }; + }; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + services.gnome.gnome-keyring.enable = true; + + # Bootloader. + boot.loader.systemd-boot = { + enable = true; + configurationLimit = 10; + }; + boot.loader.efi.canTouchEfiVariables = true; + + boot.kernelParams = [ "console=tty1" ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = env.hostname; + networking.firewall.enable = false; + + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Stockholm"; + + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + + nix.settings.extra-experimental-features = [ "nix-command" ]; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = stateVersion; # Did you read the comment? +} diff --git a/git b/git new file mode 100755 index 0000000..49aeb24 --- /dev/null +++ b/git @@ -0,0 +1,5 @@ +#!/usr/bin/env fish +git \ + --git-dir=(status dirname) \ + --work-tree=/etc/nixos \ + $argv diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..b694f63 --- /dev/null +++ b/home.nix @@ -0,0 +1,131 @@ +{ + pkgs, + lib ? pkgs.lib, + ... +}: + +let + neovim = pkgs.callPackage ./pkgs/neovim/default.nix { }; + fish = pkgs.callPackage ./pkgs/fish/default.nix { }; + + env = import ./.env.nix; + + home = /home/anton; +in +{ + home.username = lib.mkDefault "anton"; + home.homeDirectory = lib.mkDefault home; + + home.packages = with pkgs; [ + element-desktop + spotify + kitty + vesktop + flameshot + krita + davinci-resolve + + btop + neovim + xclip + tree + xh + babelfish + hyperfine + + # required by spotify + ffmpeg_4 + ]; + + home.pointerCursor = { + gtk.enable = true; + x11.enable = true; + name = "Posy_Cursor_Black"; + size = 32; + package = pkgs.posy-cursors; + }; + + xsession = { + enable = true; + windowManager.i3 = import ./home/i3.nix { inherit pkgs; }; + }; + + programs.btop.enable = true; + programs.fastfetch.enable = true; + + programs.kitty = import ./home/kitty.nix { inherit pkgs; }; + + programs.fish = { + enable = true; + shellInit = '' + set fish_function_path $fish_function_path ${fish}/functions + ''; + interactiveShellInit = '' + source ${fish}/config.fish + ''; + }; + + # Fix Fish command not found issues + programs.command-not-found.enable = false; + + programs.neovim = { + enable = true; + defaultEditor = true; + extraConfig = '' + set runtimepath+=${neovim} + source ${neovim}/init.lua + ''; + }; + + programs.rofi = { + enable = true; + theme = "gruvbox-dark-soft"; + font = "Monaco 12"; + }; + + programs.git = { + enable = true; + + userName = "Anton"; + userEmail = "aligator.h0spital.e@gmail.com"; + + signing = + if (env.git or { }) ? signingKey then + { + key = env.git.signingKey; + signByDefault = true; + } + else + { signByDefault = false; }; + + extraConfig = { + init.defaultBranch = "main"; + + "url \"https://github.com/\"".insteadOf = "gh:"; + }; + }; + + services.gpg-agent = { + enable = true; + enableSshSupport = true; + enableFishIntegration = true; + + pinentry.package = pkgs.pinentry-curses; + }; + + dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; + + gtk = { + enable = true; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + }; + + home.sessionVariables = { + NIXPKGS_ALLOW_UNFREE = 1; + }; + + home.stateVersion = (pkgs.callPackage { }).system.stateVersion; +} diff --git a/home/chromium.nix b/home/chromium.nix new file mode 100644 index 0000000..1de23e3 --- /dev/null +++ b/home/chromium.nix @@ -0,0 +1,41 @@ +{ + enable = true; + + defaultSearchProviderEnabled = true; + defaultSearchProviderSuggestURL = "https://duckduckgo.com/?q={searchTerms}&type=list"; + defaultSearchProviderSearchURL = "https://duckduckgo.com/?q={searchTerms}"; + + extraOpts = + let + languagetool = "oldceeleldhonbafppcapldpdifcinji"; + shortkeys = "logpjaacgmcbpdkdchjiaagddngobkck"; + darkreader = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; + ublock = "ddkjiahejlhfcafbddmgiahcphecmpfh"; + in + { + extensions = { + install.initiallist = [ + languagetool + shortkeys + darkreader + ublock + ]; + commands."linux:Alt+Left" = { + command_name = "04-prevtab"; + extension = shortkeys; + global = false; + }; + commands."linux:Alt+Right" = { + command_name = "03-nexttab"; + extension = shortkeys; + global = false; + + }; + }; + message_center.disabled_extension_ids = [ shortkeys ]; + profile.content_settings.permission_actions = { + mic_stream = [ { action = 2; } ]; + notifications = [ { action = 2; } ]; + }; + }; +} diff --git a/home/i3.nix b/home/i3.nix new file mode 100644 index 0000000..ac64807 --- /dev/null +++ b/home/i3.nix @@ -0,0 +1,100 @@ +{ + pkgs, + lib ? pkgs.lib, + ... +}: + +let + mod = "Mod4"; + + wallpaper = pkgs.callPackage ../pkgs/wallpaper/default.nix { }; + + env = import /etc/nixos/.env.nix { inherit pkgs; }; +in +{ + enable = true; + + config = { + modifier = mod; + + fonts = { + names = [ "Monaco" ]; + size = 8.0; + }; + + keybindings = lib.mkOptionDefault { + "${mod}+q" = "kill"; + "${mod}+n" = "exec \"${ + lib.concatStringsSep " " [ + "${lib.getExe pkgs.rofi}" + "-show combi" + "-modes combi" + "-combi-modes drun,run" + "-combi-display-format {text}" + ] + }\""; + "${mod}+Return" = "exec ${lib.getExe pkgs.kitty}"; + + "${mod}+Left" = "focus left"; + "${mod}+Right" = "focus right"; + "${mod}+Up" = "focus up"; + "${mod}+Down" = "focus down"; + + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Right" = "move right"; + "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+Down" = "move down"; + + "${mod}+Ctrl+Left" = "move workspace to output left"; + "${mod}+Ctrl+Right" = "move workspace to output right"; + + "Print" = "exec ${lib.getExe pkgs.flameshot} gui"; + }; + }; + + extraConfig = + let + background = lib.concatStringsSep " " [ + "exec --no-startup-id" + "${lib.concatStringsSep " " [ + "${lib.getExe pkgs.xwinwrap}" + "-g 3820x1080" + "-s" + "-b" + "-ni" + "-sp" + "-ov" + "-nf" + ]}" + "--" + "${lib.concatStringsSep " " [ + "${lib.getExe pkgs.mpv}" + "${wallpaper}/wallpaper.mov" + "-wid WID" + "--loop" + "--no-audio" + "--no-osc" + "--no-input-default-bindings" + "--no-input-cursor" + "--gpu-api=vulkan" + "--vo=gpu-next" + "--framedrop=vo" + "--profile=low-latency" + "--hwdec=auto" + ]}" + ]; + displays = + if (env ? displays) then + lib.concatStringsSep "\n" [ + "workspace 1 output ${env.displays.primary}" + (if (env.displays ? secondary) then "workspace 2 output ${env.displays.secondary}" else "") + "exec i3-msg focus output ${env.displays.primary}" + ] + else + ""; + in + lib.concatStringsSep "\n" [ + background + displays + ]; +} diff --git a/home/kitty.nix b/home/kitty.nix new file mode 100644 index 0000000..55af03b --- /dev/null +++ b/home/kitty.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: + +{ + enable = true; + font = { + package = pkgs.jetbrains-mono; + name = "JetBrains Mono"; + size = 13; + }; + extraConfig = '' + foreground #f2f4f8 + background #161616 + selection_foreground #f2f4f8 + selection_background #2a2a2a + + cursor #f2f4f8 + cursor_text_color #161616 + + url_color #25be6a + + active_border_color #78a9ff + inactive_border_color #535353 + bell_border_color #3ddbd9 + + active_tab_foreground #0c0c0c + active_tab_background #78a9ff + inactive_tab_foreground #6e6f70 + inactive_tab_background #2a2a2a + + color0 #282828 + color8 #484848 + color1 #ee5396 + color9 #f16da6 + color2 #25be6a + color10 #46c880 + color3 #ebcb8b + color11 #f0d399 + color4 #78a9ff + color12 #8cb6ff + color5 #be95ff + color13 #c8a5ff + color6 #33b1ff + color14 #52bdff + color7 #dfdfe0 + color15 #e4e4e5 + color16 #3ddbd9 + color17 #ff7eb6 + ''; +} diff --git a/home/neovim.nix b/home/neovim.nix new file mode 100644 index 0000000..737b33d --- /dev/null +++ b/home/neovim.nix @@ -0,0 +1,6 @@ +{ lib, ... }: + +{ + enable = true; + +} diff --git a/home/vesktop.nix b/home/vesktop.nix new file mode 100644 index 0000000..d2c25e1 --- /dev/null +++ b/home/vesktop.nix @@ -0,0 +1,316 @@ +{ + enable = true; + settings = { + discordBranch = "stable"; + tray = true; + minimizeToTray = false; + enableMenu = true; + hardwareAcceleration = true; + arRPC = true; + + enableSplashScreen = false; + splashTheming = false; + }; + vencord.settings = { + autoUpdate = true; + autoUpdateNotification = false; + notifyAboutUpdates = false; + useQuickCss = true; + disableMinSize = true; + plugins = { + CommandsAPI.enabled = true; + DynamicImageModalAPI.enabled = true; + MemberListDecoratorsAPI.enabled = true; + MessageAccessoriesAPI.enabled = true; + MessageDecorationsAPI.enabled = true; + MessageEventsAPI.enabled = true; + MessageUpdaterAPI.enabled = true; + ServerListAPI.enabled = true; + UserSettingsAPI.enabled = true; + AlwaysExpandRoles.enabled = true; + AlwaysTrust.enabled = true; + AnonymiseFileNames.enabled = true; + BetterGifPicker.enabled = true; + BetterSettings = { + enabled = true; + disableFade = true; + organizeMenu = true; + eagerLoad = true; + }; + BetterUploadButton.enabled = true; + BiggerStreamPreview.enabled = true; + BlurNSFW.enabled = true; + CallTimer.enabled = true; + ConsoleJanitor = { + enabled = true; + disableLoggers = false; + disableSpotifyLogger = true; + whitelistedLoggers = "GatewaySocket; Routing/Utils"; + allowLevel = { + error = true; + warn = false; + trace = false; + log = false; + info = false; + debug = false; + }; + }; + CopyEmojiMarkdown.enabled = true; + CrashHandler.enabled = true; + CtrlEnterSend = { + enabled = false; + submitRule = "ctrl+enter"; + sendMessageInTheMiddleOfACodeBlock = true; + }; + CustomIdle = { + enabled = true; + idleTimeout = 10; + remainInIdle = true; + }; + DisableCallIdle.enabled = true; + ExpressionCloner.enabled = true; + F8Break.enabled = true; + FakeNitro = { + enabled = true; + enableEmojiBypass = true; + emojiSize = 48; + transformEmojis = true; + enableStickerBypass = true; + stickerSize = 160; + transformStickers = true; + transformCompoundSentence = false; + enableStreamQualityBypass = true; + useHyperLinks = true; + hyperLinkText = "{{NAME}}"; + disableEmbedPermissionCheck = false; + }; + FakeProfileThemes = { + enabled = true; + nitroFirst = true; + }; + FavoriteEmojiFirst.enabled = true; + FixCodeblockGap.enabled = true; + FixImagesQuality.enabled = true; + FixSpotifyEmbeds = { + enabled = true; + volume = 10; + }; + FixYoutubeEmbeds.enabled = true; + ForceOwnerCrown.enabled = true; + FriendsSince.enabled = true; + FullSearchContext.enabled = true; + FullUserInChatbox.enabled = true; + GameActivityToggle.enabled = true; + IgnoreActivities = { + enabled = false; + listMode = 0; + idsList = ""; + ignorePlaying = false; + ignoreStreaming = false; + ignoreListening = false; + ignoreWatching = false; + ignoreCompeting = false; + }; + ImageFilename.enabled = true; + IrcColors = { + enabled = true; + lightness = 70; + memberListColors = true; + applyColorOnlyToUsersWithoutColor = false; + applyColorOnlyInDms = false; + }; + LoadingQuotes = { + enabled = true; + replaceEvents = true; + enablePluginPresetQuotes = true; + enableDiscordPresetQuotes = true; + additionalQuotes = ""; + additionalQuotesDelimiter = "|"; + }; + MemberCount.enabled = true; + MessageClickActions.enabled = true; + MessageLatency = { + enabled = true; + latency = 1; + detectDiscordKotlin = true; + showMillis = false; + ignoreSelf = false; + }; + MessageLogger = { + enabled = true; + deleteStyle = "text"; + logDeletes = true; + collapseDeleted = false; + logEdits = true; + inlineEdits = true; + ignoreBots = false; + ignoreSelf = false; + ignoreUsers = ""; + ignoreChannels = ""; + ignoreGuilds = ""; + }; + NewGuildSettings = { + enabled = true; + guild = true; + messages = 1; + everyone = true; + role = true; + highlights = true; + events = true; + showAllChannels = true; + }; + NoDevtoolsWarning.enabled = true; + NoF1.enabled = true; + NoMosaic = { + enabled = false; + inlineVideo = true; + }; + NoServerEmojis.enabled = true; + NormalizeMessageLinks.enabled = true; + NotificationVolume = { + enabled = false; + notificationVolume = 100; + }; + OnePingPerDM.enabled = true; + PauseInvitesForever.enabled = true; + PermissionFreeWill = { + enabled = false; + lockout = true; + onboarding = true; + }; + PermissionsViewer.enabled = true; + PinDMs = { + enabled = false; + pinOrder = 0; + canCollapseDmSection = false; + }; + PlatformIndicators.enabled = true; + PreviewMessage.enabled = true; + QuickReply.enabled = true; + ReactErrorDecoder.enabled = true; + RelationshipNotifier.enabled = true; + ReplaceGoogleSearch = { + enabled = false; + replacementEngine = "off"; + }; + ReplyTimestamp.enabled = true; + RevealAllSpoilers.enabled = true; + RoleColorEverywhere.enabled = true; + SecretRingToneEnabler = { + enabled = false; + onlySnow = false; + }; + Summaries = { + enabled = true; + summaryExpiryThresholdDays = 3; + }; + SendTimestamps = { + enabled = true; + replaceMessageContents = true; + }; + ServerInfo.enabled = true; + ServerListIndicators.enabled = true; + ShikiCodeblocks = { + enabled = true; + theme = "https://raw.githubusercontent.com/shikijs/textmate-grammars-themes/2d87559c7601a928b9f7e0f0dda243d2fb6d4499/packages/tm-themes/themes/dark-plus.json"; + tryHljs = "SECONDARY"; + useDevIcon = "GREYSCALE"; + bgOpacity = 100; + }; + ShowHiddenChannels.enabled = true; + ShowHiddenThings = { + enabled = true; + showTimeouts = true; + showInvitesPaused = true; + showModView = true; + }; + ShowMeYourName = { + enabled = true; + mode = "nick-user"; + friendNicknames = "dms"; + displayNames = false; + inReplies = false; + }; + SilentMessageToggle.enabled = true; + SilentTyping.enabled = true; + SpotifyControls.enabled = true; + SpotifyCrack.enabled = true; + SpotifyShareCommands.enabled = true; + SuperReactionTweaks = { + enabled = true; + superReactByDefault = false; + unlimitedSuperReactionPlaying = false; + superReactionPlayingLimit = 0; + }; + TextReplace = { + enabled = false; + stringRules = [ + { + find = ""; + replace = ""; + onlyIfIncludes = ""; + } + ]; + regexRules = [ + { + find = ""; + replace = ""; + onlyIfIncludes = ""; + } + ]; + }; + TypingIndicator.enabled = true; + TypingTweaks = { + enabled = true; + showAvatars = true; + showRoleColors = true; + alternativeFormatting = true; + }; + UserMessagesPronouns = { + enabled = true; + pronounsFormat = "LOWERCASE"; + showSelf = true; + }; + UserVoiceShow.enabled = true; + ValidReply.enabled = true; + ValidUser.enabled = true; + VoiceChatDoubleClick.enabled = true; + VcNarrator = { + enabled = false; + voice = "us-mbrola-1 espeak-ng-mbrola"; + volume = 1; + rate = 1; + sayOwnName = false; + latinOnly = false; + joinMessage = "{{USER}} joined"; + leaveMessage = "{{USER}} left"; + moveMessage = "{{USER}} moved to {{CHANNEL}}"; + muteMessage = "{{USER}} muted"; + unmuteMessage = "{{USER}} unmuted"; + deafenMessage = "{{USER}} deafened"; + undeafenMessage = "{{USER}} undeafened"; + }; + ViewRaw.enabled = true; + VoiceMessages.enabled = true; + VolumeBooster = { + enabled = true; + multiplier = 3; + }; + WebKeybinds.enabled = true; + WebScreenShareFixes.enabled = true; + WhoReacted.enabled = true; + BadgeAPI.enabled = true; + NoTrack = { + enabled = true; + disableAnalytics = true; + }; + Settings = { + enabled = true; + settingsLocation = "aboveNitro"; + }; + DisableDeepLinks.enabled = true; + SupportHelper.enabled = true; + WebContextMenus.enabled = true; + }; + }; +} diff --git a/pkgs/fish/config.fish b/pkgs/fish/config.fish new file mode 100644 index 0000000..f4b0650 --- /dev/null +++ b/pkgs/fish/config.fish @@ -0,0 +1,15 @@ +set fish_greeting '( .-.)' + +fish_vi_key_bindings + +alias cls='clear; and echo $fish_greeting'; +alias ...='cd ../..'; + +set -l directory (status dirname) + +[ -f "$directory/prompt.fish" ]; and source "$directory/prompt.fish" +[ -f "$directory/alias.fish" ]; and source "$directory/alias.fish" + +if not set -qx SSH_AUTH_SOCK + set -x SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket) +end diff --git a/pkgs/fish/default.nix b/pkgs/fish/default.nix new file mode 100644 index 0000000..b6ce760 --- /dev/null +++ b/pkgs/fish/default.nix @@ -0,0 +1,23 @@ +{ + pkgs ? import { }, + lib ? pkgs.lib, + ... +}: + +pkgs.stdenv.mkDerivation rec { + pname = "fish-config"; + version = "1.0"; + + src = builtins.path { + path = ./.; + name = pname; + }; + + installPhase = '' + mkdir -p $out + cp -r ${src}/* $out/ + ''; + + dontUnpack = true; + dontBuild = true; +} diff --git a/pkgs/fish/functions/clip.fish b/pkgs/fish/functions/clip.fish new file mode 100644 index 0000000..358add1 --- /dev/null +++ b/pkgs/fish/functions/clip.fish @@ -0,0 +1,26 @@ +function clip + if not command -q xclip + echoerr "clip: 'xclip' is not available on this system" + return 1 + end + + if not tty -s + set -l stdin + read stdin -z + end + + if set -ql stdin + echo "$stdin" | xclip -selection clipboard + echo "copied into clipboard (stdin)" + return 0 + end + + if [ -n "$(string trim -- $argv)" ] + echo "$argv" | xclip -selection clipboard + echo "copied into clipboard" + return 0 + end + + xclip -selection clipboard -o +end + diff --git a/pkgs/fish/functions/echoerr.fish b/pkgs/fish/functions/echoerr.fish new file mode 100644 index 0000000..fb8e645 --- /dev/null +++ b/pkgs/fish/functions/echoerr.fish @@ -0,0 +1,3 @@ +function echoerr + echo $argv >&2 +end diff --git a/pkgs/fish/functions/nix-shell.fish b/pkgs/fish/functions/nix-shell.fish new file mode 100644 index 0000000..a526d1d --- /dev/null +++ b/pkgs/fish/functions/nix-shell.fish @@ -0,0 +1,45 @@ +function nix-shell + set -l _argv (string split ' ' -- $argv); + + if contains -- '-q' $_argv; or contains -- '--query' $_argv + for pkg in (string split ' ' -- $FISH_NIX_PACKAGES) + echo $pkg + end + return 0; + end + + function package_flag -a arg + contains -- '-p' $arg + or contains -- '--packages' $arg + end + + if not command -q nix-shell; or not package_flag $argv + command nix-shell --run fish $argv; + return $status; + end + + set -l packages + set -l reading_packages 0 + for arg in $_argv + if [ $reading_packages -ne 0 ] + if string match -r '^-' + set reading_packages 0 + else + not contains -- $arg (string split ' ' -- $FISH_NIX_PACKAGES); + and set packages $packages $arg + end + else + package_flag $arg; and set reading_packages 1 + end + end + + set -l prev_packages $FISH_NIX_PACKAGES; + set -x FISH_NIX_PACKAGES $prev_packages $packages; + + command nix-shell --run fish $argv; + set -l nix_status $status; + + set -x FISH_NIX_PACKAGES $prev_packages; + + return $nix_status +end diff --git a/pkgs/fish/functions/nix-shell.fish.bckup b/pkgs/fish/functions/nix-shell.fish.bckup new file mode 100644 index 0000000..f4d25b9 --- /dev/null +++ b/pkgs/fish/functions/nix-shell.fish.bckup @@ -0,0 +1,12 @@ +function nix-shell + if not command -q nix-shell + command nix-shell; + return $status; + end + + set -l _argv $argv + argparse -i 'p/packages=' -- $argv + or command nix-shell -- $_argv + + set -x FISH_NIX_PACKAGES +end diff --git a/pkgs/fish/functions/round.fish b/pkgs/fish/functions/round.fish new file mode 100644 index 0000000..e4505d4 --- /dev/null +++ b/pkgs/fish/functions/round.fish @@ -0,0 +1,18 @@ +function round + argparse -n 'round' -i 'p/precision=!_validate_int' -- $argv + or return 1; + + set -l value (string trim -- $argv) + if [ -z $value ] + echoerr 'round: no input' + return 1 + end + + set -l precision 1 + if set -q _flag_precision + set precision (math "10 ^ $_flag_precision") + end + + set value (math "$value * $precision") + echo (math "round($value) / $precision") +end diff --git a/pkgs/fish/prompt.fish b/pkgs/fish/prompt.fish new file mode 100644 index 0000000..139b28c --- /dev/null +++ b/pkgs/fish/prompt.fish @@ -0,0 +1,76 @@ +function fish_mode_prompt; end + +function fish_prompt + set -l command_status $status; + + set -l duration ''; + begin + [ $CMD_DURATION -gt 700 ]; and set -l seconds \ + "$(round -p 2 (math $CMD_DURATION / 1000 % 60))s"; + [ $CMD_DURATION -gt 60000 ]; and set -l minutes \ + "$(round (math $CMD_DURATION / 60000))m"; + + [ $CMD_DURATION -gt 700 ]; and set duration (string join '' -- \ + (set_color normal) \ + 'took ' \ + (set_color yellow) \ + (string join ' ' -- $minutes $seconds) \ + ); + end + + set -l mode + begin + function color_and_wrap -a color char + string join '' -- (set_color --bold $color) "[$char]" + functions -e color_and_wrap + end + + set -l indicator \ + (switch $fish_bind_mode + case default; color_and_wrap red 'N' + case insert; color_and_wrap cyan 'I' + case replace_one; color_and_wrap green 'R' + case visual; color_and_wrap brmagenta 'V' + case '*'; color_and_wrap red '?' + end) + set mode (string join '' -- $indicator (set_color normal) ' ') + end + + set -l nix_shell + begin + set -l packages (string split ' ' -- $FISH_NIX_PACKAGES) + + if [ -n "$IN_NIX_SHELL" ] + set nix_shell "$(set_color brblue) " + + set -ql packages[1]; and set nix_shell "$nix_shell($packages[1]"; + set -ql packages[2]; and set nix_shell "$nix_shell, $packages[2]"; + set -ql packages[3]; and not set -ql packages[4]; and set nix_shell "$nix_shell, $packages[3]"; + + set -ql packages[4]; and set nix_shell "$nix_shell, +$(math (count $packages) - 2) more" + + set -ql packages[1]; set nix_shell "$nix_shell) " + end + end + + set -l cursor_color (set_color green) + [ $command_status -ne 0 ]; and set -l cursor_color (set_color red) + + set -l pwd (string join '' -- \ + $cursor_color \ + (prompt_pwd -D 2 -d 1) \ + (set_color normal) \ + ); + + [ (fish_vcs_prompt) ]; and set -l git (string join '' -- \ + (set_color yellow) \ + ' 󰘬 ' \ + (string sub -s 3 -e -1 -- (fish_vcs_prompt)) \ + ' ' \ + ); + + [ $command_status -ne 0 ]; and set -l last_status "[$command_status]"; + + [ -n $duration ]; and echo $duration + string join '' -- $mode $nix_shell $pwd $git $cursor_color $last_status '|> ' +end diff --git a/pkgs/monaco-font/default.nix b/pkgs/monaco-font/default.nix new file mode 100644 index 0000000..2e777db --- /dev/null +++ b/pkgs/monaco-font/default.nix @@ -0,0 +1,29 @@ +{ + pkgs ? import { system = builtins.currentSystem; }, + lib ? pkgs.lib, + ... +}: + +pkgs.stdenv.mkDerivation rec { + pname = "monaco-font"; + version = "1.0"; + + src = builtins.fetchurl { + url = "https://github.com/taodongl/monaco.ttf/raw/refs/heads/master/monaco.ttf"; + sha256 = "sha256:09chm7js9qk80q47d1ybp5imhl0bwjp0kcwfk4i8hcsjbf0cwrvw"; + }; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out/share/fonts/truetype + cp $src $out/share/fonts/truetype/monaco.ttf + ''; + + meta = with lib; { + desscription = "Monaco font"; + homepage = "https://github.com/taodongl/monaco.ttf"; + licensse = licenses.free; + platforms = platforms.all; + }; +} diff --git a/pkgs/monaco-font/result b/pkgs/monaco-font/result new file mode 120000 index 0000000..c38f055 --- /dev/null +++ b/pkgs/monaco-font/result @@ -0,0 +1 @@ +/nix/store/kp450zrxxva5fv7wwpnz841vgxan6c49-nixos-system-blueplum-25.05.811874.daf6dc47aa4b \ No newline at end of file diff --git a/pkgs/neovim/after/ftplugin/fish.lua b/pkgs/neovim/after/ftplugin/fish.lua new file mode 100644 index 0000000..1b8d5ec --- /dev/null +++ b/pkgs/neovim/after/ftplugin/fish.lua @@ -0,0 +1 @@ +vim.lsp.enable('fish_ls') diff --git a/pkgs/neovim/after/ftplugin/markdown.lua b/pkgs/neovim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..ac51d87 --- /dev/null +++ b/pkgs/neovim/after/ftplugin/markdown.lua @@ -0,0 +1,2 @@ +vim.wo.wrap = false +vim.opt.expandtab = true diff --git a/pkgs/neovim/default.nix b/pkgs/neovim/default.nix new file mode 100644 index 0000000..74f39ff --- /dev/null +++ b/pkgs/neovim/default.nix @@ -0,0 +1,23 @@ +{ + pkg ? import , + lib ? pkg.lib, + ... +}: + +pkg.stdenv.mkDerivation rec { + pname = "neovim-config"; + version = "1.0"; + + src = builtins.path { + path = ./.; + name = "neovim-config"; + }; + + installPhase = '' + mkdir -p $out + cp -r ${src}/* $out/ + ''; + + dontUnpack = true; + dontBuild = true; +} diff --git a/pkgs/neovim/init.lua b/pkgs/neovim/init.lua new file mode 100644 index 0000000..4b5b6a9 --- /dev/null +++ b/pkgs/neovim/init.lua @@ -0,0 +1,14 @@ +local lazy = require('BluePlum.lazy').bootstrap() + +require('BluePlum') + +if lazy then + lazy.setup({ + spec = { + { import = 'plugins' }, + }, + checker = { enabled = false }, + change_detection = { notify = false }, + performance = { rtp = { reset = false } } + }) +end diff --git a/pkgs/neovim/lazy-lock.json b/pkgs/neovim/lazy-lock.json new file mode 100644 index 0000000..89c1210 --- /dev/null +++ b/pkgs/neovim/lazy-lock.json @@ -0,0 +1,20 @@ +{ + "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "cord.nvim": { "branch": "master", "commit": "a4484bb25e343a375d95b250ffadbdcbfbfdf2ac" }, + "flash.nvim": { "branch": "develop", "commit": "045457978f3fb7df03efa2023dbc8a5f6e9179bd" }, + "formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "markview.nvim": { "branch": "main", "commit": "d5d37102d24c3d5d032b01263855081b6850509b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, + "nvim-treesitter": { "branch": "main", "commit": "dafb3cb3cb066774526c1103f3d1d6b34578800b" }, + "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, + "oxocarbon.nvim": { "branch": "main", "commit": "acdfdd5d319c36170b5ad2a120283bec2f450081" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "smear-cursor.nvim": { "branch": "main", "commit": "4a0f7ac265b4ed1ce4d0af2afc13072763bfa691" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" } +} diff --git a/pkgs/neovim/lsp/bashls.lua b/pkgs/neovim/lsp/bashls.lua new file mode 100644 index 0000000..9b9ed9a --- /dev/null +++ b/pkgs/neovim/lsp/bashls.lua @@ -0,0 +1,4 @@ +return { + cmd = { 'bash-language-server', 'start' }, + filetypes = { 'sh', 'bash' }, +} diff --git a/pkgs/neovim/lsp/fish_ls.lua b/pkgs/neovim/lsp/fish_ls.lua new file mode 100644 index 0000000..3c2541a --- /dev/null +++ b/pkgs/neovim/lsp/fish_ls.lua @@ -0,0 +1,4 @@ +return { + cmd = { 'fish-lsp', 'start' }, + filetypes = { 'fish' }, +} diff --git a/pkgs/neovim/lsp/lua_ls.lua b/pkgs/neovim/lsp/lua_ls.lua new file mode 100644 index 0000000..2d93160 --- /dev/null +++ b/pkgs/neovim/lsp/lua_ls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { '.luarc.json', '.luarc.jsonc' }, +} diff --git a/pkgs/neovim/lsp/nixd.lua b/pkgs/neovim/lsp/nixd.lua new file mode 100644 index 0000000..60e3a33 --- /dev/null +++ b/pkgs/neovim/lsp/nixd.lua @@ -0,0 +1,36 @@ +return { + cmd = { 'nixd' }, + filetypes = { 'nix' }, + root_markers = { { 'configuration.nix', 'flake.nix', 'default.nix' } }, + settings = { + nixd = { + options = { + nixos = { + expr = [[ + (import { + modules = [ + + /etc/nixos/hardware-configuration.nix + ]; + }) + .options + ]] + }, + ['home-manager'] = { + expr = [[ + let + pkgs = import {}; + config = pkgs.callPackage {}; + home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${config.system.stateVersion}.tar.gz"; + in + (import "${home-manager}/modules" { + inherit pkgs; + configuration = /etc/nixos/home.nix; + }) + .options + ]] + } + } + } + } +} diff --git a/pkgs/neovim/lsp/rust_analyzer.lua b/pkgs/neovim/lsp/rust_analyzer.lua new file mode 100644 index 0000000..7874614 --- /dev/null +++ b/pkgs/neovim/lsp/rust_analyzer.lua @@ -0,0 +1,12 @@ +return { + cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, + root_markers = { 'Cargo.toml', '.git' }, + settings = { + ['rust-analyzer'] = { + check = { + command = 'clippy', + }, + }, + }, +} diff --git a/pkgs/neovim/lsp/ts_ls.lua b/pkgs/neovim/lsp/ts_ls.lua new file mode 100644 index 0000000..fd0f1be --- /dev/null +++ b/pkgs/neovim/lsp/ts_ls.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'typescript-language-server', '--stdio' }, + filetypes = { 'typescript', 'javascript' }, + root_markers = { 'package.json', 'tsconfig.json' }, +} diff --git a/pkgs/neovim/lua/BluePlum/commands.lua b/pkgs/neovim/lua/BluePlum/commands.lua new file mode 100644 index 0000000..35c9509 --- /dev/null +++ b/pkgs/neovim/lua/BluePlum/commands.lua @@ -0,0 +1,22 @@ +vim.api.nvim_create_user_command('Dot', 'edit ~/.config/nvim', {}) + +vim.cmd.cnoreabbrev('Git', 'GIt') +vim.api.nvim_create_user_command('GIt', function(ctx) + local subcommand = ctx.fargs[1] + if subcommand == 'log' then + local argv = table.concat({ + 'log', + '--graph', + '--abbrev-commit', + '--decorate', + }, ' ') + + local sliced = vim.list_slice(ctx.fargs, 2) + vim.cmd.Git(argv .. ' ' .. table.concat(sliced, ' ')) + return + end + + vim.cmd.Git(table.concat(ctx.fargs, ' ')) +end, { + nargs = '+', +}) diff --git a/pkgs/neovim/lua/BluePlum/init.lua b/pkgs/neovim/lua/BluePlum/init.lua new file mode 100644 index 0000000..d5ed97f --- /dev/null +++ b/pkgs/neovim/lua/BluePlum/init.lua @@ -0,0 +1,3 @@ +require('BluePlum.set') +require('BluePlum.keymap') +require('BluePlum.commands') diff --git a/pkgs/neovim/lua/BluePlum/keymap.lua b/pkgs/neovim/lua/BluePlum/keymap.lua new file mode 100644 index 0000000..951b55d --- /dev/null +++ b/pkgs/neovim/lua/BluePlum/keymap.lua @@ -0,0 +1,87 @@ +--- Defaults to `{'n'}` +--- @alias Mode 'n'|'v'|'Q'|'t'|'i'|'c' +--- @alias Mapping string|fun(): nil + +--- @type table +local keymap = { + move_lines = { + [''] = ':move-2i', + [''] = ':move+i', + modes = { 'i' }, + }, + half_screen_scroll = { + [''] = 'zz', + [''] = 'zz', + }, + clipboard_yank = { + ['y'] = '"+y', + modes = { 'n', 'v' }, + }, + terminal_escape = { + [''] = '', + modes = { 't' }, + }, + terminal = { + ['t'] = function() + OpenTerminal = OpenTerminal or nil + + local open_buf = vim.api.nvim_get_current_buf() + + if PreviousBuffer and open_buf == OpenTerminal then + vim.api.nvim_set_current_buf(PreviousBuffer) + PreviousBuffer = nil + return + end + + PreviousBuffer = open_buf + + if OpenTerminal then + vim.api.nvim_set_current_buf(OpenTerminal) + return + end + + vim.cmd.term() + OpenTerminal = vim.api.nvim_get_current_buf() + vim.api.nvim_create_autocmd({ 'BufDelete' }, { + callback = function() + OpenTerminal = nil + end, + buffer = OpenTerminal, + }) + end, + }, + goto_last_buffer = { + ['l'] = ':e#', + }, + scratch_pad = { + ['s'] = table.concat({ + ':bo vs', + ':enew', + ':setlocal noswapfile', + ':setlocal bufhidden=hide', + ':set filetype=markdown', + ':set syntax=markdown', + '', + }, ''), + }, + window_navigation = { + [''] = 'q', + [''] = '', + [''] = '', + [''] = '', + [''] = '', + }, +} + +for _, tbl in pairs(keymap) do + for key, value in pairs(tbl) do + if key ~= 'modes' then + local modes = tbl.modes --[[ @as Mode[] ]] + or { 'n' } + for _, mode in ipairs(modes) do + --- @cast value Mapping + vim.keymap.set(mode, key, value) + end + end + end +end diff --git a/pkgs/neovim/lua/BluePlum/lazy.lua b/pkgs/neovim/lua/BluePlum/lazy.lua new file mode 100644 index 0000000..da16cf6 --- /dev/null +++ b/pkgs/neovim/lua/BluePlum/lazy.lua @@ -0,0 +1,64 @@ +--- @class Lazy +--- @field setup fun(opts: table) + +local M = {} + +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' + +--- @nodiscard +--- @return Lazy? +function M.bootstrap() + --- @type { fs_stat: fun(path: string): boolean } + local fs = vim.uv or vim.loop + if fs.fs_stat(lazypath) then + vim.opt.rtp:prepend(lazypath) + return require('lazy') + end + + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }) + + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, + { out, 'WarningMsg' }, + }, true, {}) + return nil + end + + return require('lazy') +end + +M.icons = 'echasnovski/mini.icons' +M.icons_require = function() + return require('mini.icons') +end + +--- @enum PlenaryModule +local _ = { + async = 'async', + async_lib = 'async_lib', + job = 'job', + path = 'path', + scandir = 'scandir', + context_manager = 'context_manager', + test_harness = 'test_harness', + filetype = 'filetype', + strings = 'strings', +} + +--- @param module PlenaryModule +M.plenary_require = function(module) + return require('plenary.' .. module) +end +M.plenary = 'nvim-lua/plenary.nvim' + +--- @enum +M.event = { + BufEnter = 'BufEnter', + BufWinEnter = 'BufWinEnter', + BufWritePost = 'BufWritePost', + VeryLazy = 'VeryLazy', +} + +return M diff --git a/pkgs/neovim/lua/BluePlum/set.lua b/pkgs/neovim/lua/BluePlum/set.lua new file mode 100644 index 0000000..d10abec --- /dev/null +++ b/pkgs/neovim/lua/BluePlum/set.lua @@ -0,0 +1,96 @@ +local opts = { + mapleader = ' ', + + linenr = { + number = true, + relativenumber = true, + + cursorline = true, + cursorlineopt = 'number', + }, + + -- Use tabs for indents + indent = { + autoindent = true, + noexpandtab = true, + tabstop = 4, + shiftwidth = 4, + }, + + terminal = { + termguicolors = true, + shell = vim.env.SHELL or '/bin/sh', + }, + + split = { + splitright = true, + splitbelow = true, + }, + + search = { + hlsearch = false, + incsearch = true, + }, + + foldlevelstart = 99, +} + +--- @param tbl table +local function apply(tbl) + for key, value in pairs(tbl) do + if type(value) == 'table' then + apply(value) + else + if vim.fn.exists('&' .. key) == 1 then + vim.opt[key] = value + else + vim.g[key] = value + end + end + end +end + +apply(opts) + +-- Tabs for indenting +-- vim.opt.autoindent = true +-- vim.g.noexpandtab = true +-- vim.opt.tabstop = 4 +-- vim.opt.shiftwidth = 4 +-- +-- -- Line numbers +-- vim.opt.number = true +-- vim.opt.relativenumber = true +-- vim.opt.cursorline = true +-- vim.opt.cursorlineopt = 'number' + +-- Folding +-- vim.opt.foldlevelstart = 99 + +-- vim.g.mapleader = ' ' + +-- Terminal +-- vim.g.termguicolors = true +-- vim.opt.shell = '/bin/fish' + +-- LSP +-- vim.lsp.inlay_hint.enable() + +-- Splitting +-- vim.opt.splitright = true +-- vim.opt.splitbelow = true + +-- Make text readable +-- vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { +-- pattern = { '*.md', '*.typ' }, +-- command = 'setlocal linebreak', +-- }) + +-- vim.api.nvim_create_autocmd('FileType', { +-- pattern = 'help', +-- command = 'setlocal linebreak', +-- }) + +-- Search +-- vim.opt.hlsearch = false +-- vim.opt.incsearch = true diff --git a/pkgs/neovim/lua/plugins/additions.lua b/pkgs/neovim/lua/plugins/additions.lua new file mode 100644 index 0000000..744eeb2 --- /dev/null +++ b/pkgs/neovim/lua/plugins/additions.lua @@ -0,0 +1,18 @@ +return { + { + 'vyfor/cord.nvim', + event = 'VeryLazy', + build = ':Cord update', + opts = {}, + cond = vim.env.CORDLESS ~= 'true', + }, + { + 'tpope/vim-fugitive', + cmd = { 'Git' }, + }, + { + dir = '~/dev/share.nvim/', + opts = {}, + enabled = false, + }, +} diff --git a/pkgs/neovim/lua/plugins/deco.lua b/pkgs/neovim/lua/plugins/deco.lua new file mode 100644 index 0000000..0ffe3de --- /dev/null +++ b/pkgs/neovim/lua/plugins/deco.lua @@ -0,0 +1,32 @@ +local common = require('BluePlum.lazy') + +return { + { common.icons, opts = {} }, + { + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = {}, + event = common.event.BufWinEnter, + }, + { + 'OXY2DEV/markview.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', common.icons }, + ft = 'markdown', + opts = { + preview = { + icon_provider = 'mini', + }, + }, + }, + { + 'sphamba/smear-cursor.nvim', + opts = { + time_interval = 17, + anticipation = 0, + damping = 0.8, + + cursor_color = '#b7bcb9', + legacy_computing_symbols_support = true, + }, + }, +} diff --git a/pkgs/neovim/lua/plugins/format.lua b/pkgs/neovim/lua/plugins/format.lua new file mode 100644 index 0000000..2366f2f --- /dev/null +++ b/pkgs/neovim/lua/plugins/format.lua @@ -0,0 +1,81 @@ +local common = require('BluePlum.lazy') + +---@param exe string +---@param args { [number]: string, path: boolean? } +local function formatter(exe, args) + return { + function() + local argv = {} + + for _, val in ipairs(args) do + table.insert(argv, val) + end + + if args.path ~= false then + table.insert(argv, vim.fn.shellescape(vim.api.nvim_buf_get_name(0))) + end + + return { + exe = exe, + args = argv, + stdin = true, + } + end, + } +end + +local prettier = formatter('prettier', { + '--config-precedence prefer-file', + '--single-quote', + '--use-tabs', + '--trailing-comma es5', + '--bracket-same-line', + '--stdin-filepath', +}) + +return { + { + 'mhartington/formatter.nvim', + event = common.event.BufWritePost, + opts = { + filetype = { + javascript = prettier, + typescript = prettier, + markdown = prettier, + css = prettier, + json = prettier, + html = prettier, + scss = prettier, + rust = formatter('rustfmt', { path = false }), + lua = formatter('stylua', { + '--indent-type Tabs', + '--line-endings Unix', + '--quote-style AutoPreferSingle', + '--column-width' .. ' ' .. vim.o.columns, + '-', + }), + nix = formatter('nixfmt', { + '--indent=4', + '--strict', + }), + + ['*'] = { + function() + if vim.lsp.buf.formatting then + vim.lsp.buf.format() + end + end, + }, + }, + }, + config = function(lazy) + require('formatter').setup(lazy.opts) + + vim.api.nvim_create_augroup('__formatter__', { clear = true }) + vim.api.nvim_create_autocmd(common.event.BufWritePost, { + group = '__formatter__', + command = ':FormatWriteLock', + }) + end, + }, +} diff --git a/pkgs/neovim/lua/plugins/lsp.lua b/pkgs/neovim/lua/plugins/lsp.lua new file mode 100644 index 0000000..3305f19 --- /dev/null +++ b/pkgs/neovim/lua/plugins/lsp.lua @@ -0,0 +1,87 @@ +local common = require('BluePlum.lazy') + +return { + -- Mason + { 'mason-org/mason.nvim', opts = {} }, + { + 'mason-org/mason-lspconfig.nvim', + version = '1.*', + config = function(lazy) + local mason_lspconfig = require('mason-lspconfig') + + mason_lspconfig.setup(lazy.opts) + mason_lspconfig.setup_handlers({ + vim.lsp.enable + }) + + vim.lsp.enable('nixd') + vim.lsp.enable('rust_analyzer') + end, + dependencies = { + 'mason-org/mason.nvim', + }, + }, + { + 'Saghen/blink.cmp', + dependencies = { common.icons }, + version = '1.*', + build = 'cargo build --release', + opts = { + keymap = { + preset = 'default', + + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + + [''] = { 'accept', 'fallback' }, + }, + appearance = { + nerd_font_variant = 'normal', + }, + sources = { + default = { 'lsp', 'buffer', 'path', 'omni' }, + }, + completion = { + list = { selection = { auto_insert = false } }, + documentation = { + auto_show = true, + auto_show_delay_ms = 700, + }, + ghost_text = { enabled = true }, + menu = { + auto_show = true, + draw = { + columns = { { 'kind_icon' }, { 'label', 'label_description', gap = 1 }, { 'kind' } }, + components = { + kind_icon = { + text = function(ctx) + local icon, _, _ = common.icons_require().get('lsp', ctx.kind) + return icon + end, + }, + kind = { + text = function(ctx) + return '(' .. ctx.kind .. ')' + end, + highlight = 'SpecialKey', + }, + }, + }, + }, + }, + cmdline = { + enabled = true, + keymap = { preset = 'inherit' }, + sources = { 'buffer', 'cmdline' }, + completion = { + list = { selection = { preselect = true, auto_insert = false } }, + ghost_text = { enabled = true }, + menu = { + auto_show = true, + }, + }, + }, + signature = { enabled = true, window = { show_documentation = true } }, + }, + }, +} diff --git a/pkgs/neovim/lua/plugins/nav.lua b/pkgs/neovim/lua/plugins/nav.lua new file mode 100644 index 0000000..0967a05 --- /dev/null +++ b/pkgs/neovim/lua/plugins/nav.lua @@ -0,0 +1,50 @@ +local common = require('BluePlum.lazy') +local telescope = { + find_files = function() + require('telescope.builtin').find_files({ show_hidden = true }) + end, + live_grep = function() + require('telescope.builtin').live_grep() + end, + buffers = function() + require('telescope.builtin').buffers() + end, +} + +return { + { + 'nvim-telescope/telescope.nvim', + dependencies = { common.plenary }, + keys = { + { 'ff', telescope.find_files }, + { 'fs', telescope.live_grep }, + { 'bb', telescope.buffers }, + }, + }, + + { + 'stevearc/oil.nvim', + opts = { + default_file_explorer = true, + view_options = { + show_hidden = true, + }, + }, + lazy = false, + keys = { + { 'ex', vim.cmd.Oil }, + }, + }, + { + 'Kaiser-Yang/flash.nvim', + branch = 'develop', + event = common.event.VeryLazy, + opts = { + modes = { + char = { + multi_line = false, + }, + }, + }, + }, +} diff --git a/pkgs/neovim/lua/plugins/theme.lua b/pkgs/neovim/lua/plugins/theme.lua new file mode 100644 index 0000000..eae34be --- /dev/null +++ b/pkgs/neovim/lua/plugins/theme.lua @@ -0,0 +1,43 @@ +return { + { + 'nyoom-engineering/oxocarbon.nvim', + priority = 999, + config = function() + vim.cmd.colorscheme('oxocarbon') + + local groups = { + Text = 'Identifier', + Method = '@function.builtin', + Function = 'Function', + Constructor = '@character', + Field = '@property', + Variable = '@label', + Class = 'Todo', + Interface = 'Type', + Module = 'Macro', + Property = '@property', + Unit = 'Type', + Value = 'Number', + Enum = 'String', + Keyword = 'Identifier', + Snippet = 'Identifier', + Color = 'Identifier', + File = 'Identifier', + Folder = 'identifier', + Reference = 'Identifier', + EnumMember = 'String', + Constant = '@constant.builtin', + Struct = 'Type', + Event = '@constant', + Operator = 'Structure', + TypeParameter = 'Type', + } + + for key, value in pairs(groups) do + vim.api.nvim_set_hl(0, 'BlinkCmpKind' .. key, { link = value }) + end + + vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { link = 'IncSearch' }) + end, + }, +} diff --git a/pkgs/neovim/lua/plugins/treesitter.lua b/pkgs/neovim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..170e53f --- /dev/null +++ b/pkgs/neovim/lua/plugins/treesitter.lua @@ -0,0 +1,19 @@ +local common = require('BluePlum.lazy') + +return { + { + 'nvim-treesitter/nvim-treesitter', + branch = 'main', + event = common.event.VeryLazy, + build = ':TSUpdate', + opts = { + ensure_installed = { 'lua', 'markdown', 'typescript', 'javascript', 'rust', 'json', 'toml' }, + + highlight = { + enable = true, + }, + + auto_install = true, + }, + }, +} diff --git a/pkgs/wallpaper/default.nix b/pkgs/wallpaper/default.nix new file mode 100644 index 0000000..a5c8ae6 --- /dev/null +++ b/pkgs/wallpaper/default.nix @@ -0,0 +1,23 @@ +{ + pkgs ? import { }, + lib ? pkgs.lib, + ... +}: + +pkgs.stdenv.mkDerivation rec { + pname = "wallpaper"; + version = "1.0"; + + src = builtins.path { + path = ./.; + name = pname; + }; + + installPhase = '' + mkdir -p $out + cp -r ${src}/* $out/ + ''; + + dontUnpack = true; + dontBuild = true; +} diff --git a/pkgs/wallpaper/wallpaper.mov b/pkgs/wallpaper/wallpaper.mov new file mode 100644 index 0000000..81659c9 Binary files /dev/null and b/pkgs/wallpaper/wallpaper.mov differ