From ee083f82790698ba03ad199c1ac0d8974bd1963f Mon Sep 17 00:00:00 2001 From: randomuser Date: Sat, 23 Sep 2023 03:42:22 -0500 Subject: [PATCH] change everything --- boxes/iso.nix | 10 ++ boxes/netbox.nix | 1 + boxes/xps.nix | 20 +++- builds/pash.nix | 3 +- builds/utils/sh/brightness | 4 - builds/utils/sh/cfg | 2 +- builds/utils/sh/disp | 18 +-- builds/utils/sh/rebuild | 2 +- builds/utils/sh/regenerate | 18 --- builds/utils/sh/toggle-contingency-mode | 28 ----- common/desktop.nix | 25 ++++- common/main.nix | 7 +- config/emacs/init.el | 141 ++++++++++++++++++++++++ config/nvim/init.lua | 31 +++--- config/sxhkd/contingency | 2 - config/sxhkd/sxhkdrc | 40 +------ 16 files changed, 216 insertions(+), 136 deletions(-) create mode 100644 boxes/iso.nix delete mode 100755 builds/utils/sh/brightness delete mode 100755 builds/utils/sh/regenerate delete mode 100755 builds/utils/sh/toggle-contingency-mode create mode 100644 config/emacs/init.el delete mode 100644 config/sxhkd/contingency diff --git a/boxes/iso.nix b/boxes/iso.nix new file mode 100644 index 0000000..27de3cb --- /dev/null +++ b/boxes/iso.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: +{ + imports = [ + + + # Provide an initial copy of the NixOS channel so that the user + # doesn't need to run "nix-channel --update" first. + + ]; +} diff --git a/boxes/netbox.nix b/boxes/netbox.nix index afe1aff..c962aa7 100644 --- a/boxes/netbox.nix +++ b/boxes/netbox.nix @@ -18,6 +18,7 @@ }; environment.systemPackages = with pkgs; [ + neovim # nothing more needed, at the moment ]; diff --git a/boxes/xps.nix b/boxes/xps.nix index 1dc9403..9bba5fb 100644 --- a/boxes/xps.nix +++ b/boxes/xps.nix @@ -15,20 +15,30 @@ zathura lilypond virt-manager - virtualbox - xsane +# virtualbox xsane + android-studio + mpc-cli + emacs + nyxt + cmus ]; - users.extraGroups.vboxusers.members = [ "usr" ]; - virtualisation.virtualbox.host.enable = true; - virtualisation.virtualbox.host.enableExtensionPack = true; +# users.extraGroups.vboxusers.members = [ "usr" ]; +# virtualisation.virtualbox.host.enable = true; +# virtualisation.virtualbox.host.enableExtensionPack = true; services.tlp.enable = true; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + services.printing.enable = true; + services.avahi.enable = true; + services.avahi.nssmdns = true; + # for a WiFi printer + services.avahi.openFirewall = true; + networking.nameservers = [ "1.1.1.1" "9.9.9.9" ]; networking.hostName = "xps"; diff --git a/builds/pash.nix b/builds/pash.nix index fc8181c..32531ee 100644 --- a/builds/pash.nix +++ b/builds/pash.nix @@ -1,6 +1,7 @@ { stdenv , lib , bash +, gnupg , makeWrapper , fetchgit }: @@ -14,7 +15,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-0L3N7F4BwVdu4rR5xpUEIHcX/x64Gni8JTUki5kGH24="; }; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper gnupg ]; installPhase = '' mkdir -p $out/bin diff --git a/builds/utils/sh/brightness b/builds/utils/sh/brightness deleted file mode 100755 index b431e44..0000000 --- a/builds/utils/sh/brightness +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -brightness=$(printf "250\n500\n1000\n2000\n3000\n4000\n" | tmenu) -st -c st-gpg-menu -e sh -c "sudo sh -c \"echo $brightness >> /sys/class/backlight/intel_backlight/brightness\"" diff --git a/builds/utils/sh/cfg b/builds/utils/sh/cfg index 58892df..8c90cb1 100755 --- a/builds/utils/sh/cfg +++ b/builds/utils/sh/cfg @@ -1,6 +1,6 @@ #!/bin/sh -sel="$(find -L ~/.config 2>/dev/null | fzy)" +sel="$(find -L ~/dot_testing 2>/dev/null | fzy)" [ "$?" -eq 1 ] && exit 1 nvim "$sel" diff --git a/builds/utils/sh/disp b/builds/utils/sh/disp index 824559c..013c511 100755 --- a/builds/utils/sh/disp +++ b/builds/utils/sh/disp @@ -4,24 +4,14 @@ exists() { xrandr | grep ' connected' | grep -c "${1}" } -bspc monitor -d 1 2 3 4 5 6 7 8 9 +bspc monitor eDP-1 -d 1 2 3 4 5 6 7 8 9 -if [ "$(exists "HDMI-2")" -eq 1 ] && [ "$(exists "LVDS-1")" -eq 1 ]; then +if [ "$(exists "DP-1")" -gt 1 ]; then printf "two" - xrandr --output HDMI-2 --right-of LVDS-1 --auto - xrandr --output VGA-1 --off --auto - bspc monitor LVDS-1 -d 1 2 3 4 5 6 7 8 9 - bspc monitor HDMI-2 -d 1 2 3 4 5 6 7 8 9 + bspc monitor DP-1 -s eDP-1 + xrandr --output eDP-1 --off exit 0 fi -if [ "$(exists "HDMI-1")" -eq 1 ] && [ "$(exists "LVDS-1")" -eq 1 ]; then - printf "two" - xrandr --output HDMI-1 --right-of LVDS-1 --auto - xrandr --output VGA-1 --off --auto - bspc monitor LVDS-1 -d 1 2 3 4 5 6 7 8 9 - bspc monitor HDMI-1 -d 1 2 3 4 5 6 7 8 9 - exit 0 -fi # default configuration's fine diff --git a/builds/utils/sh/rebuild b/builds/utils/sh/rebuild index 70c620a..aaec55e 100755 --- a/builds/utils/sh/rebuild +++ b/builds/utils/sh/rebuild @@ -1,2 +1,2 @@ cd ~/dot_testing -sudo nixos-rebuild -I nixos-config=./boxes/$(hostname).nix switch +sudo nixos-rebuild -I nixos-config=./boxes/$(hostname).nix switch $@ diff --git a/builds/utils/sh/regenerate b/builds/utils/sh/regenerate deleted file mode 100755 index 695e6b5..0000000 --- a/builds/utils/sh/regenerate +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -tmenu_path () { - IFS=" :" - for i in $PATH; do - for j in "$i"/*; do - [ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j" | xargs basename - done - done -} - -if [ "$1" = "-g" ] || [ "$(basename $0)" = "regenerate" ]; then - mkdir -p $HOME/.local/share - tmenu_path > $HOME/.local/share/tmenu_cache - xmessage "regeneration complete" -else - cat $HOME/.local/share/tmenu_cache | tmenu | ${SHELL:-"/bin/sh"} & -fi diff --git a/builds/utils/sh/toggle-contingency-mode b/builds/utils/sh/toggle-contingency-mode deleted file mode 100755 index 9052a29..0000000 --- a/builds/utils/sh/toggle-contingency-mode +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -pid=$(pgrep sxhkd) - -for i in $pid; do - inv_id=$(cat /proc/$i/cmdline | awk -F'\0' '{print $3}') - - echo $inv_id - [ -z "$inv_id" ] && contingency_mode="off" - [ "$inv_id" = *"contingency" ] && contingency_mode="on" -done - -killall sxhkd - -trackpoint=$(xinput | grep "TrackPoint" | awk -F'\t' '{print $2}' | awk -F'=' '{print $2}') -touchpad=$(xinput | grep "TouchPad" | awk -F'\t' '{print $2}' | awk -F'=' '{print $2}') - -if [ "$contingency_mode" = "off" ]; then - sxhkd -c $HOME/.config/sxhkd/contingency & - xinput disable "$trackpoint" - xinput disable "$touchpad" - xmessage "contingency mode enabled." -else - sxhkd & - xinput enable "$trackpoint" - xinput enable "$touchpad" - killall xmessage -fi diff --git a/common/desktop.nix b/common/desktop.nix index 1a32ac2..47692dd 100644 --- a/common/desktop.nix +++ b/common/desktop.nix @@ -36,6 +36,7 @@ in { xclip xcape ffmpeg + man-pages ncmpcpp pciutils @@ -137,11 +138,15 @@ in { services.mpd = { enable = true; musicDirectory = "/home/usr/music"; + user = "usr"; extraConfig = '' audio_output { type "pulse" - name "pulseaudio" - server "127.0.0.1" + name "Pulseaudio" + } + audio_output { + type "alsa" + name "mpd alsamixer-output" } ''; }; @@ -170,10 +175,16 @@ in { fi ''; - home-manager.users.usr.home = { - stateVersion = "23.05"; + home-manager.users.usr = { + home.stateVersion = "23.05"; - file = { + programs.neovim = { + enable = true; + extraLuaPackages = luaPkgs: with luaPkgs; [ luaexpat ]; + extraPackages = [ pkgs.sqlite ]; + }; + + home.file = { ".config/bash" = { source = ../config/bash; recursive = true; @@ -226,6 +237,10 @@ in { source = ../config/gnupg; recursive = true; }; + ".config/emacs" = { + source = ../config/emacs; + recursive = true; + }; }; }; diff --git a/common/main.nix b/common/main.nix index 4f62e31..beebdae 100644 --- a/common/main.nix +++ b/common/main.nix @@ -1,6 +1,10 @@ { lib, config, pkgs, ... }: -{ +let +my_neovim = pkgs.neovim.overrideAttrs (oldAttrs: { + buildInputs = oldAttrs.buildInputs or [] ++ [ pkgs.luajitPackages.luaexpat ]; +}); +in { imports = [ ../hardware-configuration.nix # include the results of the hardware scan @@ -17,7 +21,6 @@ }; environment.systemPackages = with pkgs; [ - neovim curl htop git diff --git a/config/emacs/init.el b/config/emacs/init.el new file mode 100644 index 0000000..b6443ed --- /dev/null +++ b/config/emacs/init.el @@ -0,0 +1,141 @@ +;; rndusr's init.el + +;; configure the package manager +(require 'package) +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) +(package-initialize) +;; (package-refresh-contents) + +; disable annoying ui features +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) + +(defun keymap-symbol (keymap) + "Return the symbol to which KEYMAP is bound, or nil if no such symbol exists." + (catch 'gotit + (mapatoms (lambda (sym) + (and (boundp sym) + (eq (symbol-value sym) keymap) + (not (eq sym 'keymap)) + (throw 'gotit sym)))))) + +(defun get-local-map () (interactive) (message "Current mapping: %S" (keymap-symbol (current-local-map)))) + +;; download packages +(unless (package-installed-p 'evil) + (package-install 'evil)) +(unless (package-installed-p 'org) + (package-install 'org)) +(unless (package-installed-p 'org-drill) + (package-install 'org-drill)) +(unless (package-installed-p 'accent) + (package-install 'accent)) +(unless (package-installed-p 'elfeed) + (package-install 'elfeed)) +(unless (package-installed-p 'hackernews) + (package-install 'hackernews)) +(unless (package-installed-p 'emms) + (package-install 'emms)) +(unless (package-installed-p 'company) + (package-install 'company)) +(unless (package-installed-p 'anaconda-mode) + (package-install 'anaconda-mode)) +(unless (package-installed-p 'company-anaconda) + (package-install 'company-anaconda)) + +;; activate packages +(require 'evil) +(require 'org) +(require 'org-drill) +(require 'accent) +(require 'elfeed) +(require 'hackernews) +(require 'emms) +(require 'company) +(require 'anaconda-mode) +(require 'company-anaconda) + +;; configure packages + +;; - evil-mode +(evil-set-initial-state 'elfeed-search 'emacs) + +;; swap ; and : +(with-eval-after-load 'evil-maps + (define-key evil-motion-state-map (kbd ";") 'evil-ex)) + +(evil-set-leader 'normal (kbd "")) +(defun configreload () (interactive) (load "~/.config/emacs/init.el")) + +(evil-define-key 'normal 'global (kbd "rr") 'configreload) +(evil-ex-define-cmd "get-current-mapping" 'get-local-map) +(evil-mode 1) + +;; company-mode +(add-hook 'after-init-hook 'global-company-mode) +(setq company-idle-delay 1 + company-tooltip-idle-delay 10 + company-require-match nil + company-frontends + '(company-pseudo-tooltip-unless-just-one-frontend-with-delay + company-preview-frontend + company-echo-metadata-frontend) + company-backends '(company-capf)) +(setq company-tooltip-align-annotations t) +(add-to-list 'company-backends 'company-anaconda) +(add-hook 'python-mode-hook 'anaconda-mode) + + + +;; org +(setq org-agenda-files '("~/org")) +(setq calendar-week-start-day 1) +(setq org-todo-keywords '((type "MEETING" "CLASS" "TODO" "REHERSAL" "|" "DONE"))) +(setq org-return-follows-link t) + +;; emms +(require 'emms-player-simple) +(require 'emms-source-file) +(require 'emms-source-playlist) + +(emms-all) +(emms-default-players) + +(evil-define-key 'normal 'emms-browser-mode-map (kbd "z") 'emms-browser-expand-one-level) +(evil-define-key 'normal 'emms-browser-mode-map (kbd "RET") 'emms-browser-add-tracks-and-play) +(evil-define-key 'normal 'emms-browser-mode-map (kbd "e") 'emms-browser-add-tracks) + +;; - elfeed +(global-set-key (kbd "C-x w") 'elfeed) + +(setq elfeed-feeds + '("http://nullprogram.com/feed/" + "https://drewdevault.com/blog/index.xml" + "https://digitallibrary.un.org/rss?ln=en&p=libya&rg=50&c=Resource%20Type&c=UN%20Bodies" + "https://planet.emacslife.com/atom.xml")) + +;; - accent.el +(evil-define-key 'insert 'global (kbd "C-k") 'accent-menu) + + + +;; fonts +(set-face-attribute 'default nil + :font "Fantasque Sans Mono 10" + :foreground "white" :background "gray8") + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(package-selected-packages + '(company-anaconda anaconda-mode company emms bongo accent org-drill hackernews evil elfeed))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 8b4f7f2..0a5b4b8 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -30,12 +30,13 @@ nnoremap(':', ';') nnoremap('', ':') -- source init.vim +-- requires rebuilding the configuration first nnoremap('rr', function() cmd.source('~/.config/nvim/init.lua') end) -- edit init.vim nnoremap('re', function() - cmd.edit('~/.config/nvim/init.lua') + cmd.edit('~/dot_testing/config/nvim/init.lua') end) -- openup netrw nnoremap('fs', function() @@ -79,22 +80,6 @@ globals.vimtex_view_method = 'zathura' -- }}} -- autocommands {{{ --- swapfile handler -vim.api.nvim_create_autocmd({"SwapExists"}, { - pattern = {"*"}, - callback = function() - vim.fn.system("vim-swap-handler " .. vim.api.nvim_buf_get_name(0)) - print(vim.v.shell_error) - if (vim.v.shell_error == 0) then - vim.v.swapchoice = 'o' - print("opened in other place. you should have teleported there") - elseif (vim.v.shell_error == 1) then - vim.v.swapchoice = 'o' - print("file opened readonly. orphaned swap file?") - end - end -}) - -- autocmds for sxhkd and bspwm config files vim.api.nvim_create_autocmd({"BufWrite"}, { pattern = {"bspwmrc"}, @@ -162,6 +147,7 @@ local packer = require('packer').startup(function(use) use 'wbthomason/packer.nvim' use 'nvim-lua/plenary.nvim' use 'nvim-telescope/telescope.nvim' + use 'octarect/telescope-menu.nvim' use 'VonHeikemen/lsp-zero.nvim' use 'neovim/nvim-lspconfig' use 'hrsh7th/nvim-cmp' @@ -171,6 +157,11 @@ local packer = require('packer').startup(function(use) use 'lervag/vimtex' use 'https://github.com/protex/better-digraphs.nvim' use 'https://github.com/itchyny/calendar.vim' + use { + "empat94/nvim-rss", + requires = { "tami5/sqlite.lua" }, + rocks = "luaexpat", + } use { "folke/which-key.nvim", config = function() @@ -208,6 +199,12 @@ lspconfig.jedi_language_server.setup({}) lsp.setup() -- }}} +require("nvim-rss").setup({ + feeds_dir = "/home/usr", + date_format = "%x %r", + verbose = false, +}) + nnoremap('ff', function() require('telescope.builtin').find_files() end) diff --git a/config/sxhkd/contingency b/config/sxhkd/contingency deleted file mode 100644 index 0ca4065..0000000 --- a/config/sxhkd/contingency +++ /dev/null @@ -1,2 +0,0 @@ -super + shift + XF86AudioRaiseVolume - toggle-contingency-mode diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index 96a3e62..7a2e4e1 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -15,9 +15,6 @@ super + r pkill -USR1 -x sxhkd; \ bspc wm -r -super + ctrl + shift + b - brightness - super + w disp && wallpaper && statusbar @@ -30,15 +27,6 @@ super + ctrl + n super + ctrl + t st -e htop -super + m - lobster - -{XF86ScreenSaver,super + shift + z} - slock - -XF86AudioMute - amixer sset Master 0% - {XF86AudioRaiseVolume,XF86AudioLowerVolume} vol {inc,dec} @@ -54,29 +42,6 @@ super + ctrl + b super + {_,shift + }v vol {inc,dec} -# mouse movement -super + {u, i, o, p} - xdotool mousemove_relative -- {-10 0, 0 10, 0 -10, 10 0} - -super + alt + {u, i, o, p} - xdotool mousemove_relative -- {-20 0, 0 20, 0 -20, 20 0} - -super + shift + u - xdotool click 1 - -super + ctrl + shift + u - xdotool mousedown 1 - -@super + @ctrl + @shift + @u - xdotool mouseup 1 - -super + shift + p - xdotool click 2 - -# misc -super + x - toggle-contingency-mode - # bspwm super + q bspc node -c @@ -85,14 +50,13 @@ super + e bspc quit 0 super + shift + e - systemctl suspend + systemctl suspend super + {_,ctrl +,shift + }{h,j,k,l} bspc node -{f,p,s} {west,south,north,east} super + {_,shift + } {1-9,0} - bspc {desktop -f,node -d} '^{1-9,10}'; \ - {killall -10 status,_} + bspc {desktop -f,node -d} '^{1-9,10}' super + {t,f,s} bspc node -t {tiled,floating,fullscreen}