Email, nvim->vim, torrenting fixes, musical rice

This commit is contained in:
kat witch 2021-03-12 16:20:27 +00:00
parent 7d899adde6
commit f16cf48dd6
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
18 changed files with 328 additions and 47 deletions

5
.gitignore vendored
View file

@ -1,3 +1,6 @@
/result
secrets.nix
!config/profiles/common/nixos/secrets.nix
*.swp
*.swo
w
!config/profiles/common/nixos/secrets.nix

View file

@ -3,6 +3,7 @@
{
imports = [
./hardware.nix
../../services/nginx.nix
#./wireguard.nix
];
@ -25,6 +26,7 @@
defaultGateway = "104.244.73.1";
nameservers = [ "1.1.1.1" ];
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
system.stateVersion = "20.09";
}

View file

@ -25,7 +25,7 @@
networking.useDHCP = false;
networking.interfaces.enp34s0.useDHCP = true;
networking.firewall.allowPing = true;
networking.firewall.allowedTCPPorts = [ 445 139 9091 ]; # smb transmission
networking.firewall.allowedTCPPorts = [ 80 445 139 9091 ]; # smb transmission
networking.firewall.allowedUDPPorts = [ 137 138 4010 ]; # smb scream
system.stateVersion = "20.09";

View file

@ -17,8 +17,8 @@
home = "/disks/pool-raw/transmission";
downloadDirPermissions = "777";
settings = {
download-dir = "/disks/pool-raw/Public/Media/";
incomplete-dir = "/disks/pool-raw/Public/Media/.incomplete";
download-dir = "/disks/pool-raw/media/";
incomplete-dir = "/disks/pool-raw/media/.incomplete";
incomplete-dir-enabled = true;
rpc-bind-address = "0.0.0.0";
rpc-whitelist = "127.0.0.1,192.168.1.*,192.168.122.*";
@ -47,7 +47,7 @@
'';
shares = {
media = {
path = "/disks/pool-raw/Public/Media";
path = "/disks/pool-raw/media";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
@ -62,7 +62,13 @@
services.nginx.virtualHosts = {
"192.168.1.135" = {
locations."/share/" = {
alias = "/disks/pool-raw/Public/Media/";
alias = "/disks/pool-raw/media/";
extraConfig = "autoindex on;";
};
};
"100.103.111.44" = {
locations."/share/" = {
alias = "/disks/pool-raw/media/";
extraConfig = "autoindex on;";
};
};

View file

@ -15,6 +15,7 @@ in {
specialArgs = {
inherit sources witch;
superConfig = config;
modulesPath = sources.home-manager + "/modules";
};
});
};

View file

@ -5,6 +5,7 @@
./firefox
./kitty.nix
./packages.nix
./email.nix
./nextcloud.nix
./gpg.nix
./gtk.nix

View file

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
{
programs.notmuch = {
enable = true;
hooks = {
preNew = "mbsync --all";
};
};
programs.mbsync.enable = true;
programs.msmtp.enable = true;
accounts.email = {
maildirBasePath = "${config.home.homeDirectory}/mail";
accounts.kat = {
address = "kat@kittywit.ch";
primary = true;
realName = "kat witch";
userName = "kat@kittywit.ch";
passwordCommand = ''bitw -p gpg://${../../../private/files/master.gpg} get "kittywitch email"'';
msmtp.enable = true;
mbsync.enable = true;
mbsync.create = "maildir";
notmuch.enable = true;
imap.host = "kittywit.ch";
smtp.host = "kittywit.ch";
gpg = {
signByDefault = true;
key = "01F50A29D4AA91175A11BDB17248991EFA8EFBEE";
};
};
};
programs.vim.plugins = [ pkgs.arc.pkgs.vimPlugins.notmuch-vim ];
}

View file

@ -4,7 +4,7 @@
config = lib.mkIf config.deploy.profile.gui {
programs.ncmpcpp = {
enable = true;
mpdMusicDir = "/home/kat/music";
mpdMusicDir = "/home/kat/media/music";
settings = {
visualizer_data_source = "/tmp/mpd.fifo";
visualizer_output_name = "my_fifo";
@ -16,23 +16,25 @@
discard_colors_if_item_is_selected = "no";
header_window_color = "250";
volume_color = "250";
state_line_color = "cyan";
state_line_color = "cyan";
state_flags_color = "cyan";
alternative_ui_separator_color = "yellow";
statusbar_color = "yellow";
progressbar_color = "black";
progressbar_elapsed_color = "blue";
window_border_color = "yellow";
playlist_display_mode = "classic";
song_columns_list_format =
"(3f)[cyan]{n} (40)[default]{t|f} (25)[red]{a} (30)[blue]{b} (4f)[cyan]{l}";
now_playing_prefix = "$b";
song_list_format =
"$1$9%l$1$9 $8¦$9 $6%a$9 $8¦$9 $5%b$9 $R$1$9%t$1$9 $8¦$9 $7%n$9";
" $7%n$9 $8-$9 $1$9%l$1$9 $8-$9 $6%a$9 $8-$9 $5%b$9 $R$8%t$9 ";
song_library_format = "{%n > }{%t}|{%f}";
song_status_format = "{%a - }{%t - }{%b}";
titles_visibility = "no";
header_visibility = "no";
statusbar_visibility = "no";
now_playing_suffix = "$8$/b";
now_playing_suffix = "$/b";
progressbar_look = " ";
};
};
@ -40,7 +42,7 @@
enable = true;
package = pkgs.unstable.beets;
settings = {
directory = "~/music";
directory = "~/media/music";
library = "~/.local/share/beets.db";
plugins = lib.concatStringsSep " " [
"mpdstats"
@ -53,7 +55,7 @@
services.mpd = {
enable = true;
network.startWhenNeeded = true;
musicDirectory = "/home/kat/music";
musicDirectory = "/home/kat/media/music";
extraConfig = ''
audio_output {
type "fifo"

View file

@ -5,12 +5,14 @@
home.packages = with pkgs; [
_1password
bitwarden
arc.pkgs.rbw-bitw
mpv
element-desktop
mumble
obs-studio
niv
xfce.ristretto
feh
duc
audacity
avidemux
vlc

View file

@ -3,7 +3,7 @@
{
imports = [
./shell.nix
./neovim
./vim
./git.nix
./tmux.nix
./ssh.nix

View file

@ -1,32 +0,0 @@
{ config, lib, pkgs, witch, ... }:
{
config = lib.mkIf config.deploy.profile.kat {
home.sessionVariables.EDITOR = "nvim";
programs.neovim = {
enable = true;
withPython3 = true;
plugins = with pkgs.vimPlugins; [
nerdtree
vim-nix
coc-nvim
coc-yank
coc-python
coc-json
coc-yaml
coc-git
vim-fugitive
{
plugin = vim-startify;
config = "let g:startify_change_to_vcs_root = 0";
}
];
extraPackages = with pkgs;
[ (python3.withPackages (ps: with ps; [ black flake8 ])) ];
extraPython3Packages = (ps: with ps; [ jedi pylint ]);
extraConfig = import ./vimrc.nix { inherit pkgs; };
};
xdg.configFile."nvim/coc-settings.json".text =
builtins.readFile ./coc-settings.json;
};
}

View file

@ -0,0 +1,34 @@
{ config, lib, pkgs, witch, ... }:
{
config = lib.mkIf config.deploy.profile.kat {
home.sessionVariables.EDITOR = "vim";
programs.vim = {
enable = true;
package = pkgs.arc.pkgs.vim_configurable-pynvim;
#withPython3 = true;
plugins = with pkgs.vimPlugins; [
nerdtree
vim-nix
coc-nvim
coc-yank
coc-python
coc-json
coc-yaml
coc-git
vim-fugitive
vim-startify
];
#extraPackages = with pkgs;
# [ (python3.withPackages (ps: with ps; [ black flake8 ])) ];
#extraPython3Packages = (ps: with ps; [ jedi pylint ]);
extraConfig = import ./vimrc.nix { inherit pkgs config; };
};
xdg.configFile = {
"vim/undo/.keep".text = "";
"vim/swap/.keep".text = "";
"vim/backup/.keep".text = "";
"nvim/coc-settings.json".text = builtins.readFile ./coc-settings.json;
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs }:
{ config, pkgs }:
''
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
@ -8,11 +8,28 @@
" Enable mouse
set mouse=a
" notmuch!
let g:notmuch_config_file='${config.xdg.configHome}/notmuch/notmuchrc'
let g:notmuch_folders_count_threads=0
let g:notmuch_date_format='%y-%m-%d %H:%M'
let g:notmuch_datetime_format='%y-%m-%d %H:%M'
let g:notmuch_show_date_format='%Y/%m/%d %H:%M'
let g:notmuch_search_date_format='%Y/%m/%d %H:%M'
let g:notmuch_html_converter='${pkgs.elinks}/bin/elinks --dump'
" Line numbers!
set number
" Open NERDTree at start
autocmd VimEnter * NERDTree | wincmd p
let g:coc_node_path='${pkgs.nodejs}/bin/node'
" idk but this means .swp isn't everywhere
set undodir=$XDG_DATA_HOME/vim/undo
set directory=$XDG_DATA_HOME/vim/swap//
set backupdir=$XDG_DATA_HOME/vim/backup
" TextEdit might fail if hidden is not set.
set hidden

View file

@ -1,7 +1,11 @@
{ sources, ... }:
{
disabledModules = [
"programs/vim.nix"
];
imports = [
./vim.nix
(sources.tf-nix + "/modules/home/secrets.nix")
(sources.arc-nixexprs + "/modules/home/weechat.nix")
];

180
modules/home/vim.nix Normal file
View file

@ -0,0 +1,180 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.vim;
defaultPlugins = [ pkgs.vimPlugins.vim-sensible ];
knownSettings = {
background = types.enum [ "dark" "light" ];
backupdir = types.listOf types.str;
copyindent = types.bool;
directory = types.listOf types.str;
expandtab = types.bool;
hidden = types.bool;
history = types.int;
ignorecase = types.bool;
modeline = types.bool;
mouse = types.enum [ "n" "v" "i" "c" "h" "a" "r" ];
mousefocus = types.bool;
mousehide = types.bool;
mousemodel = types.enum [ "extend" "popup" "popup_setpos" ];
number = types.bool;
relativenumber = types.bool;
shiftwidth = types.int;
smartcase = types.bool;
tabstop = types.int;
undodir = types.listOf types.str;
undofile = types.bool;
};
vimSettingsType = types.submodule {
options = let
opt = name: type:
mkOption {
type = types.nullOr type;
default = null;
visible = false;
};
in mapAttrs opt knownSettings;
};
setExpr = name: value:
let
v = if isBool value then
(if value then "" else "no") + name
else
"${name}=${
if isList value then concatStringsSep "," value else toString value
}";
in optionalString (value != null) ("set " + v);
plugins = let
vpkgs = pkgs.vimPlugins;
getPkg = p:
if isDerivation p then
[ p ]
else
optional (isString p && hasAttr p vpkgs) vpkgs.${p};
in concatMap getPkg cfg.plugins;
in {
options = {
programs.vim = {
enable = mkEnableOption "Vim";
package = mkOption {
type = types.package;
default = pkgs.vim_configurable;
defaultText = literalExample "pkgs.vim_configurable";
description = "The package to use for the vim binary.";
};
finalPackage = mkOption {
type = types.package;
visible = false;
readOnly = true;
description = "Resulting customized vim package.";
};
plugins = mkOption {
type = with types; listOf (either str package);
default = defaultPlugins;
example = literalExample "[ pkgs.vimPlugins.YankRing ]";
description = ''
List of vim plugins to install. To get a list of supported plugins run:
<command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A vimPlugins</command>.
</para><para>
Note: String values are deprecated, please use actual packages.
'';
};
settings = mkOption {
type = vimSettingsType;
default = { };
example = literalExample ''
{
expandtab = true;
history = 1000;
background = "dark";
}
'';
description = ''
At attribute set of Vim settings. The attribute names and
corresponding values must be among the following supported
options.
<informaltable frame="none"><tgroup cols="1"><tbody>
${concatStringsSep "\n" (mapAttrsToList (n: v: ''
<row>
<entry><varname>${n}</varname></entry>
<entry>${v.description}</entry>
</row>
'') knownSettings)}
</tbody></tgroup></informaltable>
See the Vim documentation for detailed descriptions of these
options. Note, use <varname>extraConfig</varname> to
manually set any options not listed above.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
set nocompatible
set nobackup
'';
description = "Custom .vimrc lines";
};
};
};
config = (let
customRC = ''
${concatStringsSep "\n" (filter (v: v != "") (mapAttrsToList setExpr
(builtins.intersectAttrs knownSettings cfg.settings)))}
${cfg.extraConfig}
'';
vim = cfg.package.customize {
name = "vim";
vimrcConfig = {
inherit customRC;
packages.home-manager.start = plugins;
};
};
in mkIf cfg.enable {
assertions = let
packagesNotFound =
filter (p: isString p && (!hasAttr p pkgs.vimPlugins)) cfg.plugins;
in [{
assertion = packagesNotFound == [ ];
message = "Following VIM plugin not found in pkgs.vimPlugins: ${
concatMapStringsSep ", " (p: ''"${p}"'') packagesNotFound
}";
}];
warnings = let stringPlugins = filter isString cfg.plugins;
in optional (stringPlugins != [ ]) ''
Specifying VIM plugins using strings is deprecated, found ${
concatMapStringsSep ", " (p: ''"${p}"'') stringPlugins
} as strings.
'';
home.packages = [ cfg.finalPackage ];
programs.vim = {
finalPackage = vim;
plugins = defaultPlugins;
};
});
}

View file

@ -15,6 +15,8 @@ let
clockSupport = true;
};
notmuch = super.callPackage ./notmuch { inherit (super) notmuch; };
arc = import sources.arc-nixexprs { pkgs = super; };
unstable = import sources.nixpkgs-unstable { inherit (self) config; };
nur = import sources.NUR {

26
pkgs/notmuch/default.nix Normal file
View file

@ -0,0 +1,26 @@
{ lib, notmuch, coreutils }@args: let
notmuch = args.notmuch.super or args.notmuch;
drv = notmuch.override {
withEmacs = false;
};
in drv.overrideAttrs (old: {
doCheck = false;
postInstall = ''
${old.postInstall or ""}
make -C bindings/ruby exec_prefix=$out \
SHELL=$SHELL \
$makeFlags ''${makeFlagsArray+"''${makeFlagsArray[@]}"} \
$installFlags ''${installFlagsArray+"''${installFlagsArray[@]}"} \
install
mv $out/lib/ruby/vendor_ruby/* $out/lib/ruby/
rmdir $out/lib/ruby/vendor_ruby
'';
meta = old.meta or {} // {
broken = old.meta.broken or false || notmuch.stdenv.isDarwin;
};
passthru = old.passthru or {} // {
super = notmuch;
};
})