Skip to content

Commit

Permalink
commit latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanReeve committed Nov 1, 2023
1 parent 1f1191d commit c92ed88
Show file tree
Hide file tree
Showing 11 changed files with 616 additions and 223 deletions.
90 changes: 36 additions & 54 deletions dotfiles/config.nu
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
# Handy aliases
def em [f] {emacsclient -c $f &; disown}

# Wallpaper management
def wal-fav [] {
open ~/.cache/wal/colors.json | get wallpaper |
each { |it| echo $it (char newline)} |
str collect | save --append ~/.cache/wal/favs
}

def wal-fav-set [] {
let w = (open ~/.cache/wal/favs | lines | uniq | shuffle | first)
echo $"Using ($w)"
pkill swaybg
swaybg -o 'DP-6' -i $w -m fill
}

def wal-recent [] {wal -i (ls /run/media/jon/systemrestore/.systemrestore/Bildoj | sort-by modified -r | first 50 | shuffle | first | get name)}
def wal-backup [] {sudo rsync -a /home/systemrestore/Bildoj /run/media/jon/systemrestore/.systemrestore}

# Project managemnt
def proj [project] {
open ~/Dotfiles/scripts/projects.yaml | where name == $project | select websites | each { |it| qutebrowser $it.websites };
open ~/Dotfiles/scripts/projects.yaml | where name == $project | select textFiles | each { emacsclient -c $it.textFiles & };
}

# Jump around with z
# zoxide init nushell --hook prompt | save ~/.zoxide.nu
source ~/.zoxide.nu

# Starship config from https://www.nushell.sh/book/3rdpartyprompts.html#starship
let-env STARSHIP_SHELL = "nu"

def create_left_prompt [] {
starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)'
}

# Use nushell functions to define your right and left prompt
let-env PROMPT_COMMAND = { create_left_prompt }
let-env PROMPT_COMMAND_RIGHT = ""

# The prompt indicators are environmental variables that represent
# the state of the prompt
let-env PROMPT_INDICATOR = ""
let-env PROMPT_INDICATOR_VI_INSERT = ": "
let-env PROMPT_INDICATOR_VI_NORMAL = ""
let-env PROMPT_MULTILINE_INDICATOR = "::: "

# https://raw.githubusercontent.com/nushell/nu_scripts/main/background_task/job.nu
# spawn task to run in the background
Expand All @@ -54,17 +7,17 @@ let-env PROMPT_MULTILINE_INDICATOR = "::: "
#
# e.g:
# spawn { echo 3 }
export def spawn [
command: block # the command to spawn
export def pspawn [
command: closure # the command to spawn
] {
let config_path = $nu.config-path
let env_path = $nu.env-path
let source_code = (view-source $command | str trim -l -c '{' | str trim -r -c '}')
let source_code = (view source $command | str trim -l -c '{' | str trim -r -c '}')
let job_id = (pueue add -p $"nu --config \"($config_path)\" --env-config \"($env_path)\" -c '($source_code)'")
{"job_id": $job_id}
}

export def log [
export def plog [
id: int # id to fetch log
] {
pueue log $id -f --json
Expand All @@ -76,7 +29,7 @@ export def log [
}

# get job running status
export def status () {
export def pstatus () {
pueue status --json
| from json
| get tasks
Expand All @@ -86,11 +39,40 @@ export def status () {
}

# kill specific job
export def kill (id: int) {
export def pkill (id: int) {
pueue kill $id
}

# clean job log
export def clean () {
export def pclean () {
pueue clean
}
# Wallpaper management
def wal-fav [] {
open ~/.cache/wal/colors.json | get wallpaper |
each { |it| echo $it (char newline)} |
str join | save --append ~/.cache/wal/favs
}

def wal-fav-set [] {
let w = (open ~/.cache/wal/favs | lines | uniq | shuffle | first)
echo $"Using ($w)"
# pkill swaybg
spawn { swaybg -o 'DP-6' -i $w -m fill }
}

def wal-recent [] {wal -i (ls /run/media/jon/systemrestore/.systemrestore/Bildoj | sort-by modified -r | first 50 | shuffle | first | get name)}
def wal-backup [] {sudo rsync -a /home/systemrestore/Bildoj /run/media/jon/systemrestore/.systemrestore}

# Project managemnt
def proj [project] {
open ~/Dotfiles/scripts/projects.yaml | where name == $project | select websites | each { |it| qutebrowser $it.websites };
open ~/Dotfiles/scripts/projects.yaml | where name == $project | select textFiles | each { emacsclient -c $it.textFiles & };
}

def create_left_prompt [] {
starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)'
}

# Handy aliases
def em [f] { spawn { emacsclient -c $f } }
46 changes: 29 additions & 17 deletions dotfiles/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, options, ... }:
{ config, pkgs, options, lib, ... }:

{
imports =
Expand All @@ -21,7 +21,7 @@
kernelPackages = pkgs.linuxPackages_latest;
kernelModules = [ "btqca" "hci_qca" "hci_uart" "bluetooth" ];
blacklistedKernelModules = [ "psmouse" ];
cleanTmpDir = true;
tmp.cleanOnBoot = true;
plymouth.enable = true;
resumeDevice = "/dev/nvme0n1p4";
loader.systemd-boot.enable = true;
Expand Down Expand Up @@ -50,8 +50,19 @@
};
};

nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowBroken = true;
nixpkgs = {
config = { allowUnfree = true;
allowBroken = true;
};
overlays = [
# (import (builtins.fetchTarball {
# url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
# sha256 = "0i74f97f3ljr49jlhh60pglqsfj6vbwigyrl5q76sclirkzfyvr0";
# }
# ))
];
};


console.useXkbConfig = true;

Expand All @@ -62,7 +73,7 @@
};

# Fonts!
fonts.fonts = with pkgs; [
fonts.packages = with pkgs; [
fantasque-sans-mono
font-awesome_5
fira-code
Expand All @@ -80,7 +91,7 @@
kochi-substitute # Japanese
];
# Set your time zone.
time.timeZone = "America/New_York";
time.timeZone = "America/Los_Angeles";

# List packages installed in system profile. To search, run:
# $ nix search wget
Expand All @@ -100,7 +111,7 @@
megasync # Backups
megacmd
keybase-gui # Also backups
logseq # Fancy notes
#logseq # Fancy notes

# CLI
fish # Shell
Expand All @@ -113,7 +124,7 @@
gcc gnumake
gnupg
wget
isync mu w3m # Mail
isync w3m # Mail
protonmail-bridge
gnutls # For mail auth
protonvpn-cli # VPN
Expand All @@ -127,6 +138,7 @@
dict # Dictionary

pywal
wallust
ranger

# Building stuff
Expand Down Expand Up @@ -380,15 +392,15 @@
# };
};

systemd.user.services.protonmail = {
description = "Protonmail Bridge";
enable = true;
script =
"${pkgs.protonmail-bridge}/bin/protonmail-bridge --log-level debug";
path = [ pkgs.gnome.gnome-keyring ]; # HACK: https://github.com/ProtonMail/proton-bridge/issues/176
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};
# systemd.user.services.protonmail = {
# description = "Protonmail Bridge";
# enable = true;
# script =
# "${pkgs.protonmail-bridge}/bin/protonmail-bridge --log-level debug";
# path = [ pkgs.gnome.gnome-keyring ]; # HACK: https://github.com/ProtonMail/proton-bridge/issues/176
# wantedBy = [ "graphical-session.target" ];
# partOf = [ "graphical-session.target" ];
# };
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
Expand Down
67 changes: 43 additions & 24 deletions dotfiles/emacs/doom.d/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
(package-initialize)

;; Set location of custom.el
(setq custom-file "~/.emacs.d/custom.el")
(setq custom-file "~/.config/emacs/custom.el")

(setq doom-font (font-spec :family "Fantasque Sans Mono" :size 18))
(setq doom-font (font-spec :family "Victor Mono" :size 18))
(setq doom-themes-treemacs-enable-variable-pitch 'nil)

(setq vc-follow-symlinks t) ;; Always follow symlinks.
Expand Down Expand Up @@ -74,7 +74,7 @@
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "/home/jon/Dokumentujo/Org/notes.org" "Tasks")
"* TODO %? %i\n %a")
("m" "Movie" entry (file+headline "/home/jon/Dokumentujo/Org/Roam/movies.org" "To Watch")
("m" "Movie" entry (file+headline "/home/jon/Dokumentujo/Org/Roam/movies.org" "to watch")
"* %a\n %?\n %i")
("l" "Link" entry (file+olp "/home/jon/Dokumentujo/Org/notes.org" "Web Links")
"* %a\n %?\n %i")
Expand Down Expand Up @@ -397,6 +397,10 @@ If nil it defaults to `split-string-default-separators', normally
(global-org-modern-mode)
(setq org-modern-label-border 1)

(defun org-procrastinate ()
"Set the scheduled date on an Org agenda item to tomorrow."
(interactive)
(org-agenda-schedule nil "+1d"))
) ;; End of Org block

;; (use-package! org-clock-reminder
Expand All @@ -415,7 +419,7 @@ If nil it defaults to `split-string-default-separators', normally

;; Mail
(after! mu4e
(require 'org-mu4e)
;; (require 'org-mu4e)
(setq read-mail-command 'mu4e) ;; Why is this not already set?
;; Respond to calendar invites. But is this even working?
(require 'mu4e-icalendar)
Expand Down Expand Up @@ -494,25 +498,25 @@ If nil it defaults to `split-string-default-separators', normally

(after! org-msg
(setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil \\n:t"
org-msg-startup "hidestars indent inlineimages"
org-msg-greeting-fmt "\nHi%s,\n\n"
org-msg-default-alternatives '((new . (text html))
(reply-to-html . (text html))
(reply-to-text . (text html)))
org-msg-convert-citation t
org-msg-signature "
Best,
Jonathan
#+begin_signature
--
Jonathan Reeve
https://jonreeve.com
#+end_signature")
(setq message-citation-line-format "Je %a, %b %d %Y, %N skribis:\n")
(setq org-msg-posting-style nil)
org-msg-startup "hidestars indent inlineimages"
org-msg-greeting-fmt "\nHi%s,\n\n"
org-msg-default-alternatives '((new . (text html))
(reply-to-html . (text html))
(reply-to-text . (text html))))
;; (setq org-msg-convert-citation t
;; org-msg-signature "

;; Best,

;; Jonathan

;; #+begin_signature
;; --
;; Jonathan Reeve
;; https://jonreeve.com
;; #+end_signature")
;; (setq message-citation-line-format "Je %a, %b %d %Y, %N skribis:\n")
;; (setq org-msg-posting-style nil) ;
)

;; Set browser
Expand Down Expand Up @@ -572,6 +576,8 @@ https://jonreeve.com
:g "<f3>" #'org-todo-list
)

(map! :map evil-org-agenda-mode-map "P" 'org-procrastinate)

(map! :map evil-treemacs-state-map "n" 'treemacs-next-line
"e" 'treemacs-previous-line)

Expand Down Expand Up @@ -647,6 +653,15 @@ https://jonreeve.com
(message "Aborted.")
))

(defun rename-epub ()
" Rename the most recently modified Epub in the /tmp dir with the latest bibtex key. "
(interactive)
(setq most-recent-epub (string-trim-right (shell-command-to-string "ls -t /tmp/*.epub | head -1")))
(setq dest-epub-filename (string-trim-right (concat bibtex-completion-library-path (bibtex-completion-get-key-bibtex) ".epub")))
(if (yes-or-no-p (concat "Rename " most-recent-epub " to " dest-epub-filename "?"))
(rename-file most-recent-epub dest-epub-filename)
(message "Aborted.")
))
;; (use-package! notebook-mode)

;; (use-package! evil-colemak-basics
Expand All @@ -672,4 +687,8 @@ https://jonreeve.com
(set-locale-environment "eo.utf-8")

;; Scala
(add-to-list '+org-babel-mode-alist '(scala . ammonite))
;; (add-to-list '+org-babel-mode-alist '(scala . ammonite))

;; Word wrap issues; possible fix for https://github.com/doomemacs/doomemacs/issues/7133
(setq +global-word-wrap-mode 'nil)
(setq font-lock-global-modes '(not mu4e-compose-mode))
2 changes: 1 addition & 1 deletion dotfiles/emacs/doom.d/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
;;rst ; ReST in peace
;;ruby ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
(scala +lsp) ; java, but good
;; (scala +lsp) ; java, but good
;;scheme ; a fully conniving family of lisps
(sh +bash +fish) ; she sells {ba,z,fi}sh shells on the C xor
;;solidity ; do you need a blockchain? No.
Expand Down
2 changes: 1 addition & 1 deletion dotfiles/emacs/doom.d/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
(package! org-roam-bibtex
:recipe (:host github :repo "org-roam/org-roam-bibtex"))

(package! org-cite-csl-activate :recipe (:host github :repo "andras-simonyi/org-cite-csl-activate" :files ("*.el")))
;; (package! org-cite-csl-activate :recipe (:host github :repo "andras-simonyi/org-cite-csl-activate" :files ("*.el")))

(package! org-clock-reminder
:recipe (:host github :repo "inickey/org-clock-reminder"))
Expand Down
Loading

0 comments on commit c92ed88

Please sign in to comment.