From 88051c9ccfa9b863b41f0ae86dbb1caaeb739743 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sat, 12 Jun 2021 21:26:56 +0700 Subject: Overhaul configurations --- README.md | 17 ++----- awesome/.config/awesome/rc.lua | 52 ++++++++++++++------- bin/.local/bin/gaerc | 2 + bin/.local/bin/totp | 2 + commit.sh | 2 - debian-screenshot.png | Bin 626274 -> 0 bytes fedora-screenshot.png | Bin 770004 -> 0 bytes fedora/.bash_profile | 10 ---- fedora/.bashrc | 23 --------- newsboat/.config/newsboat/urls | 1 + nix/etc/nixos/awesome.nix | 7 +-- nix/etc/nixos/configuration.nix | 43 +++++++++++------ nix/etc/nixos/devel.nix | 13 +++++- nixos-screenshot.png | Bin 576279 -> 0 bytes .../user/default.target.wants/mbsync-legacy.timer | 1 - .../user/default.target.wants/mbsync-primary.timer | 1 - .../systemd/user/default.target.wants/mbsync.timer | 1 + nixos/.config/systemd/user/mbsync-legacy.service | 12 ----- nixos/.config/systemd/user/mbsync-legacy.timer | 11 ----- nixos/.config/systemd/user/mbsync-primary.service | 12 ----- nixos/.config/systemd/user/mbsync-primary.timer | 11 ----- nixos/.config/systemd/user/mbsync.service | 12 +++++ nixos/.config/systemd/user/mbsync.timer | 11 +++++ nixos/.xinitrc | 4 +- ranger/.config/ranger/rc.conf | 23 +++++++-- ranger/.config/ranger/rifle.conf | 1 + screenshot.png | Bin 0 -> 626274 bytes 27 files changed, 131 insertions(+), 141 deletions(-) create mode 100755 bin/.local/bin/gaerc create mode 100755 bin/.local/bin/totp delete mode 100755 commit.sh delete mode 100644 debian-screenshot.png delete mode 100644 fedora-screenshot.png delete mode 100644 fedora/.bash_profile delete mode 100644 fedora/.bashrc delete mode 100644 nixos-screenshot.png delete mode 120000 nixos/.config/systemd/user/default.target.wants/mbsync-legacy.timer delete mode 120000 nixos/.config/systemd/user/default.target.wants/mbsync-primary.timer create mode 120000 nixos/.config/systemd/user/default.target.wants/mbsync.timer delete mode 100644 nixos/.config/systemd/user/mbsync-legacy.service delete mode 100644 nixos/.config/systemd/user/mbsync-legacy.timer delete mode 100644 nixos/.config/systemd/user/mbsync-primary.service delete mode 100644 nixos/.config/systemd/user/mbsync-primary.timer create mode 100644 nixos/.config/systemd/user/mbsync.service create mode 100644 nixos/.config/systemd/user/mbsync.timer create mode 100644 screenshot.png diff --git a/README.md b/README.md index bc29355..3e05259 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,9 @@ # dotfiles -Dotfiles of my Debian testing, Fedora workstation and NixOS unstable, -managed by GNU Stow. +Dotfiles of my Debian and NixOS systems, managed by GNU Stow. -![Debian testing](debian-screenshot.png) +![Screenshot](screenshot.png) -The Debian desktop uses awesome, bash, Git, Firefox, ranger, Vim, URxvt +Both uses awesome, bash, Git, Firefox, ranger, Vim, URxvt and Zathura. Most of these applications are themed with the [srcery](https://github.com/srcery-colors/srcery-vim) colorscheme. - -![Fedora workstation](fedora-screenshot.png) - -The Fedora desktop is vanilla GNOME with Emacs. Yes you can run four systems -in parallel: GNU/Linux, systemd, GNOME JS VM and Emacs. - -![NixOS unstable](nixos-screenshot.png) - -The NixOS uses KDE Plasma with Emacs and Alacritty. Nothing really special -other than the Nix itself. diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua index 11140c7..a204762 100644 --- a/awesome/.config/awesome/rc.lua +++ b/awesome/.config/awesome/rc.lua @@ -1,17 +1,18 @@ --- Standard awesome library -local gears = require"gears" +-- Awesome library local awful = require"awful" -require"awful.autofocus" --- Widget and layout library +local beautiful = require"beautiful" +local gears = require"gears" +local menubar = require"menubar" +local naughty = require"naughty" local wibox = require"wibox" + +-- Awful submodules +require"awful.autofocus" +local show_help = require"awful.hotkeys_popup".widget.show_help + -- Menu library local freedesktop = require"freedesktop" --- Theme handling library -local beautiful = require"beautiful" --- Notification library -local naughty = require"naughty" -local menubar = require"menubar" -local hotkeys_popup = require"awful.hotkeys_popup".widget + -- System data library local vicious = require"vicious" @@ -64,8 +65,9 @@ local play_pause = "playerctl play-pause" local rewind = "playerctl previous" local forward = "playerctl next" -local scrot = "scrot /home/cnx/Desktop/%FT%T.png" -local scrot_select = "scrot --border --select /home/cnx/Desktop/%FT%T.png" +local home = os.getenv("HOME") +local scrot = "scrot " .. home .. "/Desktop/%FT%T.png" +local scrot_select = "scrot --border --select " .. home .. "/Desktop/%FT%T.png" -- Default modkey. -- Usually, Mod4 is the key with a logo between Control and Alt. @@ -122,7 +124,7 @@ end -- {{{ Menu -- Create a launcher widget and a main menu local myawesomemenu = { - {"hotkeys", function () return false, hotkeys_popup.show_help end}, + {"hotkeys", function () return false, show_help end}, {"manual", terminal .. " -e man awesome"}, {"edit config", editor .. " " .. awesome.conffile}, {"restart", awesome.restart}, @@ -134,6 +136,24 @@ local mymainmenu = freedesktop.menu.build{ after = {{"Open terminal", terminal}} } +local function showclipboard() + local base = home .. "/.cache/threa/" + local command = "threac %s && xdotool key shift+Insert" + local f = io.open(base .. "order") + local order = f:read("*a") + f:close() + + local items = {} + for c in order:gmatch(".") do + local f = io.open(base .. c) + table.insert(items, {f:read("*a"):gsub("\n", " "), function () + awful.spawn.with_shell(command:format(c)) + end}) + f:close() + end + awful.menu{items = items, theme = {width = 911}}:show() +end + -- mylauncher = awful.widget.launcher{image = beautiful.awesome_icon, -- menu = mymainmenu} @@ -420,7 +440,7 @@ end local globalkeys = awful.util.table.join( awful.key({modkey, "Control"}, "x", lua_prompt, {description = "execute prompt", group = "awesome"}), - awful.key({modkey, "Control"}, "s", hotkeys_popup.show_help, + awful.key({modkey, "Control"}, "s", show_help, {description="show help", group="awesome"}), awful.key({modkey}, "Left", awful.tag.viewprev, {description = "view previous", group = "tag"}), @@ -435,6 +455,8 @@ local globalkeys = awful.util.table.join( {description = "focus previous by index", group = "client"}), awful.key({modkey}, "w", function () mymainmenu:show() end, {description = "show main menu", group = "awesome"}), + awful.key({modkey}, "d", showclipboard, + {description = "show clipboard", group = "awesome"}), -- Layout manipulation awful.key({modkey, "Shift"}, "j", function () awful.client.swap.byidx(1) end, @@ -494,8 +516,6 @@ local globalkeys = awful.util.table.join( {description = "open Clojure interpreter", group = "launcher"}), awful.key({modkey}, "g", spawner(guile), {description = "open Guile interpreter", group = "launcher"}), - awful.key({modkey}, "d", spawner"diodon", - {description = "open clipboard manager", group = "launcher"}), awful.key({modkey}, "s", spawner"slock", {description = "lock screen", group = "launcher"}), awful.key({modkey, "Shift"}, "s", spawner(slock_suspend), diff --git a/bin/.local/bin/gaerc b/bin/.local/bin/gaerc new file mode 100755 index 0000000..92f4978 --- /dev/null +++ b/bin/.local/bin/gaerc @@ -0,0 +1,2 @@ +#!/bin/sh +exec urxvt -e aerc "$@" diff --git a/bin/.local/bin/totp b/bin/.local/bin/totp new file mode 100755 index 0000000..6a84899 --- /dev/null +++ b/bin/.local/bin/totp @@ -0,0 +1,2 @@ +#!/bin/sh +oathtool --totp --base32 $(cat $HOME/.totp/$1) diff --git a/commit.sh b/commit.sh deleted file mode 100755 index 80cec13..0000000 --- a/commit.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -git commit -am "Update $(date -I)" diff --git a/debian-screenshot.png b/debian-screenshot.png deleted file mode 100644 index 4e5cd16..0000000 Binary files a/debian-screenshot.png and /dev/null differ diff --git a/fedora-screenshot.png b/fedora-screenshot.png deleted file mode 100644 index 488e231..0000000 Binary files a/fedora-screenshot.png and /dev/null differ diff --git a/fedora/.bash_profile b/fedora/.bash_profile deleted file mode 100644 index eadc104..0000000 --- a/fedora/.bash_profile +++ /dev/null @@ -1,10 +0,0 @@ -# .bash_profile - -# Get the aliases and functions -if [ -f ~/.bashrc ]; then - . ~/.bashrc -fi - -# User specific environment and startup programs -export GOPATH=$HOME/.local/share/go -export PATH=$PATH:$HOME/.local/bin:$GOPATH/bin:$HOME/.cargo/bin diff --git a/fedora/.bashrc b/fedora/.bashrc deleted file mode 100644 index 23e034a..0000000 --- a/fedora/.bashrc +++ /dev/null @@ -1,23 +0,0 @@ -# .bashrc - -# Source global definitions -if [ -f /etc/bashrc ]; then - . /etc/bashrc -fi - -# Uncomment the following line if you don't like systemctl's auto-paging feature: -# export SYSTEMD_PAGER= - -# User specific aliases and functions -alias stow='stow -t /home/436e58' -alias gcc='gcc -Wall -Werror -O2 -lm' -alias g++='g++ -Wall -Werror -O2 -lm' -alias fpc='fpc -O1 -XS -gl' -alias raku='rlwrap perl6' -alias backup='rsync -avh --delete /home/ /data/Home/' - -PATH="/home/436e58/perl5/bin${PATH:+:${PATH}}"; export PATH; -PERL5LIB="/home/436e58/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; -PERL_LOCAL_LIB_ROOT="/home/436e58/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; -PERL_MB_OPT="--install_base \"/home/436e58/perl5\""; export PERL_MB_OPT; -PERL_MM_OPT="INSTALL_BASE=/home/436e58/perl5"; export PERL_MM_OPT; diff --git a/newsboat/.config/newsboat/urls b/newsboat/.config/newsboat/urls index c1ef379..7b6e7fc 100644 --- a/newsboat/.config/newsboat/urls +++ b/newsboat/.config/newsboat/urls @@ -5,6 +5,7 @@ https://www.fsf.org/static/fsforg/rss/news.xml https://www.fsf.org/static/fsforg/rss/jobs.xml https://ar.al/index.xml https://andrewkelley.me/rss.xml +https://tyil.nl/atom.xml https://andrewshitov.com/feed https://codesections.com/rss.xml https://pgjones.dev/blog/atom.xml diff --git a/nix/etc/nixos/awesome.nix b/nix/etc/nixos/awesome.nix index 25e639e..dfd526d 100644 --- a/nix/etc/nixos/awesome.nix +++ b/nix/etc/nixos/awesome.nix @@ -28,10 +28,11 @@ environment.systemPackages = with pkgs; [ gnome.adwaita-icon-theme qt5ct - gnome.networkmanagerapplet mate.mate-power-manager playerctl pulsemixer + gnome.networkmanagerapplet keynav mate.mate-power-manager + clipnotify playerctl pulsemixer xclip xdotool rxvt_unicode-with-plugins urxvt_autocomplete_all_the_things urxvt_font_size - aerc amfora autocutsel firefox keynav newsboat ranger - arandr audacious gimp scrot vim_configurable + aerc amfora newsboat ranger ueberzug vim_configurable + arandr audacious firefox gimp nheko scrot xorg.xkill zathura ]; programs.nm-applet.enable = true; diff --git a/nix/etc/nixos/configuration.nix b/nix/etc/nixos/configuration.nix index 7e6e108..2829879 100644 --- a/nix/etc/nixos/configuration.nix +++ b/nix/etc/nixos/configuration.nix @@ -13,13 +13,19 @@ # Use the systemd-boot EFI boot loader. boot.loader = { - systemd-boot.enable = true; efi.canTouchEfiVariables = true; - grub.useOSProber = true; + grub = { + enable = true; + device = "nodev"; + efiSupport = true; + useOSProber = true; + splashImage = null; + }; }; networking = { hostName = "nix"; + nameservers = [ "9.9.9.11" "149.112.112.11" ]; networkmanager.enable = true; # The global useDHCP flag is deprecated, therefore explicitly set @@ -56,23 +62,30 @@ environment.systemPackages = with pkgs; [ htop isync killall oathToolkit rsync stow w3m wget - ffmpeg mpv pavucontrol pqiv + ffmpeg mpv pavucontrol vimiv-qt youtube-dl ]; + security.rtkit.enable = true; # List services that you want to enable: - services.printing.enable = true; + services = { + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - - # Use the example session manager (no others are packaged yet so this is - # enabled by default, no need to redefine it in your config for now) - # media-session.enable = true; + # Use the example session manager (no others are packaged yet so this is + # enabled by default, no need to redefine it in your config for now) + # media-session.enable = true; + }; + + printing.enable = true; + + dictd = { + enable = true; + DBs = with pkgs.dictdDBs; [ wiktionary wordnet ]; + }; }; # This value determines the NixOS release from which the default diff --git a/nix/etc/nixos/devel.nix b/nix/etc/nixos/devel.nix index 86c842c..e554da9 100644 --- a/nix/etc/nixos/devel.nix +++ b/nix/etc/nixos/devel.nix @@ -2,8 +2,8 @@ { environment.systemPackages = with pkgs; [ - exa fd git ripgrep - clojure guile leiningen python3 rakudo zig + exa fd git glow ripgrep rlwrap + clojure guile julia-stable leiningen lua python3 rakudo zig texlive.combined.scheme-tetex ]; @@ -19,5 +19,14 @@ enable = true; dataDir = "/data/IPFS"; }; + + postgresql = { + enable = true; + enableTCPIP = true; + authentication = pkgs.lib.mkOverride 10 '' + local all all trust + host all all ::1/128 trust + ''; + }; }; } diff --git a/nixos-screenshot.png b/nixos-screenshot.png deleted file mode 100644 index 852c3a2..0000000 Binary files a/nixos-screenshot.png and /dev/null differ diff --git a/nixos/.config/systemd/user/default.target.wants/mbsync-legacy.timer b/nixos/.config/systemd/user/default.target.wants/mbsync-legacy.timer deleted file mode 120000 index d6a74a0..0000000 --- a/nixos/.config/systemd/user/default.target.wants/mbsync-legacy.timer +++ /dev/null @@ -1 +0,0 @@ -/home/sea/.config/systemd/user/mbsync-legacy.timer \ No newline at end of file diff --git a/nixos/.config/systemd/user/default.target.wants/mbsync-primary.timer b/nixos/.config/systemd/user/default.target.wants/mbsync-primary.timer deleted file mode 120000 index fdf6883..0000000 --- a/nixos/.config/systemd/user/default.target.wants/mbsync-primary.timer +++ /dev/null @@ -1 +0,0 @@ -/home/sea/.config/systemd/user/mbsync-primary.timer \ No newline at end of file diff --git a/nixos/.config/systemd/user/default.target.wants/mbsync.timer b/nixos/.config/systemd/user/default.target.wants/mbsync.timer new file mode 120000 index 0000000..6842d01 --- /dev/null +++ b/nixos/.config/systemd/user/default.target.wants/mbsync.timer @@ -0,0 +1 @@ +/home/sea/.config/systemd/user/mbsync.timer \ No newline at end of file diff --git a/nixos/.config/systemd/user/mbsync-legacy.service b/nixos/.config/systemd/user/mbsync-legacy.service deleted file mode 100644 index e0954de..0000000 --- a/nixos/.config/systemd/user/mbsync-legacy.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Synchronize IMAP and MailDir for legacy account -Documentation=man:mbsync(1) -ConditionPathExists=%h/.mbsyncrc -After=network.target - -[Service] -ExecStart=/usr/bin/mbsync legacy -Type=oneshot - -[Install] -WantedBy=default.target diff --git a/nixos/.config/systemd/user/mbsync-legacy.timer b/nixos/.config/systemd/user/mbsync-legacy.timer deleted file mode 100644 index 3ea535a..0000000 --- a/nixos/.config/systemd/user/mbsync-legacy.timer +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Timer for legacy accound mbsync -ConditionPathExists=%h/.mbsyncrc -After=network.target - -[Timer] -OnBootSec=1m -OnUnitInactiveSec=1m - -[Install] -WantedBy=default.target diff --git a/nixos/.config/systemd/user/mbsync-primary.service b/nixos/.config/systemd/user/mbsync-primary.service deleted file mode 100644 index 8ce0e6f..0000000 --- a/nixos/.config/systemd/user/mbsync-primary.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Synchronize IMAP and MailDir for primary account -Documentation=man:mbsync(1) -ConditionPathExists=%h/.mbsyncrc -After=network.target - -[Service] -ExecStart=/usr/bin/mbsync primary -Type=oneshot - -[Install] -WantedBy=default.target diff --git a/nixos/.config/systemd/user/mbsync-primary.timer b/nixos/.config/systemd/user/mbsync-primary.timer deleted file mode 100644 index a0f4151..0000000 --- a/nixos/.config/systemd/user/mbsync-primary.timer +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Timer for primary accound mbsync -ConditionPathExists=%h/.mbsyncrc -After=network.target - -[Timer] -OnBootSec=1m -OnUnitInactiveSec=1m - -[Install] -WantedBy=default.target diff --git a/nixos/.config/systemd/user/mbsync.service b/nixos/.config/systemd/user/mbsync.service new file mode 100644 index 0000000..55b05b0 --- /dev/null +++ b/nixos/.config/systemd/user/mbsync.service @@ -0,0 +1,12 @@ +[Unit] +Description=Synchronize IMAP and MailDir +Documentation=man:mbsync(1) +ConditionPathExists=%h/.mbsyncrc +After=network.target + +[Service] +ExecStart=/run/current-system/sw/bin/mbsync primary legacy +Type=oneshot + +[Install] +WantedBy=default.target diff --git a/nixos/.config/systemd/user/mbsync.timer b/nixos/.config/systemd/user/mbsync.timer new file mode 100644 index 0000000..d2c980f --- /dev/null +++ b/nixos/.config/systemd/user/mbsync.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Timer for mbsync +ConditionPathExists=%h/.mbsyncrc +After=network.target + +[Timer] +OnBootSec=1m +OnUnitInactiveSec=1m + +[Install] +WantedBy=default.target diff --git a/nixos/.xinitrc b/nixos/.xinitrc index bb3847e..e230337 100644 --- a/nixos/.xinitrc +++ b/nixos/.xinitrc @@ -4,8 +4,6 @@ ibus-daemon -drx nm-applet & keynav & audacious & -autocutsel -fork -autocutsel -selection PRIMARY -fork -#diodon & +thread & autorandr --change exec awesome diff --git a/ranger/.config/ranger/rc.conf b/ranger/.config/ranger/rc.conf index d0e484c..79e8c14 100644 --- a/ranger/.config/ranger/rc.conf +++ b/ranger/.config/ranger/rc.conf @@ -57,7 +57,7 @@ set automatically_count_files true set open_all_images true # Be aware of version control systems and display information. -set vcs_aware false +set vcs_aware true # State of the four backends git, hg, bzr, svn. The possible states are # disabled, local (only show local info), enabled (show local and remote @@ -67,6 +67,9 @@ set vcs_backend_hg disabled set vcs_backend_bzr disabled set vcs_backend_svn disabled +# Truncate the long commit messages to this length when shown in the statusbar. +set vcs_msg_length 50 + # Use one of the supported image preview protocols set preview_images true @@ -106,7 +109,12 @@ set preview_images true # while slower, this allows remote previews, # for example during an ssh session. # Tmux is unsupported. -set preview_images_method urxvt +# +# * ueberzug: +# Preview images in full color with the external command "ueberzug". +# Images are shown by using a child window. +# Only for users who run X11 in GNU/Linux. +set preview_images_method ueberzug # Delay in seconds before displaying an image with the w3m method. # Increase it in case of experiencing display corruption. @@ -182,7 +190,7 @@ set shorten_title 3 set hostname_in_titlebar true # Abbreviate $HOME with ~ in the titlebar (first line) of ranger? -set tilde_in_titlebar false +set tilde_in_titlebar true # How many directory-changes or console-commands should be kept in history? set max_history_size 20 @@ -242,7 +250,7 @@ set cd_tab_fuzzy true # Avoid previewing files larger than this size, in bytes. Use a value of 0 to # disable this feature. -set preview_max_size 0 +set preview_max_size 4194304 # The key hint lists up to this size have their sublists expanded. # Otherwise the submaps are replaced with "...". @@ -273,7 +281,7 @@ set line_numbers relative set relative_current_zero false # Start line numbers from 1 instead of 0 -set one_indexed false +set one_indexed true # Save tabs on exit set save_tabs_on_exit false @@ -290,6 +298,11 @@ set global_inode_type_filter # should be 'false' during start-up, but you can toggle it by pressing F. set freeze_files false +# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words +# give a warning when you nest ranger in a subshell started by ranger. +# Special value "error" makes the warning more visible. +set nested_ranger_warning false + # =================================================================== # == Local Options # =================================================================== diff --git a/ranger/.config/ranger/rifle.conf b/ranger/.config/ranger/rifle.conf index bf3f768..67a60e1 100644 --- a/ranger/.config/ranger/rifle.conf +++ b/ranger/.config/ranger/rifle.conf @@ -170,6 +170,7 @@ ext cbr, has mcomix, X, flag f = mcomix -- "$@" mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" mime ^image/svg, has display, X, flag f = display -- "$@" +mime ^image, has vimiv, X, flag f = vimiv "$@" mime ^image, has viewnior, X, flag f = viewnior "$@" mime ^image, has pqiv, X, flag f = pqiv -- "$@" mime ^image, has sxiv, X, flag f = sxiv -- "$@" diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..4e5cd16 Binary files /dev/null and b/screenshot.png differ -- cgit 1.4.1