Refactore home and use modes
This commit is contained in:
parent
92b6b3ad58
commit
48d86591b4
BIN
common/secret/jaliconfig.py
Normal file
BIN
common/secret/jaliconfig.py
Normal file
Binary file not shown.
5
home/accounting.nix
Normal file
5
home/accounting.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }: {
|
||||
home.file.".config/jali/config.py".text =
|
||||
builtins.readFile ../common/secret/jaliconfig.py;
|
||||
home.packages = builtins.attrValues (import ../pkgs).accounting-pkgs;
|
||||
}
|
8
home/chat.nix
Normal file
8
home/chat.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ pkgs, ... }:
|
||||
let inherit (import ../lib) unstable;
|
||||
in {
|
||||
home.packages = builtins.attrValues {
|
||||
inherit (pkgs) signal-desktop tdesktop dino mumble;
|
||||
inherit (unstable) riot-desktop;
|
||||
};
|
||||
}
|
|
@ -9,16 +9,10 @@ in {
|
|||
./zsh
|
||||
./update-script.nix
|
||||
./taskwarrior.nix
|
||||
./modules/force-copies.nix
|
||||
./modules/accounting
|
||||
./modules/rustdev.nix
|
||||
./modules/latex.nix
|
||||
./modules/mail.nix
|
||||
./modules/home-options.nix
|
||||
./modules/unlock.nix
|
||||
./modules/bugwarrior.nix
|
||||
./modules/pythia.nix
|
||||
../common
|
||||
./unlock.nix
|
||||
./mpclient.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
|
|
|
@ -3,8 +3,14 @@ let
|
|||
inherit (import ../../pkgs) desktop-pkgs;
|
||||
inherit (import ../../lib) colors;
|
||||
in {
|
||||
imports =
|
||||
[ ./sway.nix ./wallpaper.nix ./rofi.nix ./ssh-agent.nix ./sleep-nag.nix ./kitty.nix ];
|
||||
imports = [
|
||||
./sway.nix
|
||||
./wallpaper.nix
|
||||
./rofi.nix
|
||||
./ssh-agent.nix
|
||||
./sleep-nag.nix
|
||||
./kitty.nix
|
||||
];
|
||||
m-0 = {
|
||||
workspaces = [
|
||||
"tasks"
|
||||
|
@ -22,7 +28,6 @@ in {
|
|||
colors = colors;
|
||||
};
|
||||
home = { packages = builtins.attrValues desktop-pkgs; };
|
||||
programs.browserpass.enable = true;
|
||||
gtk = {
|
||||
enable = true;
|
||||
iconTheme = {
|
||||
|
@ -35,22 +40,9 @@ in {
|
|||
};
|
||||
};
|
||||
services = {
|
||||
mpd = {
|
||||
udiskie = {
|
||||
enable = true;
|
||||
network.listenAddress = "::1";
|
||||
musicDirectory = "${config.home.homeDirectory}/media/audio";
|
||||
extraConfig = ''
|
||||
audio_output {
|
||||
type "pulse"
|
||||
name "Pulseaudio"
|
||||
server "localhost"
|
||||
}
|
||||
'';
|
||||
notify = true;
|
||||
};
|
||||
mpdris2.enable = true;
|
||||
};
|
||||
systemd.user.services.mpdris2 = {
|
||||
Unit.Requires = [ "dbus.service" ];
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ set $mod Mod4
|
|||
set $lock swaylock -e -F -l -s fill -f -i ~/volatile/wallpaper.jpg
|
||||
|
||||
output * bg ~/volatile/wallpaper.jpg fill
|
||||
output 'Ancor Communications Inc ASUS VW248 B6LMTF011850' transform 90 anticlockwise
|
||||
|
||||
#input type:tablet {
|
||||
# map_to_region "2560x1440@3360,0"
|
||||
|
|
|
@ -87,10 +87,10 @@ in {
|
|||
"prior" = "focus parent";
|
||||
"next" = "focus child";
|
||||
"shift+r" = "exec ${pkgs.sway}/bin/swaymsg reload";
|
||||
"shift+q" =
|
||||
"exec ${pkgs.sway}/bin/swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
||||
"shift+q" = "exec ${pkgs.sway}/bin/swaymsg exit";
|
||||
"Return" = "exec ${terminal}";
|
||||
"q" = "kill";
|
||||
"m" = "output $high transform 270";
|
||||
"space" = "exec hotkeys";
|
||||
};
|
||||
workspaceBindings = pkgs.lib.fold (a: b: a // b) { } (builtins.map (num:
|
||||
|
@ -201,6 +201,7 @@ in {
|
|||
}
|
||||
}
|
||||
|
||||
exec random-wallpaper
|
||||
exec ${pkgs.mako}/bin/mako --background-color "${colors.background}cc" --text-color "${colors.foreground}" --border-size 0
|
||||
exec ${my-pkgs.my-ssh-add}/bin/my-ssh-add
|
||||
exec ${pkgs.xorg.xrdb}/bin/xrdb ${
|
||||
|
@ -209,5 +210,5 @@ in {
|
|||
exec ${pkgs.systemd}/bin/systemctl --user set-environment SWAYSOCK="$SWAYSOCK"
|
||||
exec ${pkgs.swayidle}/bin/swayidle -w before-sleep '$lock'
|
||||
'';
|
||||
in bindingsConfig + modlessBindingsConfig + colorConfig + barsConfig);
|
||||
in barsConfig + bindingsConfig + modlessBindingsConfig + colorConfig);
|
||||
}
|
||||
|
|
|
@ -7,13 +7,14 @@ let
|
|||
bins = [ pkgs.coreutils pkgs.sway ];
|
||||
} ''
|
||||
main = do
|
||||
(lines . decodeUtf8 -> files) <- ls "/home/maralorn/.wallpapers" |> captureTrim
|
||||
mode <- cat "/home/maralorn/tmp/mode" |> captureTrim
|
||||
(lines . decodeUtf8 -> files) <- ls ([i|/home/maralorn/.wallpapers/#{mode}|] :: String) |> captureTrim
|
||||
((files Unsafe.!!) -> file) <- getStdRandom $ randomR (0, length files - 1)
|
||||
cp ([i|/home/maralorn/.wallpapers/#{file}|] :: String) "/home/maralorn/volatile/wallpaper.jpg"
|
||||
cp ([i|/home/maralorn/.wallpapers/#{mode}/#{file}|] :: String) "/home/maralorn/volatile/wallpaper.jpg"
|
||||
swaymsg "output * bg /home/maralorn/volatile/wallpaper.jpg fill"
|
||||
'';
|
||||
in {
|
||||
|
||||
home.packages = [ randomWallpaper ];
|
||||
systemd.user = {
|
||||
services.random-wallpaper = {
|
||||
Unit = { Description = "Random Wallpaper"; };
|
||||
|
|
4
home/firefox.nix
Normal file
4
home/firefox.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ ... }: {
|
||||
programs.firefox.enable = true;
|
||||
programs.browserpass.enable = true;
|
||||
}
|
63
home/games.nix
Normal file
63
home/games.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ pkgs, ... }:
|
||||
let inherit (import ../lib) unfreePkgs writeHaskellScript;
|
||||
in {
|
||||
home.packages = builtins.attrValues {
|
||||
inherit (unfreePkgs) discord steam;
|
||||
inherit (pkgs) minetest;
|
||||
|
||||
gw2 = pkgs.buildFHSUserEnv {
|
||||
name = "gw2";
|
||||
targetPkgs = pkgs: (with pkgs; [ sambaFull ]);
|
||||
multiPkgs = pkgs:
|
||||
(with pkgs;
|
||||
with xorg; [
|
||||
file
|
||||
freetype
|
||||
libpng
|
||||
mesa_drivers
|
||||
zlib
|
||||
libXi
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXrender
|
||||
libXxf86vm
|
||||
libXcomposite
|
||||
libXext
|
||||
libX11
|
||||
libudev
|
||||
libGLU
|
||||
mesa_noglu.osmesa
|
||||
libdrm
|
||||
libpulseaudio
|
||||
alsaLib
|
||||
openal
|
||||
mpg123
|
||||
libtxc_dxtn
|
||||
gnutls
|
||||
krb5Full
|
||||
ncurses5
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
vulkan-tools
|
||||
]);
|
||||
runScript = let
|
||||
gw2wrapper = writeHaskellScript {
|
||||
name = "gw2wrapper";
|
||||
bins = [ pkgs.procps ];
|
||||
imports = [ "System.Directory (withCurrentDirectory)" ];
|
||||
|
||||
} ''
|
||||
waitForExit = do
|
||||
sleep "5s"
|
||||
processes <- ps "aux" |> captureTrim
|
||||
when
|
||||
(BS.isInfixOf (encodeUtf8 "GW2.exe") (toStrict processes))
|
||||
waitForExit
|
||||
main = do
|
||||
withCurrentDirectory "/home/maralorn/GW2" $ exe "./play.sh"
|
||||
waitForExit
|
||||
'';
|
||||
in "${gw2wrapper}/bin/gw2wrapper";
|
||||
};
|
||||
};
|
||||
}
|
6
home/git-sign.nix
Normal file
6
home/git-sign.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ ... }: {
|
||||
programs.git.signing = {
|
||||
signByDefault = true;
|
||||
key = "6C3D12CD88CDF46C5EAF4D12226A2D41EF5378C9";
|
||||
};
|
||||
}
|
32
home/laptop.nix
Normal file
32
home/laptop.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ pkgs, ... }:
|
||||
let inherit (import ../lib) unfreePkgs;
|
||||
in {
|
||||
home.packages = builtins.attrValues {
|
||||
maintenance = pkgs.writeShellScriptBin "maintenance" ''
|
||||
git -C ~/git/config pull
|
||||
update-home-mode
|
||||
sudo -A update-system
|
||||
sudo -A nix optimise-store
|
||||
'';
|
||||
updateHome = pkgs.writeShellScriptBin "update-home-mode" ''
|
||||
update-home -A apollo-`cat ~/tmp/mode`
|
||||
'';
|
||||
inherit (unfreePkgs) zoom-us skypeforlinux google-chrome;
|
||||
inherit (pkgs.gnome3) nautilus;
|
||||
inherit (pkgs.xorg) xbacklight;
|
||||
inherit (pkgs)
|
||||
# web
|
||||
chromium
|
||||
|
||||
upower speedtest-cli acpi
|
||||
|
||||
anki
|
||||
|
||||
# tools & office
|
||||
feh gimp imagemagick libreoffice-fresh xournal musescore handbrake evince
|
||||
abcde beets
|
||||
|
||||
# media
|
||||
ncpamixer pavucontrol deluge gmpc calibre mpv youtubeDL;
|
||||
};
|
||||
}
|
11
home/latex.nix
Normal file
11
home/latex.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }: {
|
||||
programs.texlive = {
|
||||
enable = true;
|
||||
extraPackages = tpkgs: {
|
||||
inherit (tpkgs)
|
||||
scheme-medium pdfjam latexmk collection-latexextra
|
||||
collection-bibtexextra collection-luatex collection-mathscience
|
||||
collection-fontsextra dvipng;
|
||||
};
|
||||
};
|
||||
}
|
287
home/mail.nix
Normal file
287
home/mail.nix
Normal file
|
@ -0,0 +1,287 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
let
|
||||
inherit (import ../lib) writeHaskellScript;
|
||||
inherit (config.m-0.private) sendmail me;
|
||||
inherit (config.m-0.private.mail_filters) sortLists stupidLists notifications;
|
||||
maildir = config.accounts.email.maildirBasePath;
|
||||
# mhdr -h List-ID -d Maildir/hera/Archiv/unsortiert | sort | sed 's/^.*<\(.*\)>$/\1/' | uniq | xargs -I '{}' sh -c "notmuch count List:{} | sed 's/$/: {}/'" | sort
|
||||
# To find candidates
|
||||
archiveSuffix = "hera/Archiv";
|
||||
unsortedSuffix = "${archiveSuffix}/unsortiert";
|
||||
unsorted = "${maildir}/${unsortedSuffix}";
|
||||
archive = "${maildir}/${archiveSuffix}";
|
||||
filter = rec {
|
||||
mailToFolder = name:
|
||||
toFolder (lib.concatStringsSep "." (lib.splitString "@" name));
|
||||
toFolder = name:
|
||||
lib.concatStringsSep "/" (lib.reverseList (lib.splitString "." name));
|
||||
simple = filter: target: { inherit filter target; };
|
||||
notifications = notify:
|
||||
simple "from:${notify}" "notifications/${mailToFolder notify}";
|
||||
stupidList = list: simple "to:${list}" "list/${mailToFolder list}";
|
||||
simpleSortList = listName:
|
||||
simple "List:${listName}" "list/${toFolder listName}";
|
||||
};
|
||||
myFilters = builtins.map filter.simpleSortList sortLists
|
||||
++ builtins.map filter.stupidList stupidLists
|
||||
++ builtins.map filter.notifications notifications;
|
||||
sortMail = writeHaskellScript {
|
||||
name = "sort-mail-archive";
|
||||
bins = [ pkgs.notmuch pkgs.coreutils pkgs.mblaze pkgs.findutils ];
|
||||
libraries = [ pkgs.haskellPackages.megaparsec ];
|
||||
imports = [
|
||||
"Text.Megaparsec"
|
||||
"Text.Megaparsec.Char"
|
||||
"Text.Megaparsec.Char.Lexer"
|
||||
"qualified Data.List.NonEmpty as NE"
|
||||
"qualified Data.Text as T"
|
||||
"System.Environment (setEnv)"
|
||||
];
|
||||
} ''
|
||||
reScan = notmuch "new" "--quiet"
|
||||
|
||||
findFilterMail :: (Text,Text) -> IO (Maybe (LByteString, Text, Text))
|
||||
findFilterMail (filter, target) = do
|
||||
files <- notmuch "search" "--output" "files" (toString filter) "folder:${unsortedSuffix}" |> capture
|
||||
pure $ if (LBS.length files > 0) then Just (files, filter, target) else Nothing
|
||||
|
||||
executeFilterMail :: (LByteString, Text, Text) -> IO ()
|
||||
executeFilterMail (files, filter, target) = do
|
||||
putTextLn [i|Sorting "#{filter}" into #{target}|]
|
||||
writeOutput files |> mscan
|
||||
mmkdir ([i|${archive}/#{target}|] :: String)
|
||||
writeOutput files |> mrefile ([i|${archive}/#{target}|] :: String)
|
||||
|
||||
myFilters :: [(Text,Text)]
|
||||
myFilters = [${
|
||||
lib.concatStringsSep ","
|
||||
(builtins.map ({ filter, target }: ''("${filter}","${target}")'')
|
||||
myFilters)
|
||||
}]
|
||||
|
||||
filtersFromTo :: Text -> Maybe (Text,Text)
|
||||
filtersFromTo = filtersFromField "to" [toToName]
|
||||
toToName :: Text -> Maybe Text
|
||||
toToName (T.splitOn "@" -> [name, "maralorn.de"])
|
||||
| not (T.isInfixOf "randy" name) = Just . ("to/" <>) . T.intercalate "_" . T.splitOn "." $ name
|
||||
toToName _ = Nothing
|
||||
filtersFromField :: Text -> [Text-> Maybe Text] -> Text -> Maybe (Text,Text)
|
||||
filtersFromField field filters text = fmap ([i|#{field}:#{text}|],) . viaNonEmpty Relude.head . mapMaybe ($ text) $ filters
|
||||
filtersFromListIDs :: Text -> Maybe (Text,Text)
|
||||
filtersFromListIDs = filtersFromField "List" [githubNameFolderFromId, gitlabNameFolderFromId]
|
||||
githubNameFolderFromId :: Text -> Maybe Text
|
||||
githubNameFolderFromId (reverse . T.splitOn "." -> ("com":"github":org:name)) = Just [i|github/#{org}/#{T.intercalate "_" $ reverse name}|]
|
||||
githubNameFolderFromId _ = Nothing
|
||||
gitlabNameFolderFromId :: Text -> Maybe Text
|
||||
gitlabNameFolderFromId (reverse . T.splitOn "." -> ("de":"ccc":"darmstadt":"git":org:name1:name)) = Just [i|cda-gitlab/#{org}/#{T.intercalate "_" . toList . Relude.tail $ NE.reverse (name1:|name)}|]
|
||||
gitlabNameFolderFromId _ = Nothing
|
||||
|
||||
type Parser = Parsec Text Text
|
||||
listId :: Parser Text
|
||||
listId = manyTill anySingle (char '<') *> (toText <$> manyTill anySingle (char '>'))
|
||||
|
||||
mySearch :: [String] -> IO [Text]
|
||||
mySearch param = lines . decodeUtf8 <$> (Main.find ("${archive}":param) |> captureTrim)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
setEnv "MBLAZE_PAGER" "cat"
|
||||
setEnv "NOTMUCH_CONFIG" "${config.home.sessionVariables.NOTMUCH_CONFIG}"
|
||||
reScan
|
||||
(listIDs,tos) <- concurrently (mhdr "-h" "List-ID" "-d" "${unsorted}" |> capture) (mhdr "-h" "To" "-d" "${unsorted}" "-A" |> capture)
|
||||
let listFilters = mapMaybe filtersFromListIDs . sortNub . mapMaybe (parseMaybe listId) . lines . decodeUtf8 $ listIDs
|
||||
toFilters = mapMaybe filtersFromTo . sortNub . fmap (\x -> maybe x Relude.id $ parseMaybe listId x) . lines . decodeUtf8 $ tos
|
||||
applicableFilters <- catMaybes <$> forConcurrently (listFilters <> myFilters <> toFilters) findFilterMail
|
||||
for_ applicableFilters executeFilterMail
|
||||
reScan
|
||||
--syncStates <- mySearch ["-name", ".mbsyncstate"]
|
||||
--dbFiles <- mySearch ["-name", ".isyncuidmap.db"]
|
||||
--dirs <- mySearch ["-type", "d"]
|
||||
--maildirs <- sortNub <$> (lines . decodeUtf8 =<<) <$> forM dirs (\dir -> mdirs (toString dir) |> captureTrim)
|
||||
--emptyMaildirs <- filterM (\dir -> (== 0) . LBS.length <$> (mlist (toString dir) |> captureTrim)) maildirs
|
||||
--forM_ emptyMaildirs $ \dir -> rmdir ([[i|#{dir}/cur|],[i|#{dir}/new|],[i|#{dir}/tmp|]] :: [String])
|
||||
-- let nonMaildirs = filter (`notElem` maildirs) dirs
|
||||
-- delSyncs = filter (`elem` syncStates) $ (\x -> [i|#{x}/.mbsyncstate|]) <$> nonMaildirs
|
||||
-- delDbs = filter (`elem` dbFiles) $ (\x -> [i|#{x}/.isyncuidmap.db|]) <$> nonMaildirs
|
||||
-- whenNotNull (delSyncs ++ delDbs) $ rm . fmap toString . toList
|
||||
-- emptyDirs <- Main.find "${archive}" "-type" "d" "-empty" "!" "-name" "cur" "!" "-name" "tmp" "!" "-name" "new" "-print0" |> capture
|
||||
-- when (LBS.length emptyDirs > 0) $ writeOutput emptyDirs |> xargs "-0" "rmdir"
|
||||
'';
|
||||
in {
|
||||
|
||||
services.mbsync = {
|
||||
enable = true;
|
||||
frequency = "*:0/30";
|
||||
verbose = false;
|
||||
postExec = "${sortMail}/bin/sort-mail-archive";
|
||||
};
|
||||
|
||||
accounts.email.accounts = config.m-0.private.mail_accounts;
|
||||
systemd.user.services = let
|
||||
mkService = name: account:
|
||||
let
|
||||
configjs = pkgs.writeText "config.js" ''
|
||||
var child_process = require('child_process');
|
||||
|
||||
function getStdout(cmd) {
|
||||
var stdout = child_process.execSync(cmd);
|
||||
return stdout.toString().trim();
|
||||
}
|
||||
|
||||
exports.host = "${account.imap.host}"
|
||||
exports.port = 993
|
||||
exports.tls = true;
|
||||
exports.tlsOptions = { "rejectUnauthorized": false };
|
||||
exports.username = "${account.userName}";
|
||||
exports.password = getStdout("${toString account.passwordCommand}");
|
||||
exports.onNotify = "${pkgs.isync}/bin/mbsync ${name}"
|
||||
exports.onNotifyPost = "${pkgs.notmuch}/bin/notmuch new"
|
||||
exports.boxes = [ "Inbox" ];
|
||||
'';
|
||||
in {
|
||||
Unit = { Description = "Run imapnotify for imap account ${name}"; };
|
||||
Service = {
|
||||
ExecStart = "${pkgs.imapnotify}/bin/imapnotify -c ${configjs}";
|
||||
Restart = "always";
|
||||
RestartSec = "1min";
|
||||
};
|
||||
Install = { WantedBy = [ "default.target" ]; };
|
||||
};
|
||||
mkServiceWithName = name: account: {
|
||||
name = "imapnotify-${name}-inbox";
|
||||
value = mkService name account;
|
||||
};
|
||||
hasImapHost = name: account: account.imap != null;
|
||||
in lib.mapAttrs' mkServiceWithName
|
||||
(lib.filterAttrs hasImapHost config.accounts.email.accounts) // {
|
||||
mbsync.Service.Environment = "PATH=${pkgs.coreutils}/bin";
|
||||
};
|
||||
|
||||
programs.msmtp.enable = true;
|
||||
programs.mbsync.enable = true;
|
||||
programs.notmuch = {
|
||||
enable = true;
|
||||
hooks.postInsert = ''
|
||||
${pkgs.notmuch}/bin/notmuch tag +deleted -- "folder:/Trash/ (not tag:deleted)"
|
||||
${pkgs.notmuch}/bin/notmuch tag -deleted -- "(not folder:/Trash/) tag:deleted"
|
||||
${pkgs.notmuch}/bin/notmuch tag +spam -- "folder:/Junk|Spam|SPAM/ (not tag:spam)"
|
||||
${pkgs.notmuch}/bin/notmuch tag -spam -- "(not folder:/Junk|Spam|SPAM/) tag:spam"
|
||||
'';
|
||||
new = {
|
||||
tags = [ ];
|
||||
ignore = [ ".isyncuidmap.db" ];
|
||||
};
|
||||
maildir.synchronizeFlags = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
packages = [ pkgs.neomutt sortMail ];
|
||||
file = let
|
||||
mutt_alternates = "@maralorn.de "
|
||||
+ (builtins.concatStringsSep " " me.alternates);
|
||||
show-sidebar = pkgs.writeText "show-sidebar" ''
|
||||
set sidebar_visible=yes
|
||||
bind index <up> sidebar-prev
|
||||
bind index <down> sidebar-next
|
||||
bind index <pageup> sidebar-page-up
|
||||
bind index <pagedown> sidebar-page-down
|
||||
bind index <space> sidebar-open
|
||||
bind index <return> sidebar-open
|
||||
bind index <enter> sidebar-open
|
||||
'';
|
||||
hide-sidebar = pkgs.writeText "hide-sidebar" ''
|
||||
set sidebar_visible=no
|
||||
bind index <up> previous-undeleted
|
||||
bind index <down> next-undeleted
|
||||
bind index <pageup> previous-page
|
||||
bind index <pagedown> next-page
|
||||
bind index <space> display-message
|
||||
bind index <return> display-message
|
||||
bind index <enter> display-message
|
||||
'';
|
||||
mailcap = pkgs.writeText "mailcap" ''
|
||||
text/html; ${pkgs.lynx}/bin/lynx -stdin -dump -force_html ; copiousoutput
|
||||
application/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
image/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
video/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
audio/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
'';
|
||||
in {
|
||||
".neomuttrc".text = ''
|
||||
alternative_order text/plain text/html
|
||||
auto_view text/*
|
||||
auto_view message/*
|
||||
unset wait_key
|
||||
color normal default default
|
||||
|
||||
set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"
|
||||
set query_command = "${pkgs.notmuch}/bin/notmuch address --output=recipients --deduplicate=address '%s' | grep -i '%s'"
|
||||
bind editor <Tab> complete-query
|
||||
bind editor ^T complete
|
||||
|
||||
set crypt_use_gpgme = yes
|
||||
set pgp_use_gpg_agent = yes
|
||||
set pgp_auto_decode = yes
|
||||
set pgp_autosign = yes
|
||||
set pgp_replysign = yes
|
||||
set pgp_replyencrypt = yes
|
||||
set crypt_replysignencrypted = yes
|
||||
set crypt_verify_sig = yes
|
||||
set pgp_sign_as="${me.gpg}"
|
||||
set pgp_use_gpg_agent = yes
|
||||
set pgp_default_key="${me.gpg}"
|
||||
set timeout = 5
|
||||
|
||||
set abort_noattach = ask-yes
|
||||
set abort_noattach_regex = "(hängt an|anhäng|anhang|anbei|angehängt|attach|attached|attachments?)"
|
||||
set abort_unmodified = ask-yes
|
||||
|
||||
alternates ${mutt_alternates}
|
||||
set folder="${maildir}"
|
||||
mailboxes `find ${maildir} -type d -name Inbox -printf '"%h" '` `find ${maildir} -type d -name cur -printf '"%h" '`
|
||||
set sendmail="${pkgs.msmtp}/bin/msmtp --read-envelope-from"
|
||||
set sort=threads
|
||||
set sort_aux=date-sent
|
||||
set realname="${me.name}"
|
||||
set from=fill-later
|
||||
set use_from=yes
|
||||
set fast_reply=yes
|
||||
set mailcap_path=${mailcap};
|
||||
set include=yes
|
||||
set edit_headers=yes
|
||||
set mbox_type=Maildir
|
||||
set spoolfile="${maildir}/hera/Archiv"
|
||||
set record="${maildir}/hera/Archiv/unsortiert"
|
||||
set postponed="${maildir}/hera/Drafts"
|
||||
set mail_check_stats=yes
|
||||
bind index / vfolder-from-query
|
||||
set header_cache = "~/.cache/neomutt"
|
||||
set date_format="!%y-%m-%d %H:%M"
|
||||
set mime_forward=yes
|
||||
set mime_forward_rest=yes
|
||||
|
||||
macro index <F5> "!systemctl --user start mbsync > /dev/null<enter>"
|
||||
|
||||
source "${hide-sidebar}"
|
||||
macro index <right> "<enter-command>source ${hide-sidebar}<enter>"
|
||||
macro index <left> "<enter-command>source ${show-sidebar}<enter>"
|
||||
set sidebar_folder_indent=no
|
||||
set sidebar_short_path=no
|
||||
set sidebar_component_depth=2
|
||||
set sidebar_width=60
|
||||
set sidebar_sort_method="alpha"
|
||||
set sidebar_indent_string=" "
|
||||
color sidebar_indicator black white
|
||||
color sidebar_highlight white blue
|
||||
set sidebar_format = "%B%* %?N?%N/?%S"
|
||||
|
||||
alias f__0 ${me.name} <${me.mail}>
|
||||
${builtins.concatStringsSep "\n"
|
||||
(lib.imap1 (n: x: "alias f__${toString n} ${me.name} <${x}>")
|
||||
me.alternates)}
|
||||
send2-hook '~f fill-later' "push <edit-from><kill-line>f__<complete><search>${me.mail}<enter>"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib; {
|
||||
|
||||
options.m-0.accounting.enable = mkEnableOption "Accounting";
|
||||
options.m-0.accounting.config = mkOption { type = types.str; };
|
||||
|
||||
config = mkIf config.m-0.accounting.enable {
|
||||
home.file.".config/jali/config.py".text = config.m-0.accounting.config;
|
||||
home.packages = builtins.attrValues (import ../../../pkgs).accounting-pkgs;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib; {
|
||||
|
||||
options.m-0.latex.enable = mkEnableOption "Latex";
|
||||
|
||||
config = mkIf config.m-0.latex.enable {
|
||||
programs = {
|
||||
texlive = {
|
||||
enable = true;
|
||||
extraPackages = tpkgs: {
|
||||
inherit (tpkgs)
|
||||
scheme-medium pdfjam latexmk collection-latexextra
|
||||
collection-bibtexextra collection-luatex collection-mathscience
|
||||
collection-fontsextra dvipng;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (import ../../lib) writeHaskellScript;
|
||||
mail = config.m-0.mail;
|
||||
inherit (import ../lib) writeHaskellScript;
|
||||
inherit (config.m-0.private) sendmail me;
|
||||
inherit (config.m-0.private.mail_filters) sortLists stupidLists notifications;
|
||||
maildir = config.accounts.email.maildirBasePath;
|
||||
|
@ -14,7 +12,7 @@ let
|
|||
archive = "${maildir}/${archiveSuffix}";
|
||||
filter = rec {
|
||||
mailToFolder = name:
|
||||
toFolder (lib.concatStringsSep "." (splitString "@" name));
|
||||
lib.toFolder (lib.concatStringsSep "." (lib.splitString "@" name));
|
||||
toFolder = name:
|
||||
lib.concatStringsSep "/" (lib.reverseList (lib.splitString "." name));
|
||||
simple = filter: target: { inherit filter target; };
|
||||
|
@ -111,185 +109,178 @@ let
|
|||
'';
|
||||
in {
|
||||
|
||||
options.m-0.mail.enable = mkEnableOption "private-mail";
|
||||
options.m-0.mail.accounts = mkOption { type = types.attrs; };
|
||||
services.mbsync = {
|
||||
enable = true;
|
||||
frequency = "*:0/30";
|
||||
verbose = false;
|
||||
postExec = "${sortMail}/bin/sort-mail-archive";
|
||||
};
|
||||
|
||||
config = mkIf mail.enable {
|
||||
accounts.email.accounts = config.m-0.private.mail_accounts;
|
||||
systemd.user.services = let
|
||||
mkService = name: account:
|
||||
let
|
||||
configjs = pkgs.writeText "config.js" ''
|
||||
var child_process = require('child_process');
|
||||
|
||||
services.mbsync = {
|
||||
enable = true;
|
||||
frequency = "*:0/30";
|
||||
verbose = false;
|
||||
postExec = "${sortMail}/bin/sort-mail-archive";
|
||||
};
|
||||
function getStdout(cmd) {
|
||||
var stdout = child_process.execSync(cmd);
|
||||
return stdout.toString().trim();
|
||||
}
|
||||
|
||||
accounts.email.accounts = config.m-0.mail.accounts;
|
||||
|
||||
systemd.user.services = let
|
||||
mkService = name: account:
|
||||
let
|
||||
configjs = pkgs.writeText "config.js" ''
|
||||
var child_process = require('child_process');
|
||||
|
||||
function getStdout(cmd) {
|
||||
var stdout = child_process.execSync(cmd);
|
||||
return stdout.toString().trim();
|
||||
}
|
||||
|
||||
exports.host = "${account.imap.host}"
|
||||
exports.port = 993
|
||||
exports.tls = true;
|
||||
exports.tlsOptions = { "rejectUnauthorized": false };
|
||||
exports.username = "${account.userName}";
|
||||
exports.password = getStdout("${toString account.passwordCommand}");
|
||||
exports.onNotify = "${pkgs.isync}/bin/mbsync ${name}"
|
||||
exports.onNotifyPost = "${pkgs.notmuch}/bin/notmuch new"
|
||||
exports.boxes = [ "Inbox" ];
|
||||
'';
|
||||
in {
|
||||
Unit = { Description = "Run imapnotify for imap account ${name}"; };
|
||||
Service = {
|
||||
ExecStart = "${pkgs.imapnotify}/bin/imapnotify -c ${configjs}";
|
||||
Restart = "always";
|
||||
RestartSec = "1min";
|
||||
};
|
||||
Install = { WantedBy = [ "default.target" ]; };
|
||||
};
|
||||
mkServiceWithName = name: account: {
|
||||
name = "imapnotify-${name}-inbox";
|
||||
value = mkService name account;
|
||||
};
|
||||
hasImapHost = name: account: account.imap != null;
|
||||
in mapAttrs' mkServiceWithName
|
||||
(filterAttrs hasImapHost config.accounts.email.accounts) // {
|
||||
mbsync.Service.Environment = "PATH=${pkgs.coreutils}/bin";
|
||||
};
|
||||
|
||||
programs.msmtp.enable = true;
|
||||
programs.mbsync.enable = true;
|
||||
programs.notmuch = {
|
||||
enable = true;
|
||||
hooks.postInsert = ''
|
||||
${pkgs.notmuch}/bin/notmuch tag +deleted -- "folder:/Trash/ (not tag:deleted)"
|
||||
${pkgs.notmuch}/bin/notmuch tag -deleted -- "(not folder:/Trash/) tag:deleted"
|
||||
${pkgs.notmuch}/bin/notmuch tag +spam -- "folder:/Junk|Spam|SPAM/ (not tag:spam)"
|
||||
${pkgs.notmuch}/bin/notmuch tag -spam -- "(not folder:/Junk|Spam|SPAM/) tag:spam"
|
||||
'';
|
||||
new = {
|
||||
tags = [ ];
|
||||
ignore = [ ".isyncuidmap.db" ];
|
||||
};
|
||||
maildir.synchronizeFlags = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
packages = [ pkgs.neomutt sortMail ];
|
||||
file = let
|
||||
mutt_alternates = "@maralorn.de "
|
||||
+ (builtins.concatStringsSep " " me.alternates);
|
||||
show-sidebar = pkgs.writeText "show-sidebar" ''
|
||||
set sidebar_visible=yes
|
||||
bind index <up> sidebar-prev
|
||||
bind index <down> sidebar-next
|
||||
bind index <pageup> sidebar-page-up
|
||||
bind index <pagedown> sidebar-page-down
|
||||
bind index <space> sidebar-open
|
||||
bind index <return> sidebar-open
|
||||
bind index <enter> sidebar-open
|
||||
'';
|
||||
hide-sidebar = pkgs.writeText "hide-sidebar" ''
|
||||
set sidebar_visible=no
|
||||
bind index <up> previous-undeleted
|
||||
bind index <down> next-undeleted
|
||||
bind index <pageup> previous-page
|
||||
bind index <pagedown> next-page
|
||||
bind index <space> display-message
|
||||
bind index <return> display-message
|
||||
bind index <enter> display-message
|
||||
'';
|
||||
mailcap = pkgs.writeText "mailcap" ''
|
||||
text/html; ${pkgs.lynx}/bin/lynx -stdin -dump -force_html ; copiousoutput
|
||||
application/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
image/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
video/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
audio/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
exports.host = "${account.imap.host}"
|
||||
exports.port = 993
|
||||
exports.tls = true;
|
||||
exports.tlsOptions = { "rejectUnauthorized": false };
|
||||
exports.username = "${account.userName}";
|
||||
exports.password = getStdout("${toString account.passwordCommand}");
|
||||
exports.onNotify = "${pkgs.isync}/bin/mbsync ${name}"
|
||||
exports.onNotifyPost = "${pkgs.notmuch}/bin/notmuch new"
|
||||
exports.boxes = [ "Inbox" ];
|
||||
'';
|
||||
in {
|
||||
".neomuttrc".text = ''
|
||||
alternative_order text/plain text/html
|
||||
auto_view text/*
|
||||
auto_view message/*
|
||||
unset wait_key
|
||||
color normal default default
|
||||
|
||||
set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"
|
||||
set query_command = "${pkgs.notmuch}/bin/notmuch address --output=recipients --deduplicate=address '%s' | grep -i '%s'"
|
||||
bind editor <Tab> complete-query
|
||||
bind editor ^T complete
|
||||
|
||||
set crypt_use_gpgme = yes
|
||||
set pgp_use_gpg_agent = yes
|
||||
set pgp_auto_decode = yes
|
||||
set pgp_autosign = yes
|
||||
set pgp_replysign = yes
|
||||
set pgp_replyencrypt = yes
|
||||
set crypt_replysignencrypted = yes
|
||||
set crypt_verify_sig = yes
|
||||
set pgp_sign_as="${me.gpg}"
|
||||
set pgp_use_gpg_agent = yes
|
||||
set pgp_default_key="${me.gpg}"
|
||||
set timeout = 5
|
||||
|
||||
set abort_noattach = ask-yes
|
||||
set abort_noattach_regex = "(hängt an|anhäng|anhang|anbei|angehängt|attach|attached|attachments?)"
|
||||
set abort_unmodified = ask-yes
|
||||
|
||||
alternates ${mutt_alternates}
|
||||
set folder="${maildir}"
|
||||
mailboxes `find ${maildir} -type d -name Inbox -printf '"%h" '` `find ${maildir} -type d -name cur -printf '"%h" '`
|
||||
set sendmail="${pkgs.msmtp}/bin/msmtp --read-envelope-from"
|
||||
set sort=threads
|
||||
set sort_aux=date-sent
|
||||
set realname="${me.name}"
|
||||
set from=fill-later
|
||||
set use_from=yes
|
||||
set fast_reply=yes
|
||||
set mailcap_path=${mailcap};
|
||||
set include=yes
|
||||
set edit_headers=yes
|
||||
set mbox_type=Maildir
|
||||
set spoolfile="${maildir}/hera/Archiv"
|
||||
set record="${maildir}/hera/Archiv/unsortiert"
|
||||
set postponed="${maildir}/hera/Drafts"
|
||||
set mail_check_stats=yes
|
||||
bind index / vfolder-from-query
|
||||
set header_cache = "~/.cache/neomutt"
|
||||
set date_format="!%y-%m-%d %H:%M"
|
||||
set mime_forward=yes
|
||||
set mime_forward_rest=yes
|
||||
|
||||
macro index <F5> "!systemctl --user start mbsync > /dev/null<enter>"
|
||||
|
||||
source "${hide-sidebar}"
|
||||
macro index <right> "<enter-command>source ${hide-sidebar}<enter>"
|
||||
macro index <left> "<enter-command>source ${show-sidebar}<enter>"
|
||||
set sidebar_folder_indent=no
|
||||
set sidebar_short_path=no
|
||||
set sidebar_component_depth=2
|
||||
set sidebar_width=60
|
||||
set sidebar_sort_method="alpha"
|
||||
set sidebar_indent_string=" "
|
||||
color sidebar_indicator black white
|
||||
color sidebar_highlight white blue
|
||||
set sidebar_format = "%B%* %?N?%N/?%S"
|
||||
|
||||
alias f__0 ${me.name} <${me.mail}>
|
||||
${builtins.concatStringsSep "\n"
|
||||
(lib.imap1 (n: x: "alias f__${toString n} ${me.name} <${x}>")
|
||||
me.alternates)}
|
||||
send2-hook '~f fill-later' "push <edit-from><kill-line>f__<complete><search>${me.mail}<enter>"
|
||||
'';
|
||||
Unit = { Description = "Run imapnotify for imap account ${name}"; };
|
||||
Service = {
|
||||
ExecStart = "${pkgs.imapnotify}/bin/imapnotify -c ${configjs}";
|
||||
Restart = "always";
|
||||
RestartSec = "1min";
|
||||
};
|
||||
Install = { WantedBy = [ "default.target" ]; };
|
||||
};
|
||||
mkServiceWithName = name: account: {
|
||||
name = "imapnotify-${name}-inbox";
|
||||
value = mkService name account;
|
||||
};
|
||||
hasImapHost = name: account: account.imap != null;
|
||||
in mapAttrs' mkServiceWithName
|
||||
(filterAttrs hasImapHost config.accounts.email.accounts) // {
|
||||
mbsync.Service.Environment = "PATH=${pkgs.coreutils}/bin";
|
||||
};
|
||||
|
||||
programs.msmtp.enable = true;
|
||||
programs.mbsync.enable = true;
|
||||
programs.notmuch = {
|
||||
enable = true;
|
||||
hooks.postInsert = ''
|
||||
${pkgs.notmuch}/bin/notmuch tag +deleted -- "folder:/Trash/ (not tag:deleted)"
|
||||
${pkgs.notmuch}/bin/notmuch tag -deleted -- "(not folder:/Trash/) tag:deleted"
|
||||
${pkgs.notmuch}/bin/notmuch tag +spam -- "folder:/Junk|Spam|SPAM/ (not tag:spam)"
|
||||
${pkgs.notmuch}/bin/notmuch tag -spam -- "(not folder:/Junk|Spam|SPAM/) tag:spam"
|
||||
'';
|
||||
new = {
|
||||
tags = [ ];
|
||||
ignore = [ ".isyncuidmap.db" ];
|
||||
};
|
||||
maildir.synchronizeFlags = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
packages = [ pkgs.neomutt sortMail ];
|
||||
file = let
|
||||
mutt_alternates = "@maralorn.de "
|
||||
+ (builtins.concatStringsSep " " me.alternates);
|
||||
show-sidebar = pkgs.writeText "show-sidebar" ''
|
||||
set sidebar_visible=yes
|
||||
bind index <up> sidebar-prev
|
||||
bind index <down> sidebar-next
|
||||
bind index <pageup> sidebar-page-up
|
||||
bind index <pagedown> sidebar-page-down
|
||||
bind index <space> sidebar-open
|
||||
bind index <return> sidebar-open
|
||||
bind index <enter> sidebar-open
|
||||
'';
|
||||
hide-sidebar = pkgs.writeText "hide-sidebar" ''
|
||||
set sidebar_visible=no
|
||||
bind index <up> previous-undeleted
|
||||
bind index <down> next-undeleted
|
||||
bind index <pageup> previous-page
|
||||
bind index <pagedown> next-page
|
||||
bind index <space> display-message
|
||||
bind index <return> display-message
|
||||
bind index <enter> display-message
|
||||
'';
|
||||
mailcap = pkgs.writeText "mailcap" ''
|
||||
text/html; ${pkgs.lynx}/bin/lynx -stdin -dump -force_html ; copiousoutput
|
||||
application/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
image/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
video/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
audio/*; ${pkgs.xdg_utils}/bin/xdg-open %s > /dev/null
|
||||
'';
|
||||
in {
|
||||
".neomuttrc".text = ''
|
||||
alternative_order text/plain text/html
|
||||
auto_view text/*
|
||||
auto_view message/*
|
||||
unset wait_key
|
||||
color normal default default
|
||||
|
||||
set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"
|
||||
set query_command = "${pkgs.notmuch}/bin/notmuch address --output=recipients --deduplicate=address '%s' | grep -i '%s'"
|
||||
bind editor <Tab> complete-query
|
||||
bind editor ^T complete
|
||||
|
||||
set crypt_use_gpgme = yes
|
||||
set pgp_use_gpg_agent = yes
|
||||
set pgp_auto_decode = yes
|
||||
set pgp_autosign = yes
|
||||
set pgp_replysign = yes
|
||||
set pgp_replyencrypt = yes
|
||||
set crypt_replysignencrypted = yes
|
||||
set crypt_verify_sig = yes
|
||||
set pgp_sign_as="${me.gpg}"
|
||||
set pgp_use_gpg_agent = yes
|
||||
set pgp_default_key="${me.gpg}"
|
||||
set timeout = 5
|
||||
|
||||
set abort_noattach = ask-yes
|
||||
set abort_noattach_regex = "(hängt an|anhäng|anhang|anbei|angehängt|attach|attached|attachments?)"
|
||||
set abort_unmodified = ask-yes
|
||||
|
||||
alternates ${mutt_alternates}
|
||||
set folder="${maildir}"
|
||||
mailboxes `find ${maildir} -type d -name Inbox -printf '"%h" '` `find ${maildir} -type d -name cur -printf '"%h" '`
|
||||
set sendmail="${pkgs.msmtp}/bin/msmtp --read-envelope-from"
|
||||
set sort=threads
|
||||
set sort_aux=date-sent
|
||||
set realname="${me.name}"
|
||||
set from=fill-later
|
||||
set use_from=yes
|
||||
set fast_reply=yes
|
||||
set mailcap_path=${mailcap};
|
||||
set include=yes
|
||||
set edit_headers=yes
|
||||
set mbox_type=Maildir
|
||||
set spoolfile="${maildir}/hera/Archiv"
|
||||
set record="${maildir}/hera/Archiv/unsortiert"
|
||||
set postponed="${maildir}/hera/Drafts"
|
||||
set mail_check_stats=yes
|
||||
bind index / vfolder-from-query
|
||||
set header_cache = "~/.cache/neomutt"
|
||||
set date_format="!%y-%m-%d %H:%M"
|
||||
set mime_forward=yes
|
||||
set mime_forward_rest=yes
|
||||
|
||||
macro index <F5> "!systemctl --user start mbsync > /dev/null<enter>"
|
||||
|
||||
source "${hide-sidebar}"
|
||||
macro index <right> "<enter-command>source ${hide-sidebar}<enter>"
|
||||
macro index <left> "<enter-command>source ${show-sidebar}<enter>"
|
||||
set sidebar_folder_indent=no
|
||||
set sidebar_short_path=no
|
||||
set sidebar_component_depth=2
|
||||
set sidebar_width=60
|
||||
set sidebar_sort_method="alpha"
|
||||
set sidebar_indent_string=" "
|
||||
color sidebar_indicator black white
|
||||
color sidebar_highlight white blue
|
||||
set sidebar_format = "%B%* %?N?%N/?%S"
|
||||
|
||||
alias f__0 ${me.name} <${me.mail}>
|
||||
${builtins.concatStringsSep "\n"
|
||||
(lib.imap1 (n: x: "alias f__${toString n} ${me.name} <${x}>")
|
||||
me.alternates)}
|
||||
send2-hook '~f fill-later' "push <edit-from><kill-line>f__<complete><search>${me.mail}<enter>"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib; {
|
||||
|
||||
options.m-0.pythia.enable = mkEnableOption "Pythia";
|
||||
config = mkIf config.m-0.pythia.enable (let
|
||||
{ pkgs, ... }: {
|
||||
config = (let
|
||||
pythia-path = "${config.home.homeDirectory}/documents/pythia";
|
||||
pythia = pkgs.writeShellScriptBin "pythia" ''
|
||||
datei=${pythia-path}/$(date +%Y-%m-%d)
|
||||
|
@ -107,7 +104,7 @@ with lib; {
|
|||
'';
|
||||
in {
|
||||
|
||||
home.packages = with pkgs; [ pythia meditate ];
|
||||
home.packages = [ pythia meditate ];
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib; {
|
||||
|
||||
options.m-0.rustdev.enable = mkEnableOption "Rust Dev";
|
||||
|
||||
config = mkIf config.m-0.rustdev.enable {
|
||||
home.packages = with pkgs; [ rustup nix-prefetch-scripts gcc ];
|
||||
};
|
||||
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
makeUnlocker = { name, hostName, pubKey, passPath }:
|
||||
|
@ -15,13 +14,15 @@ let
|
|||
echo "Ping successful; Entering disk encryption password"
|
||||
${pkgs.pass}/bin/pass ${passPath} | ssh -4 root@${hostName} -o UserKnownHostsFile=${knownHosts} cryptsetup-askpass && echo "Unlocking of ${name} successful" || echo "Unlocking of ${name} failed"
|
||||
'';
|
||||
unlocker = [{
|
||||
name = "hera";
|
||||
hostName = "hera-v4";
|
||||
pubKey =
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCHkqWlFLtmIlTSKahr2PcL++K75YgfsSU6jwVYW5df3JCkowu/M16SIBxABxYSQrKej5uIz/OFCjqSxHJQ8D5wSYBvn2gYr/BbBcz4rfIJmZ55Od2jckaqlj/M8TtkuPPhsQG7S730vXxK5hbMT8iW5WWv8sIKY/WtaRbZOFMX/53WCLEHtnMu5zFJFWf92+mjIHSLyW8ggl1m525RUiaAfCge2vnuzIFq4kUqJxaWzxIvEWIncKWN10K/HMvdI+yOtbSen41uKedwSFhUFs3xHy1mJddYOrlcJQPt5zuuffZ/nTDVXMZoh5QNwg8ZlkkueVChaS1Y5STjb7cem1Mt";
|
||||
passPath = "eu/m-0/hera.m-0.eu/disk";
|
||||
}];
|
||||
in {
|
||||
|
||||
options.m-0.unlocker = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.attrs;
|
||||
};
|
||||
|
||||
config = { home.packages = map makeUnlocker config.m-0.unlocker; };
|
||||
|
||||
}
|
||||
|
|
12
home/mpclient.nix
Normal file
12
home/mpclient.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ pkgs, ... }: {
|
||||
home.packages = [ pkgs.ncmpcpp ];
|
||||
home.file.".ncmpcpp/config".text = ''
|
||||
ask_before_clearing_playlists=no
|
||||
mouse_support = yes
|
||||
song_columns_list_format = "(24)[red]{a} $R(48)[blue]{t} (24)[green]{b} (4)[magenta]{l}"
|
||||
playlist_display_mode = columns
|
||||
search_engine_display_mode = columns
|
||||
browser_display_mode = columns
|
||||
user_interface = alternative
|
||||
'';
|
||||
}
|
21
home/mpd.nix
Normal file
21
home/mpd.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ pkgs, config, ... }: {
|
||||
services = {
|
||||
mpd = {
|
||||
enable = true;
|
||||
network.listenAddress = "::1";
|
||||
musicDirectory = "${config.home.homeDirectory}/media/audio";
|
||||
extraConfig = ''
|
||||
audio_output {
|
||||
type "pulse"
|
||||
name "Pulseaudio"
|
||||
server "localhost"
|
||||
}
|
||||
'';
|
||||
};
|
||||
mpdris2.enable = true;
|
||||
};
|
||||
systemd.user.services.mpdris2 = {
|
||||
Unit.Requires = [ "dbus.service" ];
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
}
|
105
home/pythia.nix
Normal file
105
home/pythia.nix
Normal file
|
@ -0,0 +1,105 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
pythia-path = "${config.home.homeDirectory}/documents/pythia";
|
||||
pythia = pkgs.writeShellScriptBin "pythia" ''
|
||||
datei=${pythia-path}/$(date +%Y-%m-%d)
|
||||
touch $datei
|
||||
vim $datei
|
||||
grep TODO: $datei | sed 's/TODO: //' | while read -r line; do task add "$line"; done && sed -i 's/TODO: /Notiert: /' $datei
|
||||
grep WEAK: $datei | sed 's/WEAK: //' >> ${pythia-path}/schwächen && sed -i 's/WEAK: /Schwäche: /' $datei
|
||||
grep STRONG: $datei | sed 's/STRONG: //' >> ${pythia-path}/stärken && sed -i 's/STRONG: /Stärke: /' $datei
|
||||
grep RULE: $datei | sed 's/RULE: //' >> ${pythia-path}/richtlinien && sed -i 's/RULE: /Richtlinie: /' $datei
|
||||
grep INDICATOR: $datei | sed 's/INDICATOR: //' >> ${pythia-path}/warnzeichen && sed -i 's/INDICATOR: /Warnzeichen: /' $datei
|
||||
'';
|
||||
printslow = pkgs.writeScriptBin "printslow" ''
|
||||
#!${pkgs.python3}/bin/python
|
||||
|
||||
import fileinput
|
||||
import sys
|
||||
import time
|
||||
|
||||
for line in fileinput.input():
|
||||
for letter in line:
|
||||
print(letter, end="")
|
||||
sys.stdout.flush()
|
||||
time.sleep(0.1)
|
||||
'';
|
||||
fortune = ''
|
||||
${pkgs.fortune}/bin/fortune | ${run-printslow}
|
||||
echo
|
||||
sleep 5s
|
||||
'';
|
||||
threefortunes = ''
|
||||
echo Genieße drei Fortunes: | ${run-printslow}
|
||||
echo
|
||||
${fortune}
|
||||
${fortune}
|
||||
${fortune}
|
||||
'';
|
||||
run-pythia = "${pythia}/bin/pythia";
|
||||
run-printslow = "${printslow}/bin/printslow";
|
||||
hold = "echo -n '>'; read a;";
|
||||
dong = "${pkgs.mpv}/bin/mpv dong.ogg &> /dev/null &";
|
||||
meditate = pkgs.writeShellScriptBin "meditate" ''
|
||||
cd ${pythia-path}
|
||||
i3-msg fullscreen &> /dev/null
|
||||
start=`${pkgs.taskwarrior}/bin/task calc now`
|
||||
mpv background.ogg &> /dev/null &
|
||||
${run-printslow} << EOF
|
||||
Hallo Malte,
|
||||
|
||||
hier spricht Pythia.
|
||||
|
||||
Herzlich willkommen zur Besinnung, Ruhefindung und Orientierung.
|
||||
|
||||
Bist Du bereit?
|
||||
EOF
|
||||
${hold}
|
||||
${run-printslow} << EOF
|
||||
Gut, dann lass uns starten.
|
||||
EOF
|
||||
sleep 3s
|
||||
${run-printslow} << EOF
|
||||
|
||||
Nimm Dir ein wenig Zeit um die Gedanken zu sammeln, die unerledigt sind.
|
||||
|
||||
EOF
|
||||
sleep 1s
|
||||
${run-pythia}
|
||||
${run-printslow} << EOF
|
||||
|
||||
Nimm Dir nun mindestens 5 Minuten Auszeit um tief zu entspannen.
|
||||
Achte auf Deine Atmung und Deinen Körper.
|
||||
Beruhige Deine Gedanken und gehe in Dich.
|
||||
|
||||
EOF
|
||||
${dong}
|
||||
sleep 5m
|
||||
${dong}
|
||||
${hold}
|
||||
${threefortunes}
|
||||
${run-printslow} << EOF
|
||||
Nun ist die Zeit für Reflektion und um an Deinem Credo zu arbeiten.
|
||||
EOF
|
||||
sleep 3s
|
||||
${run-pythia}
|
||||
${run-printslow} << EOF
|
||||
Melde Dich, wenn Du bereit für Dein Credo bist.
|
||||
EOF
|
||||
${hold}
|
||||
${run-printslow} credo
|
||||
${hold}
|
||||
${run-printslow} << EOF
|
||||
|
||||
Nun genieße die gewonne Energie um Dich auf die Zukunft vorzubereiten.
|
||||
EOF
|
||||
${hold}
|
||||
${threefortunes}
|
||||
${dong}
|
||||
echo Dauer der Meditation | ${run-printslow}
|
||||
${pkgs.taskwarrior}/bin/task calc now-$start
|
||||
${pkgs.taskwarrior}/bin/task gen_id:meditation done
|
||||
${hold}
|
||||
exit
|
||||
'';
|
||||
in { home.packages = [ pythia meditate ]; }
|
8
home/tinkering.nix
Normal file
8
home/tinkering.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ pkgs, ... }: {
|
||||
home.packages = builtins.attrValues {
|
||||
inherit (pkgs.xorg) xev;
|
||||
inherit (pkgs.gitAndTools) hub;
|
||||
inherit (pkgs) meld icedtea8_web octave filezilla cachix nix-review gparted;
|
||||
grafana-devel = pkgs.callPackage ../pkgs/grafana-devel.nix { };
|
||||
};
|
||||
}
|
23
home/unlock.nix
Normal file
23
home/unlock.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
makeUnlocker = { name, hostName, pubKey, passPath }:
|
||||
let knownHosts = pkgs.writeText "KnownBootHosts" "${hostName} ${pubKey}";
|
||||
in pkgs.writeShellScriptBin "unlock-${name}" ''
|
||||
echo "Waiting for host to come up";
|
||||
while true; do
|
||||
echo -n .
|
||||
/run/wrappers/bin/ping -4 ${hostName} -c 1 -w 1 > /dev/null && break;
|
||||
sleep 1s;
|
||||
done;
|
||||
echo
|
||||
echo "Ping successful; Entering disk encryption password"
|
||||
${pkgs.pass}/bin/pass ${passPath} | ssh -4 root@${hostName} -o UserKnownHostsFile=${knownHosts} cryptsetup-askpass && echo "Unlocking of ${name} successful" || echo "Unlocking of ${name} failed"
|
||||
'';
|
||||
unlocker = [{
|
||||
name = "hera";
|
||||
hostName = "hera-v4";
|
||||
pubKey =
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCHkqWlFLtmIlTSKahr2PcL++K75YgfsSU6jwVYW5df3JCkowu/M16SIBxABxYSQrKej5uIz/OFCjqSxHJQ8D5wSYBvn2gYr/BbBcz4rfIJmZ55Od2jckaqlj/M8TtkuPPhsQG7S730vXxK5hbMT8iW5WWv8sIKY/WtaRbZOFMX/53WCLEHtnMu5zFJFWf92+mjIHSLyW8ggl1m525RUiaAfCge2vnuzIFq4kUqJxaWzxIvEWIncKWN10K/HMvdI+yOtbSen41uKedwSFhUFs3xHy1mJddYOrlcJQPt5zuuffZ/nTDVXMZoh5QNwg8ZlkkueVChaS1Y5STjb7cem1Mt";
|
||||
passPath = "eu/m-0/hera.m-0.eu/disk";
|
||||
}];
|
||||
in { config = { home.packages = map makeUnlocker unlocker; }; }
|
|
@ -3,21 +3,10 @@ let
|
|||
inherit (import ../lib) writeHaskellScript get-niv-path gcRetentionDays;
|
||||
inherit (import ../lib/update-home.nix) update-home;
|
||||
configPath = "/home/${config.home.username}/git/config";
|
||||
home-maintenance = writeHaskellScript {
|
||||
name = "home-maintenance";
|
||||
imports = [ ];
|
||||
bins = [ (update-home configPath) pkgs.nix pkgs.git ];
|
||||
} ''
|
||||
main = do
|
||||
git "-C" "${configPath}" "pull"
|
||||
update_home
|
||||
--nix_collect_garbage "--delete-older-than" "${toString gcRetentionDays}d"
|
||||
nix "optimise-store"
|
||||
'';
|
||||
in {
|
||||
home = {
|
||||
packages = builtins.attrValues {
|
||||
inherit home-maintenance get-niv-path;
|
||||
inherit get-niv-path;
|
||||
update-home = update-home configPath;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -14,7 +14,12 @@
|
|||
# If running from tty1 start sway
|
||||
if [ "$(tty)" = "/dev/tty1" ]; then
|
||||
. ${my-pkgs.start-ssh-agent}/bin/start-ssh-agent
|
||||
exec ${pkgs.sway}/bin/sway >> ~/tmp/sway.log
|
||||
while true; do
|
||||
${pkgs.dialog}/bin/dialog --menu "Select Mode" 20 80 5 research "" orga "" tinkering "" leisure "" --stderr 2> ~/tmp/mode
|
||||
update-home-mode
|
||||
echo Launching sway at $(date) >> ~/tmp/sway.log
|
||||
${pkgs.sway}/bin/sway >> ~/tmp/sway.log
|
||||
done
|
||||
fi
|
||||
|
||||
${builtins.readFile ./zshrc}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
{ pkgs, config, ... }: {
|
||||
|
||||
imports = [
|
||||
../../home
|
||||
../../home/on-my-machine.nix
|
||||
../../home/battery.nix
|
||||
../../home/update_tasks.nix
|
||||
../../home/desktop
|
||||
];
|
||||
|
||||
home.packages = builtins.attrValues (import ../../pkgs).laptop-home-pkgs;
|
||||
|
||||
m-0 = {
|
||||
hostName = "apollo";
|
||||
latex.enable = true;
|
||||
accounting = {
|
||||
enable = true;
|
||||
config = builtins.readFile secret/jaliconfig.py;
|
||||
};
|
||||
pythia.enable = true;
|
||||
unlocker = [{
|
||||
name = "hera";
|
||||
hostName = "hera-v4";
|
||||
pubKey =
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCHkqWlFLtmIlTSKahr2PcL++K75YgfsSU6jwVYW5df3JCkowu/M16SIBxABxYSQrKej5uIz/OFCjqSxHJQ8D5wSYBvn2gYr/BbBcz4rfIJmZ55Od2jckaqlj/M8TtkuPPhsQG7S730vXxK5hbMT8iW5WWv8sIKY/WtaRbZOFMX/53WCLEHtnMu5zFJFWf92+mjIHSLyW8ggl1m525RUiaAfCge2vnuzIFq4kUqJxaWzxIvEWIncKWN10K/HMvdI+yOtbSen41uKedwSFhUFs3xHy1mJddYOrlcJQPt5zuuffZ/nTDVXMZoh5QNwg8ZlkkueVChaS1Y5STjb7cem1Mt";
|
||||
passPath = "eu/m-0/hera.m-0.eu/disk";
|
||||
}];
|
||||
mail = {
|
||||
enable = true;
|
||||
accounts = config.m-0.private.mail_accounts;
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".ncmpcpp/config".text = ''
|
||||
ask_before_clearing_playlists=no
|
||||
mouse_support = yes
|
||||
song_columns_list_format = "(24)[red]{a} $R(48)[blue]{t} (24)[green]{b} (4)[magenta]{l}"
|
||||
playlist_display_mode = columns
|
||||
search_engine_display_mode = columns
|
||||
browser_display_mode = columns
|
||||
user_interface = alternative
|
||||
'';
|
||||
|
||||
programs = {
|
||||
firefox = { enable = true; };
|
||||
git = {
|
||||
signing = {
|
||||
signByDefault = true;
|
||||
key = "6C3D12CD88CDF46C5EAF4D12226A2D41EF5378C9";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
udiskie = {
|
||||
enable = true;
|
||||
notify = true;
|
||||
};
|
||||
};
|
||||
}
|
Binary file not shown.
|
@ -21,6 +21,7 @@ rec {
|
|||
};
|
||||
pkgs = import <nixpkgs> { };
|
||||
unstable = import <unstable> { };
|
||||
unfreePkgs = import <nixpkgs> { config = { allowUnfree = true; }; };
|
||||
sources = import ../nix/sources.nix;
|
||||
unBreak = pkg:
|
||||
pkgs.haskell.lib.overrideCabal pkg (drv: {
|
||||
|
|
117
pkgs/default.nix
117
pkgs/default.nix
|
@ -1,8 +1,6 @@
|
|||
let
|
||||
my-lib = import ../lib;
|
||||
unfreePkgs = import <nixpkgs> { config = { allowUnfree = true; }; };
|
||||
inherit (my-lib)
|
||||
pkgs unstable sources writeHaskellScript gcRetentionDays unBreak colors;
|
||||
inherit (my-lib) pkgs unstable sources writeHaskellScript unBreak colors;
|
||||
in rec {
|
||||
start-ssh-agent = pkgs.writeShellScriptBin "start-ssh-agent" ''
|
||||
${pkgs.psmisc}/bin/killall -q ssh-agent
|
||||
|
@ -16,7 +14,6 @@ in rec {
|
|||
my-ssh-add = pkgs.writeShellScriptBin "my-ssh-add" ''
|
||||
SSH_ASKPASS=${cat-pw}/bin/cat-ssh-pw ${pkgs.openssh}/bin/ssh-add < /dev/null
|
||||
'';
|
||||
ghcide = (import sources.ghcide { }).ghcide-ghc865;
|
||||
obelisk = (import sources.obelisk { }).command;
|
||||
nix-direnv = sources.nix-direnv + "/direnvrc";
|
||||
neovim = pkgs.neovim.override {
|
||||
|
@ -43,115 +40,6 @@ in rec {
|
|||
tcpdump tmux tig exa fzf ag fd bat ripgrep ranger pass sshuttle vnstat
|
||||
entr libargon2 mblaze niv;
|
||||
};
|
||||
gw2wrapper = writeHaskellScript {
|
||||
name = "gw2wrapper";
|
||||
bins = [ pkgs.procps ];
|
||||
imports = [ "System.Directory (withCurrentDirectory)" ];
|
||||
|
||||
} ''
|
||||
waitForExit = do
|
||||
sleep "5s"
|
||||
processes <- ps "aux" |> captureTrim
|
||||
when
|
||||
(BS.isInfixOf (encodeUtf8 "GW2.exe") (toStrict processes))
|
||||
waitForExit
|
||||
main = do
|
||||
withCurrentDirectory "/home/maralorn/GW2" $ exe "./play.sh"
|
||||
waitForExit
|
||||
'';
|
||||
|
||||
laptop-home-pkgs = {
|
||||
maintenance = pkgs.writeShellScriptBin "maintenance" ''
|
||||
git -C ~/git/config pull
|
||||
update-home
|
||||
sudo -A update-system
|
||||
#sudo -A nix-collect-garbage --delete-older-than ${
|
||||
toString gcRetentionDays
|
||||
}d
|
||||
sudo -A nix optimise-store
|
||||
'';
|
||||
rewlan = pkgs.writeShellScriptBin "rewlan" ''
|
||||
nmcli r wifi off;
|
||||
sleep 0.1s;
|
||||
nmcli r wifi on;
|
||||
'';
|
||||
gw2 = pkgs.buildFHSUserEnv {
|
||||
name = "gw2";
|
||||
targetPkgs = pkgs: (with pkgs; [ sambaFull ]);
|
||||
multiPkgs = pkgs:
|
||||
(with pkgs;
|
||||
with xorg; [
|
||||
file
|
||||
freetype
|
||||
libpng
|
||||
mesa_drivers
|
||||
zlib
|
||||
libXi
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXrender
|
||||
libXxf86vm
|
||||
libXcomposite
|
||||
libXext
|
||||
libX11
|
||||
libudev
|
||||
libGLU
|
||||
mesa_noglu.osmesa
|
||||
libdrm
|
||||
libpulseaudio
|
||||
alsaLib
|
||||
openal
|
||||
mpg123
|
||||
libtxc_dxtn
|
||||
gnutls
|
||||
krb5Full
|
||||
ncurses5
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
vulkan-tools
|
||||
]);
|
||||
runScript = "${gw2wrapper}/bin/gw2wrapper";
|
||||
};
|
||||
inherit (unfreePkgs) discord zoom-us skypeforlinux steam google-chrome;
|
||||
inherit (pkgs.gnome3) nautilus;
|
||||
inherit (pkgs.xorg) xev xbacklight;
|
||||
inherit (pkgs.gitAndTools) hub;
|
||||
inherit (pkgs)
|
||||
# web
|
||||
chromium
|
||||
|
||||
mumble
|
||||
|
||||
upower speedtest-cli
|
||||
|
||||
anki
|
||||
|
||||
cachix
|
||||
|
||||
# communication
|
||||
signal-desktop tdesktop acpi dino
|
||||
|
||||
# config
|
||||
arandr
|
||||
|
||||
#dev
|
||||
meld icedtea8_web octave filezilla
|
||||
|
||||
# tools & office
|
||||
feh gimp imagemagick libreoffice-fresh xournal musescore handbrake evince
|
||||
abcde beets
|
||||
|
||||
# teamviewer
|
||||
|
||||
# media
|
||||
ncpamixer pavucontrol deluge gmpc calibre mpv youtubeDL
|
||||
|
||||
# games
|
||||
minetest
|
||||
|
||||
nix-review gparted;
|
||||
grafana-devel = pkgs.callPackage ./grafana-devel.nix { };
|
||||
};
|
||||
|
||||
my-home-pkgs = {
|
||||
print215 = pkgs.writeShellScriptBin "print215" ''
|
||||
|
@ -174,7 +62,6 @@ in rec {
|
|||
inherit (pkgs)
|
||||
kitty lm_sensors sway swaylock swayidle xwayland rofi dmenu xdg_utils
|
||||
libnotify mako wofi;
|
||||
|
||||
};
|
||||
home-pkgs = {
|
||||
inherit (pkgs.pythonPackages) yapf jsbeautifier;
|
||||
|
@ -182,7 +69,7 @@ in rec {
|
|||
mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole nixfmt
|
||||
stack ghcid;
|
||||
inherit (my-lib) ghc;
|
||||
inherit home-neovim ghcide obelisk;
|
||||
inherit home-neovim obelisk;
|
||||
cabal-fmt = (unBreak pkgs.haskell.packages.ghc881.cabal-fmt);
|
||||
};
|
||||
accounting-pkgs = {
|
||||
|
|
Loading…
Reference in a new issue