Compare commits

..

11 commits

Author SHA1 Message Date
Anish Lakhwara 00c9c074c1 working calendar alarms 2022-12-18 01:02:14 +10:00
Anish Lakhwara 30d6281a8f seperate out alarm script 2022-12-18 00:51:12 +10:00
Anish Lakhwara 749516aea6 add calendar alarms 2022-12-18 00:49:01 +10:00
Anish Lakhwara abdc275d86 tidoy few other things 2022-12-18 00:10:53 +10:00
Anish Lakhwara 115e66633a attempting email notifications 2022-12-18 00:10:14 +10:00
Anish Lakhwara ce410049c2 tidy up wallabag 2022-12-18 00:09:45 +10:00
Anish Lakhwara 5e64b27395 have to keep tic80 on v0.8 2022-12-16 00:27:47 +10:00
Anish Lakhwara 8d3fb42bc5 update offset for dunst 2022-12-15 20:29:52 +10:00
Anish Lakhwara 83802f6816 zen-mode nvim 2022-12-15 20:29:42 +10:00
Anish Lakhwara aaea8bfb64 add books to backup locations 2022-12-15 20:29:28 +10:00
Anish Lakhwara 260de2ef60 add tic-80 to curve 2022-12-15 20:29:19 +10:00
18 changed files with 295 additions and 31 deletions

View file

@ -312,11 +312,11 @@
"vimwiki-cli": "vimwiki-cli"
},
"locked": {
"lastModified": 1670936403,
"narHash": "sha256-alrM0QG1eXYJTjgQ/4Ahmw95FZ435cIHXwDNdq/mLUM=",
"lastModified": 1671282000,
"narHash": "sha256-qZb+kmp5tE59dBEC2/A+/rY6mOsWKZwaJCqdZuYbAsg=",
"ref": "main",
"rev": "3c9d0c5471affee1b426a0159b13201df41cad6c",
"revCount": 455,
"rev": "4d6a4a515b8b61f9614a1f9fa452d9f5c0fa2da5",
"revCount": 461,
"type": "git",
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
},

View file

@ -26,6 +26,8 @@ bspc config active_border_color "#181a23"
bspc config focused_border_color "#bd93f9"
bspc config presel_feedback_color "#bd93f9"
bspc config split_ratio 0.71
# Extra padding for polybar
bspc config -m primary top_padding 34
bspc config -m primary bottom_padding 0

View file

@ -35,7 +35,7 @@
origin = top-right
# Offset from the origin
offset = 8x28
offset = 18x36
# Scale factor. It is auto-detected if value is 0.
scale = 0

View file

@ -6,3 +6,6 @@ bold_italic_font auto
open_url_with default
mouse_map left click ungrabbed mouse_click_url_or_select
confirm_os_window_close 0
-- Allows zen-mode.nvim to increase font size
allow_remote_control socket-only
listen_on unix:/tmp/kitty

View file

@ -1,5 +1,35 @@
{ pkgs, ... }:
{ config, pkgs, lib, ... }:
with lib;
let
safeName = lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ];
imapnotifyAccounts =
filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts);
genAccountUnit = account:
let name = safeName account.name;
in
{
name = "imapnotify-${name}-mine";
value = {
Unit = { Description = "imapnotify for ${name}"; };
Service = {
ExecStart = "${pkgs.goimapnotify}/bin/goimapnotify -conf /nix/store/6030i9xdga98l2zyqarrqv5mrjynwm3i-imapnotify-anish-config.json"; # TODO horrible hard coded config location
Restart = "always";
RestartSec = 30;
Type = "simple";
# this is why we're overriding this stupid thing
# We need dbus for notify-send on systemd
Environment = [
"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"
];
};
Install = { WantedBy = [ "default.target" ]; };
};
};
in
{
#age.secrets.fastmail.file = "/etc/nixos/secrets/fastmail.age";
#age.secrets.fastmail.owner = "anish";
@ -13,6 +43,10 @@
frequency = "*:0/30";
#postExec = "${pkgs.notmuch}/bin/notmuch new";
};
# call our stupid way of overriding the imapnotify service
systemd.user.services = listToAttrs (map genAccountUnit [{ name = "anish"; }]);
services.imapnotify.enable = true;
programs.mbsync.enable = true;
programs.msmtp.enable = true;
@ -23,6 +57,7 @@
image/png; feh %s
image/jpeg; feh %s
'';
programs.neomutt = {
enable = true;
extraConfig = ''
@ -31,9 +66,9 @@
set editor = "nvim +':set textwidth=0'"
#set virtual_spoolfile=yes
set folder="~/Mail/anish"
set folder="~/Maildir/anish"
set mbox_type = Maildir
mailboxes `find ~/Mail/anish/* -maxdepth 0 -type d | grep -v "Trash\|Spam\|tmp\|new\|cur" | sed 's|/home/anish/Mail/anish|=\"|g' | sed 's|$|\"|g' | tr '\n' ' '`
mailboxes `find ~/Maildir/anish/* -maxdepth 0 -type d | grep -v "Trash\|Spam\|tmp\|new\|cur" | sed 's|/home/anish/Maildir/anish|=\"|g' | sed 's|$|\"|g' | tr '\n' ' '`
## Folder with emails
#set folder = "~/Mail/anish"
@ -269,14 +304,10 @@
extraConfig.local.subFolders = "Verbatim";
};
imapnotify = {
enable = true;
enable = false;
boxes = [ "Inbox" ];
onNotify = "${pkgs.isync}/bin/mbsync anish && ${pkgs.notmuch}/bin/notmuch index";
onNotifyPost = {
mail = "${pkgs.libnotify}/bin/notify-send -a mail 'email: new in %s'";
#update = "${pkgs.libnotify}/bin/notify-send -a mail 'email: update %s'";
#expunge = "${pkgs.libnotify}/bin/notify-send -a mail 'email: expunge %s'";
};
onNotifyPost = "${pkgs.libnotify}/bin/notify-send -a mail 'email: new in %s'";
};
msmtp.enable = true;
msmtp.extraConfig = {

View file

@ -0,0 +1 @@
{"boxes":["Inbox"],"host":"imap.fastmail.com","onNewMail":"/nix/store/pmvvqwrsyv6ah0x8c82hgkddas5f9ajb-isync-1.4.4/bin/mbsync anish && /nix/store/wyi8a02kk3vh5y7qhdkfzyibb1yl0xc1-notmuch-0.37/bin/notmuch index","onNewMailPost":{"mail":"/nix/store/q360zpybna4djr4kjhjg6hmkk3vj7pjf-libnotify-0.8.1/bin/notify-send -a mail 'email: new in %s'"},"passwordCmd":"'/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin/cat' '/run/agenix/fastmail'","port":993,"tls":true,"username":"anish@lakhwara.com"}

View file

@ -53,6 +53,7 @@
extraConfig = {
pull.rebase = false;
push.autoSetupRemote = true;
init.defaultBranch = "main";
};
@ -63,7 +64,6 @@
f = "fetch -p";
c = "commit -v";
p = "push";
# po = "push -u origin "; TODO push current branch to main
ba = "branch -a";
bd = "branch -d";
bD = "branch -D";

View file

@ -107,16 +107,6 @@ let
sha256 = "XdbgIWuAHNdTfyKDrKmQVq5oSbBoi56DpwtgOqhScAk=";
};
};
my-gitsigns = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "gitsigns";
version = "v0.5";
src = pkgs.fetchFromGitHub {
owner = "lewis6991";
repo = "gitsigns.nvim";
rev = "f98c85e7c3d65a51f45863a34feb4849c82f240f";
sha256 = "FgNSwvW7Bk+eKutMj0zqEorJ3+ijCALtOXs2OYiSX1I=";
};
};
my-fterm = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "fterm";
version = "2022-07-22";
@ -335,7 +325,7 @@ in
map <leader>zf :Telescope oldfiles only_cwd=true<CR>
map <leader>wt :VimwikiMakeTomorrowDiaryNote
map <leader>wd :VimwikiMakeYesterdayDiaryNote
map <leader>zd :Goyo<CR>:lua require('cmp').setup.buffer { enabled = false }<CR>
map <leader>zm :ZenMode<CR>:setlocal nospell<CR>
let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 1 }]
let g:sync_taskwarrior = 0
let g:zettel_format = "%y%m%d-%H%M"
@ -723,6 +713,52 @@ in
}
}
-- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets())
-- zen mode
require('zen-mode').setup{
window = {
backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
-- height and width can be:
-- * an absolute number of cells when > 1
-- * a percentage of the width / height of the editor when <= 1
-- * a function that returns the width or the height
width = 120, -- width of the Zen window
height = 1, -- height of the Zen window
-- by default, no options are changed for the Zen window
-- uncomment any of the options below, or add other vim.wo options you want to apply
options = {
signcolumn = "no", -- disable signcolumn
number = false, -- disable number column
relativenumber = false, -- disable relative numbers
cursorline = false, -- disable cursorline
cursorcolumn = false, -- disable cursor column
foldcolumn = "0", -- disable fold column
list = false, -- disable whitespace characters
},
},
plugins = {
-- disable some global vim options (vim.o...)
-- comment the lines to not apply the options
options = {
enabled = true,
ruler = false, -- disables the ruler text in the cmd line area
showcmd = false, -- disables the command in the last line of the screen
},
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
gitsigns = { enabled = false }, -- disables git signs
tmux = { enabled = false }, -- disables the tmux statusline
-- this will change the font size on kitty when in zen mode
-- to make this work, you need to set the following kitty options:
-- - allow_remote_control socket-only
-- - listen_on unix:/tmp/kitty
kitty = {
enabled = true,
font = "+2", -- font size increment
},
},
}
require('twilight').setup{}
EOF
'';
@ -752,7 +788,6 @@ in
fzf-vim
nerdtree
neovim-ayu
goyo-vim
rainbow_parentheses-vim
vim-surround
vim-devicons
@ -769,6 +804,8 @@ in
my-marks
which-key-nvim
nvim-peekup
zen-mode-nvim
twilight-nvim
# language
vim-nix
@ -805,7 +842,7 @@ in
# git stuff
vim-fugitive
my-gitsigns
gitsigns-nvim
fzf-checkout-vim
# Clojure stuff

View file

@ -43,6 +43,7 @@
"/var/backup/postgresql" # wallabag
"/var/lib/radicale" # radicale
"/home/anish/usr/drawing" # syncthing
"/data/books" # calibre-web
# "/home/anish/usr/nonfiction" # syncthing
"/home/anish/usr/finance" # beancount
"/mnt/two/postgres" # sealight postgres backups TODO remove once moved to capsul

View file

@ -0,0 +1,68 @@
#!/usr/bin/env bash
# notify a khal user via rofi about upcoming events
#
# dependencies: ·khal
# ·rofi >= 1.7.0 (-timeout-delay 60 -timeout-action "kb-cancel")
# ·column (eye candy only. can be removed without problems)
#
# usage: put it into a cronjob and let it run every 15 min or so
# -only events with reminders will trigger an alarm (shown in khal as: ⏰)
# -snoozed events will show up again on the next run
# -dismissed events will not trigger an alarm again
# -no alarm will be triggered if the script did never run
# for the duration of an event or in TIMESPAN beforehand
#
# rofi: -Shift+Return toggles item selection
# -if any item is selected, "cursor" position has no effect
# -timeout after 60 seconds; this snoozes all events
####################
# adjust cache file location to your liking
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/khal-events"
# events starting in the next TIMESPAN will trigger an alarm
timespan='60min'
####################
# this is needed for cronjobs and Xorg
export DISPLAY=":0"
snooze_string='💤 Snooze all.'
dismiss_string='✅ Dismiss all.'
# only show events with ⏰ symbol (=has alarm set)
# remove arrows for all-day events to only have one notification
# remove ⏰ symbol because it is obvious
events="$(khal list --format \
'{calendar}: {cancelled}{start-style}{to-style}{end-style} {title}{description-separator}{description}{location}{repeat-symbol}{alarm-symbol}' \
now "${timespan}" \
| sed -ne '/⏰/ p' \
| sed -e 's/⏰//g' -e 's/\(↦\|↔\|⇥\)[^[:blank:]]*/all-day/g' \
| column -tl 3)"
# get events that are new compared to cache file
new_events="$(diff -NwU 0 "${cache_file}" - << EOF | sed -ne '/^\+[^+]/ p' \
| sed -ne 's/^\+\([[:print:]].*\)$/\1/p'
${events}
EOF
)"
[ -z "${new_events}" ] && exit 0
action="$(dunstify --action="default,Dismiss" --action="snooze,Snooze" "${new_events}")"
# input="$(printf '%s\n%s\n%s' "${snooze_string}" \
# "${dismiss_string}" "${new_events}" \
# | rofi -timeout-delay 60 -timeout-action "kb-cancel" \
# -dmenu -i -u 2: -no-custom -multi-select -p \
# '⏰ Alarm! Select alarms to snooze. Rest will be dismissed.')"
case "${action}" in
"snooze")
;;
"default")
printf '%s' "${events}" > "${cache_file}"
;;
*)
printf '%s' "${events}" | grep -Fve "${input}" > "${cache_file}"
;;
esac

View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
systemd.services.cal-alarms = {
serviceConfig.Type = "simple";
path = [
pkgs.libnotify
pkgs.dunst
pkgs.khal
pkgs.unixtools.column
pkgs.diffutils
];
startAt = "*08:00:00";
script = builtins.readFile ./alarm.sh;
serviceConfig = {
User = "anish";
Environment = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus";
};
};
systemd.timers.cal-alarms = {
wantedBy = [ "timers.target" ];
partOf = [ "cal-alarms.service" ];
timerConfig.OnCalendar = [ "*:0/10" ];
};
}

View file

@ -16,7 +16,10 @@ let
in
{
# TODO modularize
imports = [ ./battery-low-timer.nix ];
imports = [
./battery-low-timer.nix
./cal-alarms.nix
];
# Secrets used by home-manager modules
age.secrets.fastmail.file = "${self}/secrets/fastmail.age";
@ -90,6 +93,7 @@ in
calendar-cli
wyrd
tex
tic-80
];

View file

@ -1,6 +1,15 @@
{ pkgs, config, lib, ... }:
let
wallabag-password = builtins.readFile "/run/agenix/wallabag_password";
wallabag-secret = builtins.readFile "/run/agenix/wallabag_secret";
in
{
age.secrets.wallabag-password.file = "/run/agenix/wallabag_password";
age.secrets.wallabag-password.owner = "wallabag";
age.secrets.wallabag-secret.file = "/run/agenix/wallabag_secret";
age.secrets.wallabag-secret.owner = "wallabag";
services.postgresql = {
enable = true;
package = pkgs.postgresql_11;
@ -28,7 +37,7 @@
database_name: wallabag
database_user: wallabag
# TODO agenix
database_password: wallabag
database_password: ${wallabag-password}
# For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite"
database_path: ~
database_table_prefix: wallabag_
@ -51,7 +60,7 @@
# A secret key that's used to generate certain security-related tokens
# TODO agenix
secret: SAFGOECRIlfal89oe6u0(*^dsaaih961
secret: ${wallabag-secret} SAFGOECRIlfal89oe6u0(*^dsaaih961
# two factor stuff
twofactor_auth: true

View file

@ -3,4 +3,6 @@
{ pkgs ? (import ../nixpkgs.nix) { } }: {
plymouth-themes = pkgs.callPackage ./plymouth.nix { };
tic-80 = pkgs.callPackage ./tic-80.nix { };
}

63
pkgs/tic-80.nix Normal file
View file

@ -0,0 +1,63 @@
# Stolen from: https://gist.github.com/jjwatt/c83c02e6903c8ffaf546fe5eb27e7d25?permalink_comment_id=3305141#gistcomment-3305141
{ pkgs, ... }:
pkgs.stdenv.mkDerivation rec {
name = "tic-80";
src = pkgs.fetchgit {
fetchSubmodules = true; # not supported by builtins.fetchGit :(
url = "https://github.com/nesbox/TIC-80";
rev = "0feb848378fc40d16aaa609ed7a2148d7a064ac4"; # v0.8 didn't look at what changed in the newer versions
sha256 = "12fl9wfc1577rmzcll50r3hq582010bpwd3yi15ji2vadc2q1w9l";
};
buildInputs = with pkgs; [
gcc
pkgconfig
autoconf
automake
libtool
pcre
gnumake
SDL2
SDL2_gfx
SDL_image
SDL2_ttf
SDL2_mixer
harfbuzz
curl
gtk3
gtk3-x11
cmake
cmakeCurses
elementary-cmake-modules
extra-cmake-modules
libglvnd
mesa_glu
mesa_glu
freeglut
alsaLib
];
configurePhase = ''
echo [DIRECTORY] $(pwd)
sed -i 's/BUILD_PRO "Build PRO version" FALSE/BUILD_PRO "Build PRO version" TRUE/' CMakeLists.txt
cd build/
cmake ..
'';
buildPhase = ''
make -j4
'';
installPhase = ''
mkdir -p $out/bin
chmod a+x bin/tic80
cp -v bin/tic80 $out/bin
'';
tic80Item = pkgs.makeDesktopItem {
name = "TIC-80";
exec = "tic80";
comment = "Tiny Computer";
categories = [ "Development" "Game" ];
desktopName = "TIC-80";
};
}

View file

@ -14,6 +14,9 @@ in
"mossnet.age".publicKeys = allUserKeys;
"curve-wg.age".publicKeys = curve;
"box-wg.age".publicKeys = [ mossnet ];
"wallabag-password.age".publicKeys = [ mossnet ];
"wallabag-secret.age".publicKeys = [ mossnet ];
"borg-password.age".publicKeys = systemOnly;
"freshrss-dbpass.age".publicKeys = [ helix ];
"synapse-config.age".publicKeys = [ lituus ];

View file

@ -0,0 +1,7 @@
age-encryption.org/v1
-> ssh-ed25519 K2vF/Q 71YyNzHijmSYXrZM9XCpTuz+5pp5xelrfrsDALqEqWg
hukblsPnp+yj9O5y3YU4NT2PLxp0WGtsEuOZlxx06OI
-> J#cy5AG-grease 9'>
YNU2IHnG1ELEEKThpSVN357BDExcNcV5npG7P/J0/jBJYofo47p3
--- L807Hrt3wcqdJI7s9VOWIvJ4MsFcoylXUBMiMwIrJb8
j½âj`Ëþ‰P;Ê-$ž<>ìörpÎLàA÷j£Elï{ðH{

View file

@ -0,0 +1,8 @@
age-encryption.org/v1
-> ssh-ed25519 K2vF/Q rJ+Bv933siTbr1bFbjS8yZFAJNJVFHGSaTRKL5voKEY
XLVaUEDtOSHciozDfqVc6tpYi1tGpu9p+lR6lv5R1Pc
-> <$ra')-grease
d6H6lDsqhGnmRjyAJzzpcb1z4azaZ0CSzS24o1OMDt+wo+PIp5bQ/xgsD2HEOveB
n2A/GSyDv3Bv
--- jWBWzIifCy4DUMo18Oi/HflStwhxABHgrx1LsAdryFE
^KQZÔû9ªÿB‰OàщpÜù#…JL‡ÅZ¡Ý %?QטiüófÒbŽ‡Þ˸_²4Íz'„ÕP