diff --git a/config/hypr/scripts/lose-focus.sh b/config/hypr/scripts/lose-focus.sh index fb20bef..6cfec7d 100755 --- a/config/hypr/scripts/lose-focus.sh +++ b/config/hypr/scripts/lose-focus.sh @@ -4,7 +4,7 @@ while true do while killall -0 .blueman-manage > /dev/null 2>&1 do - if [[ $(bluetoothctl show | grep Powered | grep yes) ]]; then + if bluetoothctl show | grep Powered | grep -q yes; then if [[ $(hyprctl activewindow | grep blueman-manager) == "" && $(hyprctl clients | grep blueman-manager) != "" ]]; then killall .blueman-manage break diff --git a/nixos/cfg/packages.nix b/nixos/cfg/packages.nix index c6ff7a9..6945179 100644 --- a/nixos/cfg/packages.nix +++ b/nixos/cfg/packages.nix @@ -157,7 +157,6 @@ rsync killall ripgrep-all - neovim # TODO: use nix imagemagick usbutils evtest diff --git a/nixos/home/.nvim/base.vim b/nixos/home/.nvim/base.vim new file mode 100644 index 0000000..77a0783 --- /dev/null +++ b/nixos/home/.nvim/base.vim @@ -0,0 +1,8 @@ +" make tabs only 2 spaces +set tabstop=2 +set shiftwidth=2 +set expandtab +set smartindent + +set number +set relativenumber diff --git a/nixos/home/.nvim/config.lua b/nixos/home/.nvim/config.lua new file mode 100644 index 0000000..19ad5af --- /dev/null +++ b/nixos/home/.nvim/config.lua @@ -0,0 +1,2 @@ +vim.opt.fillchars = {eob = " "} +vim.cmd[[colorscheme dracula]] diff --git a/nixos/home/.nvim/lsp.lua b/nixos/home/.nvim/lsp.lua new file mode 100644 index 0000000..c2b2f4b --- /dev/null +++ b/nixos/home/.nvim/lsp.lua @@ -0,0 +1,3 @@ +local lspconfig = require('lspconfig') +lspconfig.bashls.setup {} +lspconfig.nixd.setup {} diff --git a/nixos/home/main.nix b/nixos/home/main.nix index 337465d..4423946 100644 --- a/nixos/home/main.nix +++ b/nixos/home/main.nix @@ -27,6 +27,7 @@ ./dotfiles.nix ./packages.nix ./misc.nix + ./nvim.nix ]; home.stateVersion = "23.05"; diff --git a/nixos/home/nvim.nix b/nixos/home/nvim.nix new file mode 100644 index 0000000..a4883ae --- /dev/null +++ b/nixos/home/nvim.nix @@ -0,0 +1,62 @@ +# https://breuer.dev/blog/nixos-home-manager-neovim +{ config, pkgs, lib, ... }: +let + # installs a vim plugin from git with a given tag / branch + pluginGit = ref: repo: pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "${lib.strings.sanitizeDerivationName repo}"; + version = ref; + src = builtins.fetchGit { + url = "https://github.com/${repo}.git"; + ref = ref; + }; + }; + + # always installs latest version + plugin = pluginGit "HEAD"; +in { + programs.neovim = { + enable = true; + package = pkgs.neovim-nightly; + + # read in the vim config from filesystem + # this enables syntaxhighlighting when editing those + extraConfig = builtins.concatStringsSep "\n" [ + (lib.strings.fileContents ./.nvim/base.vim) + # (lib.strings.fileContents ./.nvim/plugins.vim) + # (lib.strings.fileContents ./.nvim/lsp.vim) + '' + lua << EOF + ${lib.strings.fileContents ./.nvim/config.lua} + ${lib.strings.fileContents ./.nvim/lsp.lua} + EOF + '' + ]; + + extraPackages = with pkgs; [ + # used to compile tree-sitter grammar + tree-sitter + + # https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md + nodePackages.bash-language-server + shellcheck + nixd + ]; + plugins = with pkgs.vimPlugins; [ + # you can use plugins from the pkgs + vim-which-key + clangd_extensions-nvim + + nvim-treesitter.withAllGrammars + nvim-treesitter + + # or you can use our function to directly fetch plugins from git + (plugin "hrsh7th/nvim-cmp") # completion + (plugin "neovim/nvim-lspconfig") + (plugin "Mofiqul/dracula.nvim") + (plugin "nvim-neo-tree/neo-tree.nvim") + + # this installs the plugin from 'lua' branch + (plugin "lukas-reineke/indent-blankline.nvim") + ]; + }; +} diff --git a/nixos/home/packages.nix b/nixos/home/packages.nix index 3a45918..a9aee89 100644 --- a/nixos/home/packages.nix +++ b/nixos/home/packages.nix @@ -124,7 +124,6 @@ grim slurp swappy - neovim fontfor qt5ct lxappearance diff --git a/nixos/overlays/list.nix b/nixos/overlays/list.nix index 903f0cd..0e6c351 100644 --- a/nixos/overlays/list.nix +++ b/nixos/overlays/list.nix @@ -16,5 +16,9 @@ (final: prev: { dracula-plymouth = final.callPackage ./pkgs/dracula-plymouth.nix {}; }) + + (import (builtins.fetchTarball { + url = "https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz"; + })) ]; } diff --git a/nixos/overlays/pkgs/utterly-sddm.nix b/nixos/overlays/pkgs/utterly-sddm.nix new file mode 100644 index 0000000..a5d85be --- /dev/null +++ b/nixos/overlays/pkgs/utterly-sddm.nix @@ -0,0 +1,51 @@ +### test package +{ lib +, stdenv +, fetchFromGitHub +, pkgs +}: + +let + +wallpaper = fetchFromGitHub { + repo = "wallpaper"; + owner = "dracula"; + rev = "3bd5b95d4ae08d2adfb2931e090bb657fd9a6a4f"; + hash = "sha256-3p7PCMZHIytkOH3BBUMqaYBFcrSef3YHthyJY6KDArg="; + }; + +in + +stdenv.mkDerivation { + name = "utterly-sddm"; + version = "unstable-2022-11-06"; + + src = fetchFromGitHub { + repo = "Utterly-Sweet-Plasma"; + owner = "HimDek"; + rev = "4bb007e865d559de8dd43bbffb93778ea136f957"; + hash = "sha256-oEyf6FI5XSjXPZjzBiGypwZY89ulhwAwk9QIJ3pMw/M="; + }; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + rm ./sddm/background.jpg + cp ${wallpaper}/first-collection/nixos.png ./sddm/background.jpg + + mkdir -p $out/share/sddm/themes/Utterly-Sweet + mv ./sddm/* $out/share/sddm/themes/Utterly-Sweet + + runHook postInstall + ''; + + meta = with lib; { + description = "A dark theme for SDDM"; + homepage = "https://github.com/dracula/gtk"; + maintainers = with maintainers; [ matt1432 ]; + platforms = platforms.all; + }; +}