Compare commits

...

51 commits

Author SHA1 Message Date
Trolli Schmittlauch f56bfa0eb4 git: use delta for diffing 2024-03-15 15:12:39 +01:00
Trolli Schmittlauch f0e979adf8 vscodium: add pets extension 2024-03-11 20:53:54 +01:00
Trolli Schmittlauch 9ad6106e29 git: enable rerere 2024-02-19 22:20:15 +01:00
Trolli Schmittlauch 0d8df74f86 ncdu: downgrade to _1
ncdu2 builds are broken under darwin far too often
2024-02-19 14:16:03 +01:00
Trolli Schmittlauch 356a7ee689 lnav: add as CLI tool 2024-02-10 01:02:44 +01:00
Trolli Schmittlauch 49c7a042fd direnv: prefer usage of nix-direnv over lorri 2024-02-10 00:41:19 +01:00
Trolli Schmittlauch f1d32128da add wireshark to default macos applications 2024-01-25 21:03:20 +01:00
Trolli Schmittlauch cf81c30762 add some corporate design fonts 2024-01-24 15:11:52 +01:00
Trolli Schmittlauch 6ffb11e473 nix formatting: use nixfmt 2024-01-15 11:08:12 +01:00
Trolli Schmittlauch 869d1c2942 openssh: add to packages to prefer Nix version instead of macOS vendored 2023-12-22 10:10:43 +01:00
Trolli Schmittlauch 5f212fed8c adjustments necessary for upgrading to nixpkgs 23.11 2023-12-08 00:47:09 +01:00
Trolli Schmittlauch a5a2d755ec fonts: add fira-mono 2023-11-03 13:47:32 +01:00
Trolli Schmittlauch 02baadae0d rsyncrepo: ignore mypy cache 2023-11-01 19:49:00 +01:00
Trolli Schmittlauch adcfb11f72 vscodium mypy: silence missing import checks by default 2023-10-20 21:31:56 +02:00
Trolli Schmittlauch e6b13ad7b6 vscodium: extend default python env with setuptools 2023-10-20 00:27:05 +02:00
Trolli Schmittlauch b5ac576fa9 vscodium: fix jedi-language-server by providing a default python env with it installed 2023-10-18 10:35:34 +02:00
Trolli Schmittlauch ff5e044ea0 fixup! vscodium: set default themes 2023-10-10 10:38:29 +02:00
Trolli Schmittlauch e1f16f2c71 vscodium: disable automatic Nix formatting 2023-10-10 09:48:20 +02:00
Trolli Schmittlauch 13a6dc0f66 vscodium: set default themes
it always tried to set the themes by itself at runtime
and then complained due to readonly settings
2023-10-09 10:49:56 +02:00
Trolli Schmittlauch e84b06a09e vscodium: reference black and mypy directly from nix store 2023-10-04 21:29:06 +02:00
Trolli Schmittlauch 25794fd364 vscodium black: ensure external black tooling is used 2023-10-04 19:28:35 +02:00
Trolli Schmittlauch f5b29c30dc vscodium: move mypy and black to own extensions due to deprecation 2023-10-04 16:20:18 +02:00
Trolli Schmittlauch f2917af591 add ssh-loop shell helpers for FC infra 2023-09-28 19:31:15 +02:00
Trolli Schmittlauch 651b93da89 codium: adjust python extension settings to use Jedi 2023-09-26 11:54:21 +02:00
Trolli Schmittlauch 3724058439 vscodium: init installation via home-manager 2023-09-26 01:08:06 +02:00
Trolli Schmittlauch a9a7f2bd6b fix reporsync 2023-09-02 17:51:47 +02:00
Trolli Schmittlauch 68ccdd1b00 expose 1password SSH key password to batou 2023-09-02 17:50:56 +02:00
Trolli Schmittlauch 09cad34457 jq, age: add as commonly used dev tools 2023-07-19 10:02:07 +02:00
Trolli Schmittlauch 62c250097a upgrade to nixpkgs-23.05 2023-06-01 16:40:43 +02:00
Trolli Schmittlauch ce31103112 finally add a shorthand helper script for rsyncing repos to machines 2023-06-01 16:40:43 +02:00
Trolli Schmittlauch 02da74da11 ssh-config: add RZOB jump host 2023-03-04 11:23:14 +01:00
Trolli Schmittlauch 2f9d4529d3 re-enable most graphics tools under macOS 2023-02-11 01:38:30 +01:00
Trolli Schmittlauch 24bd8861d5 install nix-helpers nix-top and statix 2023-01-27 17:39:49 +01:00
Trolli Schmittlauch 4514333301 lazygit: install 2023-01-27 17:37:25 +01:00
Trolli Schmittlauch 8c92ac91da ncdu: switch to version 1 due to zig breakages on macOS 2022-11-09 11:11:58 +01:00
Trolli Schmittlauch 6070ae7425 rename nixpkgs-review in line with upstream packaging 2022-10-30 20:33:16 +01:00
Trolli Schmittlauch db997a2eb0 vim: set cursorline highlighting 2022-09-16 17:47:22 +02:00
Trolli Schmittlauch 61af7f0a99 ssh-config: nixify flyingcircus SSH config 2022-09-14 14:43:14 +02:00
Trolli Schmittlauch 5f27edbd21 ignore macOS specific file artifacts 2022-09-14 14:27:38 +02:00
Trolli Schmittlauch ac4e42652e python: switch to nixpkgs unstable channel and unbreak httpie 2022-08-30 01:08:50 +02:00
Trolli Schmittlauch c43157c5c8 add black formatter as global python tooling 2022-08-19 13:29:33 +02:00
Trolli Schmittlauch a83bfaed3f add *some* multimedia apps to workmac profile 2022-05-31 13:17:50 +02:00
Trolli Schmittlauch d531c0e1a8 SourceCode Pro font is required for some documents 2022-05-31 11:55:15 +02:00
Trolli Schmittlauch d74fd749d0 overlay: clean up abandoned entries 2022-05-19 18:05:35 +02:00
Trolli Schmittlauch ba828329a9 vim: use ctrl-c ctrl-v clipboard, not X11 middle click one 2022-05-19 18:05:15 +02:00
Trolli Schmittlauch 94aa73b2c0 switch vim flavour to Neovim; reason: macOS clipboard support
access to system clipboard was broken in command-line vim, the buffers
"+ or "* were said not to exist and neither unnamed or unnamedplus
clipboard settings were working.

Aliases nvim to "vim"
2022-05-19 17:11:04 +02:00
Trolli Schmittlauch 847196e0a3 factor out custom vimrc into a separate file 2022-05-19 14:16:21 +02:00
Trolli Schmittlauch 7fcba96288 properly escape shell variable strings like ${var} in shell scripts 2022-05-17 18:35:03 +02:00
Trolli Schmittlauch 8c50e3a074 init nix-darwin system config
TODO: symlink creation
2022-05-17 14:39:29 +02:00
Trolli Schmittlauch 0d8baaf276 install pre-commit util 2022-05-12 23:10:32 +02:00
Trolli Schmittlauch 4b35e44873 initial adaptation for macOS work device 2022-05-12 23:10:29 +02:00
7 changed files with 462 additions and 177 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.DS_Store

View file

@ -0,0 +1,29 @@
{ config, pkgs, ... }:
{
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[ pkgs.vim
];
# Use a custom configuration.nix location.
# $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix
# environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix";
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Create /etc/bashrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# system-wide SSH configuration, used by nix-daemon for remote builders
# show hidden files
system.defaults.NSGlobalDomain.AppleShowAllFiles = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
}

View file

@ -1,9 +1,9 @@
{ pkgs, ... }:
{ pkgs, lib, config, ... }:
with pkgs;
let
# nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
unstable = import <nixos-unstable> { };
#unstable = import <nixos-unstable> { };
# nix-channel --add https://github.com/nix-community/NUR/archive/master.tar.gz NUR
nur = import <NUR> { inherit pkgs; };
myNur = nur.repos.schmittlauch;
@ -63,15 +63,14 @@ let
graphicsApps = [
inkscape
darktable
hugin
luminanceHDR
#hugin
#luminanceHDR
exiftool
gimp
xournal
#xournal # FIXME: broken on darwin-aarch64
]
++ (
with gimpPlugins; [
resynthesizer
fourier
lqrPlugin
]
@ -79,17 +78,17 @@ let
multimediaApps = [
mpv
vlc
#vlc
#amarok
clementine
elisa
#clementine
#elisa
yt-dlp
#sonic-pi
musescore
audacity
avidemux
#musescore
#audacity
#avidemux
#linphone
soundkonverter
#soundkonverter
];
cliApps = [
@ -103,9 +102,10 @@ let
lsof
mosh
openssh
sshfsFuse
sshfs-fuse
cryfs
smbnetfs # for FUSE smb mounting
#smbnetfs # for FUSE smb mounting
openssh
sshuttle
thefuck
gnupg
@ -114,22 +114,29 @@ let
p7zip
pwgen
pandoc
agrep
#agrep # FIXME: broken on darwin-aarch64
pdfgrep
torsocks
ncdu
psmisc # for killall
#torsocks # FIXME: broken on darwin-aarch64
# zig dependency breaks occasionally, stay on C version for now
ncdu_1
#psmisc # for killall
dos2unix
reptyr # re-bind running program to other tty
#reptyr # re-bind running program to other tty
xclip
unzip
myNur.lolcommits # from NUR
fswatch
#myNur.lolcommits # from NUR
jq
age
_1password
lnav
];
nixHelpers = [
lorri
nix-review
nixpkgs-fmt
nixpkgs-review
nixfmt
nix-top
statix
];
kdeTools = with plasma5Packages; with kdeGear; [
@ -171,16 +178,19 @@ let
devTools = [
curl
httpie
gdb
strace
ltrace
valgrind
zeal
#gdb
#strace
#ltrace
#valgrind
#zeal
gcc
shellcheck
mtr
ripgrep
gitui
lazygit
pre-commit
scriv
# Haskell
ghc
@ -230,6 +240,8 @@ let
numpy
matplotlib
jedi
jedi-language-server
black
flake8
mypy
];
@ -238,16 +250,23 @@ let
fonts = [
comic-neue
source-sans-pro
source-code-pro
source-serif-pro
fira-code
ubuntu_font_family
twemoji-color-font
opensans-ttf
open-sans
(iosevka-bin.override {
variant = "curly-slab";
})
myNur.vollkorn
# TODO: humor-sans
# fcio corporate design, TODO module
fira-code
fira-mono
# TODO fira-sans + condensed
# TODO museo 500
# also TODO: color schemes nix-darwin
];
games = [
@ -255,30 +274,45 @@ let
#hedgewars
];
macosTools = [
wireshark # on NixOS systems enabled via system config
];
in
{
home.packages =
desktopApps
++ latexApps
cliApps
#++ desktopApps
#++ latexApps
++ pythonApps
++ graphicsApps
++ cliApps
++ multimediaApps
++ devTools
++ kdeTools
#++ kdeTools
++ fonts
++ nixHelpers
++ games
#++ games
++ macosTools
;
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"1password-cli"
];
programs.home-manager.enable = true;
programs.home-manager.path = "$HOME/.nix-defexpr/channels/home-manager";
home.stateVersion = "18.09";
#programs.home-manager.path = "$HOME/.nix-defexpr/channels/home-manager";
home.stateVersion = "22.05";
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "os";
home.homeDirectory = "/Users/os";
programs.direnv =
{
enable = true;
nix-direnv.enable = true;
enableZshIntegration = true;
};
@ -286,21 +320,135 @@ in
# { enable = true;
# };
programs.bat.enable = true;
services.gpg-agent =
{
enable = true;
enableSshSupport = true;
pinentryFlavor = "qt";
programs.vscode = {
enable = true;
package = pkgs.vscodium;
extensions = with pkgs.vscode-extensions; [
ms-python.python
vscodevim.vim
yzhang.markdown-all-in-one
bungcip.better-toml
eamodio.gitlens
jnoortheen.nix-ide
mkhl.direnv
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "Sync-Rsync";
publisher = "vscode-ext";
version = "0.36.0";
sha256 = "sha256-0b/OHLZfXo0NAVAVkzZSqMGDzF0uvPRoiqsZtW1iOdA";
}
# TODO: probably available in nixpkgs soonish?
{
name = "mypy-type-checker";
publisher = "ms-python";
version = "2023.3.12681020";
sha256 = "sha256-rhed7CQlvxksVCGc9nPU2oYQWtXcAV5TzuG63e8Y3zM=";
}
{
name = "black-formatter";
publisher = "ms-python";
version = "2023.5.12771008";
sha256 = "sha256-lJG0RRUUMhQGs2a6oBtoqt+uY1kSJ0+cbmaP07hNh2o=";
}
{
name = "vscode-pets";
publisher = "tonybaloney";
version = "1.25.1";
sha256 = "sha256-as3e2LzKBSsiGs/UGIZ06XqbLh37irDUaCzslqITEJQ=";
}
];
userSettings = let
defaultPython = pkgs.python3.withPackages (ps: [
ps.jedi ps.jedi-language-server
ps.pip ps.setuptools # for pkg_resources
ps.black ps.mypy
]);
in {
"editor.fontLigatures" = true;
"window.autoDetectColorScheme" = true;
"workbench.preferredDarkColorTheme" = "Default Dark Modern";
"workbench.preferredLightColorTheme" = "Default Light Modern";
"[nix]" = {
"editor.insertSpaces" = true;
"editor.tabSize" = 2;
# for now, disable automatic formatting to prevent disruption of existing code bases
"editor.formatOnPaste" = false;
"editor.formatOnSave" = false;
"editor.formatOnType" = false;
};
"nix.formatterPath" = "${pkgs.nixfmt}/bin/nixfmt";
"editor.fontSize" = 13;
"editor.fontWeight" = "normal";
"git.detectSubmodulesLimit" = 30;
"[python]" = {
"breadcrumbs.showClasses" = true;
"breadcrumbs.showFunctions" = true;
"gitlens.codeLens.symbolScopes" = [
"!Module"
];
"editor.defaultFormatter" = "ms-python.black-formatter";
"editor.formatOnSave" = true;
};
"python.languageServer" = "Jedi"; # don't use proprietary pylance server
"python.defaultInterpreterPath" = "${defaultPython}/bin/python";
"black-formatter.path" = ["${pkgs.python3Packages.black}/bin/black"];
"black-formatter.importStrategy" = "fromEnvironment";
"mypy-type-checker.path" = ["${pkgs.python3Packages.mypy}/bin/mypy"];
"mypy-type-checker.importStrategy" = "fromEnvironment";
"mypy-type-checker.args" = [
"--ignore-missing-imports"
];
"gitlens.telemetry.enabled" = false;
"vim.highlightedyank.enable" = true;
"vim.history" = 500;
"vim.neovimUseConfigFile" = true;
"vim.enableNeovim" = true;
"git.suggestSmartCommit" = false;
"editor.rulers" = [ 79 ];
"vim.useSystemClipboard" = true;
"vim.smartRelativeLine" = true;
"diffEditor.ignoreTrimWhitespace" = false;
"files.associations" = {
"*.py" = "python";
};
"editor.renderWhitespace" = "all";
"editor.fontFamily" = "Iosevka Curly Slab, Menlo, Monaco, 'Courier New', monospace";
"vim.neovimPath" = "/Users/os/.nix-profile/bin/nvim";
"sync-rsync.options" = [];
};
};
programs.bat = {
enable = true;
# pinning theme is necessary until iTerm 3.5, because despite the dark terminal background, bat detects light mode and adapts theme
config.theme = "Visual Studio Dark+";
};
# services.gpg-agent =
# {
# enable = true;
# enableSshSupport = true;
# pinentryFlavor = "qt";
# };
programs.ssh =
{
enable = true;
# ssh host config
matchBlocks =
import ./secrets/ssh_hosts.nix;
matchBlocks = {
"hydra01" = {
hostname = "hydra01.fe.whq.fcio.net";
user = "os";
};
"fcio-whq-jump" = {
hostname = "vpn-whq.services.fcio.net";
extraOptions.LogLevel = "Verbose";
};
"fcio-rzob-jump" = {
hostname = "vpn-rzob.services.fcio.net";
};
};
};
programs.tmux = {
@ -319,12 +467,12 @@ in
terminal = "screen-256color";
};
systemd.user.startServices = true;
#systemd.user.startServices = true;
services.lorri.enable = true;
#services.lorri.enable = true;
# media button control support from Bluetooth devices
services.mpris-proxy.enable = true;
#services.mpris-proxy.enable = true;
fonts.fontconfig.enable = true;
@ -375,21 +523,30 @@ in
*.swo
'');
core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab";
rerere.enabled = true;
};
lfs.enable = true;
delta = {
enable = true;
options = {
line-numbers = true;
side-by-side = true;
#dark = true;
};
};
};
# shell config
programs.zsh = {
enable = true;
enableSyntaxHighlighting = true;
syntaxHighlighting.enable = true;
history.ignoreSpace = true;
initExtra = ''
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=$\{$\{(s.:.)widgets[self-insert]}[2,3]}
OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
@ -426,7 +583,9 @@ in
binpath() {
realpath $(${pkgs.which}/bin/which $1)
}
'';
''
+ (import ./scripts/reporsync.nix {inherit pkgs;})
+ (import ./scripts/ssh-loop-fc.nix {inherit pkgs;});
oh-my-zsh = {
@ -440,8 +599,10 @@ in
ipb = "ip --color --brief";
ll = "ls -l";
wavesynth = "nix-shell -p sox --run 'play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 20'";
vim = "nvim";
};
home.sessionVariables = {
EDITOR = "vim";
EDITOR = "nvim";
BATOU_AGE_IDENTITY_PASSPHRASE="op://Private/SSH key/password";
};
}

View file

@ -3,11 +3,8 @@
(
self: super:
rec {
#jami-ring-daemon = super.qt5.callPackage ./ov/jami/ring-daemon.nix {};
myVim = with super; (vim_configurable.override { python = python3; }).customize {
# executable/ package name
name = "vim";
vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; {
myVim = with super; neovim.override { configure = {
packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on start
start = [
ale
@ -27,124 +24,11 @@
vim-jinja
];
};
vimrcConfig.customRC = ''
" disable vim modelines for security reasons
set modelines=0
set nomodeline
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
set nocompatible
set hidden
" automatically close preview window after suggestion
autocmd CompleteDone * pclose
" Pathogen
"execute pathogen#infect()
"call pathogen#infect()
"call pathogen#helptags()
set statusline=%<\ %n:%f\ %m%r%y%=%-35.(line:\ %l\ of\ %L,\ col:\ %c%V\ (%P)%)
filetype plugin indent on
syntax on
set number
set mouse=a
set mousehide
set backspace=indent,eol,start
set hlsearch
set showmatch
set incsearch
set autoindent
set history=1000
" set cursorline
if has("unnamedplus")
set clipboard=unnamedplus
elseif has("clipboard")
set clipboard=unnamed
endif
" set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
" enable truecolor support
"let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
"let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
"set termguicolors
"
"let base16colorspace=256
"colorscheme base16-tomorrow-night
"colorscheme Tomorrow-Night
"colorscheme base16-default-dark
set background=dark
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:\ ,eol:¬
" default tab completion with supertab
let g:SuperTabDefaultCompletionType = "context"
" LanguageClient
" Required for operations modifying multiple buffers like rename.
set hidden
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
let g:LanguageClient_serverCommands = { 'haskell': ['hie-wrapper', '--lsp'] }
" enable LanguageClient functions only if a server mapping exists
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<cr>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
set omnifunc=LanguageClient#complete
set completefunc=LanguageClient#complete
endif
endfunction
autocmd FileType * call LC_maps()
au FileType python setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4
au FileType haskell setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
" haskell-vim
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
au FileType markdown setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4
au FileType nix setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
set ofu=syntaxcomplete#Complete
" nmap <C-V> "+gP
" imap <C-V> <ESC><C-V>a
vmap <C-C> "+y
" ALE linter settings
let g:ale_linters = { 'python': ['flake8'] }
" vim-pandoc settings
let g:pandoc#modules#disabled = ["spell"]
set textwidth=0
set wrapmargin=0
'';
};
# build with debug symbols and in debug mode (less optimized)
opencvDebug = with super; enableDebugging ((opencv3.override { enablePython = true; enableGtk3 = true; enableDocs = true; pythonPackages = pkgs.python3Packages; }).overrideAttrs (oldAttrs: rec { cmakeBuildType = "Debug"; }));
#gnutls = super.callPackage ./ov/gnutls {inherit (super.darwin.apple_sdk.frameworks) Security;};
customRC = builtins.readFile ./vimrc;
};};
# pyopenssl is broken upstream for py3.9
# inspired by https://github.com/montchr/dotfield/commit/9ec0f1d7cf4f6e3c0079c4656bf76e0daf55c5ea
httpie = self.python310Packages.httpie;
}
)

View file

@ -0,0 +1,79 @@
{pkgs, ...}:
''
# rsync -rlptzv --progress --delete --exclude=.git --exclude=.vscode --exclude=result --exclude=channels/ /Users/os/src/fc.qemu os@hydra01:
# rsync -rlptzv --progress --rsh="ssh -J fcio-whq-jump" --delete --exclude=.git --exclude=.vscode --exclude=result --exclude=channels/ /Users/os/src/fc-nixos/ os@patty:fc-nixos/
DEFAULT_JUMPHOST="fcio-whq-jump"
_parse_rsync_args() {
# reset pre-defined variables that are read and manipulated throughout this function
unset JUMPHOST
# arrays are bash or zsh specific
RSYNC_OPTS=("-rlptzv" "--progress" "--delete" "--exclude=.git" "--exclude=.vscode" "--exclude=result" "--exclude=channels/" "--exclude=.mypy_cache")
while getopts ':Jj:' OPT; do
case $OPT in
j)
if [ -n "$JUMPHOST" ]; then
echo "-j and -J are conflicting arguments" >&2
return 1
fi
JUMPHOST="$OPTARG"
;;
J)
if [ -n "$JUMPHOST" ]; then
echo "-j and -J are conflicting arguments" >&2
return 1
fi
JUMPHOST="$DEFAULT_JUMPHOST"
;;
?)
echo "rsyncrepo [-J] [-j <jumphost>] <directory> <hostname>"
return 1
;;
esac
done
# trim CLI parameters
shift "$(($OPTIND -1))"
RR_FROM="$1"
RR_TO="$2"
}
_do_rsync() {
# parameter check
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Missing arguments, required: <directory> <hostname>" >&2
return 1
fi
if [ -n "$JUMPHOST" ]; then
RSYNC_OPTS+=("--rsh=/Users/os/.nix-profile/bin/ssh -J ''${JUMPHOST}")
fi
for OPTI in "''${RSYNC_OPTS[@]}"; do
echo "$OPTI"
done
# we always sync /path/to/dir/ to hostname:dir
RR_DEST="''${2}:$(basename $(realpath "''${1}"))"
echo "Syncing ''${1} to ''${RR_DEST}"
# ensure trailing slash for src to avoid recreating directory
${pkgs.rsync}/bin/rsync "''${RSYNC_OPTS[@]}" "''${1}/" "''${RR_DEST}"
}
rsyncrepo() {
_parse_rsync_args "$@"
# inherits parsed arguments through variables
_do_rsync "$RR_FROM" "$RR_TO"
}
rsynchydra() {
_parse_rsync_args "$@"
_do_rsync "$RR_FROM" "hydra01"
}
''

View file

@ -0,0 +1,19 @@
{pkgs, ...}:
''
ssh-loop () {
setopt shwordsplit
local hosts=$1
local cmd=$2
for x in $1; do echo $x; ${pkgs.openssh}/bin/ssh $x.fcio.net -o StrictHostKeyChecking=no -C "$2"; done
}
ssh-loop-parallel () {
setopt shwordsplit
local hosts=$1
local cmd=$2
for x in $1; do echo $x; ${pkgs.openssh}/bin/ssh $x.fcio.net -o StrictHostKeyChecking=no -C "$2" 2>&1 | sed -e "s/^/$x: /;" & done
wait
}
''

112
home/vimrc Normal file
View file

@ -0,0 +1,112 @@
" disable vim modelines for security reasons
set modelines=0
set nomodeline
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
set nocompatible
set hidden
" automatically close preview window after suggestion
autocmd CompleteDone * pclose
" Pathogen
"execute pathogen#infect()
"call pathogen#infect()
"call pathogen#helptags()
set statusline=%<\ %n:%f\ %m%r%y%=%-35.(line:\ %l\ of\ %L,\ col:\ %c%V\ (%P)%)
filetype plugin indent on
syntax on
set number
set mouse=a
set mousehide
set cursorline
set backspace=indent,eol,start
set hlsearch
set showmatch
set incsearch
set autoindent
set history=1000
" use system clipboard as default buffer
" unnamedplus corresponds to the + register on Linux,
" representing system clipboard (not X11 clipboard)
set clipboard=unnamedplus
" set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
" enable truecolor support
"let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
"let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
"set termguicolors
"
"let base16colorspace=256
"colorscheme base16-tomorrow-night
"colorscheme Tomorrow-Night
"colorscheme base16-default-dark
set background=dark
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol
" default tab completion with supertab
let g:SuperTabDefaultCompletionType = "context"
" LanguageClient
" Required for operations modifying multiple buffers like rename.
set hidden
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
let g:LanguageClient_serverCommands = { 'haskell': ['hie-wrapper', '--lsp'] }
" enable LanguageClient functions only if a server mapping exists
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<cr>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
set omnifunc=LanguageClient#complete
set completefunc=LanguageClient#complete
endif
endfunction
autocmd FileType * call LC_maps()
au FileType python setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4
au FileType haskell setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
" haskell-vim
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
au FileType markdown setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4
au FileType nix setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
set ofu=syntaxcomplete#Complete
" nmap <C-V> "+gP
" imap <C-V> <ESC><C-V>a
"vmap <C-C> "+y
" ALE linter settings
let g:ale_linters = { 'python': ['flake8'] }
" vim-pandoc settings
let g:pandoc#modules#disabled = ["spell"]
set textwidth=0
set wrapmargin=0