unify home-manager configurations of workmac and main laptop

- manually inspected changes of "workmac" branch
- modularised out some config parts into modules
This commit is contained in:
Trolli Schmittlauch 2024-03-17 19:18:53 +01:00
parent 2bdff39416
commit f14b290937
12 changed files with 875 additions and 472 deletions

View file

@ -159,11 +159,11 @@
"mysecrets": {
"flake": false,
"locked": {
"lastModified": 1618507998,
"narHash": "sha256-i5ph7JlFh8eFEnQehQaKj2SGG7WLE0DPO8R81ERGCZ0=",
"lastModified": 1710686355,
"narHash": "sha256-YcSywZx6/IMYfNax1Yx0EDLQiKsCn7glYVz1eglhbcM=",
"ref": "refs/heads/master",
"rev": "068a4759e72948284c3de85d20a780723278f8b8",
"revCount": 2,
"rev": "72d2478b720fabf69971747641230387d0df7689",
"revCount": 4,
"type": "git",
"url": "ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git"
},

View file

@ -66,19 +66,17 @@
};
mkHomeManager =
confName: user: system: # unfortunately, home-manager configs are still system-specific
# FIXME: this is thus still linux-x86_64 specific
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
{
imports = [
nur.hmModules.nur
# TODO: $name can be utilised to conditionally load other config files
./home/home.nix
./home/common.nix
./home/${confName}.nix
];
# extends the home config
home.username = user;
home.homeDirectory = "/home/${user}";
}
];
# Optionally use extraSpecialArgs
@ -108,7 +106,13 @@
lanzaboote.nixosModules.lanzaboote
];
};
homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux;
homeConfigurations = {
spiollinux-desktop = mkHomeManager "desktop" "spiollinux" systems.x86_64-linux;
os-workmac = mkHomeManager "workmac" "os" systems.aarch64-darwin;
};
lib = {
inherit mkHomeManager;
};
}
// utils.lib.eachDefaultSystem (
system:

149
home/common.nix Normal file
View file

@ -0,0 +1,149 @@
{
pkgs,
inputs,
config,
system,
...
}:
{
imports = [
./modules/packages.nix
./modules/vscodium.nix
];
home.homeDirectory =
if pkgs.stdenv.isDarwin then "/Users/${config.home.username}" else "/home/${config.home.username}";
programs.home-manager.enable = true;
programs.bat.enable = true;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
enableZshIntegration = true;
};
programs.tmux = {
enable = true;
keyMode = "vi";
extraConfig =
# for direnv not messing up the environment
''
set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
set-environment -gu DIRENV_DIFF
set-environment -gu DIRENV_DIR
set-environment -gu DIRENV_WATCHES
set-environment -gu DIRENV_LAYOUT
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel'';
terminal = "screen-256color";
};
# for backwards compatibility
services.lorri.enable = true;
fonts.fontconfig.enable = true;
programs.git = {
enable = true;
extraConfig = {
credential.helper = "cache";
push.default = "simple";
init.defaultBranch = "mainline";
diff.tool = "vimdiff";
merge.tool = "vimdiff";
core.excludesfile = toString (
pkgs.writeText ".gitignore_global" ''
# Direnv stuff
.direnv
.envrc
# Editor files #
################
*~
*.swp
*.swo
''
);
core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab";
};
lfs.enable = true;
delta = {
enable = true;
options = {
line-numbers = true;
side-by-side = true;
#dark = true;
};
};
};
# shell config
programs.zsh = {
enable = 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]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
# automatic rehash of path completion
zstyle ':completion:*' rehash true
eval "$(${pkgs.thefuck}/bin/thefuck --alias)"
## helper functions
nixify() {
if [ ! -e ./.envrc ]; then
echo "eval \"$(lorri direnv)\"" > .envrc
direnv allow
fi
if [ ! -e shell.nix ]; then
cat > shell.nix <<'EOF'
with import <nixpkgs> {};
mkShell {
buildInputs = [
bashInteractive
];
}
EOF
${"EDITOR:-vim"} default.nix
fi
}
binpath() {
realpath $(${pkgs.which}/bin/which $1)
}
'';
oh-my-zsh = {
enable = true;
theme = "bira";
plugins = [
"git"
"python"
"systemd"
"gpg-agent"
];
};
};
home.shellAliases = {
ip = "ip --color";
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 = "nvim";
};
}

81
home/desktop.nix Normal file
View file

@ -0,0 +1,81 @@
{
pkgs,
inputs,
config,
system,
...
}:
{
imports = [ ./modules/latex.nix ];
home.stateVersion = "23.11";
schmittlauch = {
packages = {
graphics = true;
multimedia = true;
nixHelpers = true;
devTools = true;
pythonTools = true;
games = true;
desktop = true;
kde = true;
};
latex.guiTools = true;
};
programs.git =
let
# TODO profile specific
contacts = import "${inputs.mysecrets}/contacts.nix";
in
{
includes =
[
{
condition = "gitdir:~/Seafile/Studium/";
contents = {
user.name = contacts.realName;
user.email = contacts.uniMail;
};
}
{
condition = "gitdir:~/src/nixpkgs/";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.nixosMail;
};
}
]
# set default name for several other common locations
++
map
(dir: {
condition = "gitdir:${dir}";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.mainMail;
};
})
[
"~/src/"
"~/bin/"
"~/tmp/"
"~/nixconfigs/"
];
};
services.gpg-agent = {
enable = true;
#enableSshSupport = true;
pinentryFlavor = "qt";
};
programs.ssh = {
enable = true;
# ssh host config
matchBlocks = (import "${inputs.mysecrets}/ssh_hosts.nix").privateHosts;
};
# media button control support from Bluetooth devices
services.mpris-proxy.enable = true;
}

View file

@ -1,462 +0,0 @@
{
pkgs,
inputs,
config,
system,
...
}:
with pkgs;
let
unstable = inputs.nixos-unstable.legacyPackages.${system};
desktopApps = [
firefox
chromium
falkon
thunderbird
calibre
dino
#zotero has open CVEs, wait for patch in Zotero7
keepassxc
ding
aspell
aspellDicts.de
aspellDicts.en
# for kate/KDE applications
hunspellDicts.de-de
hunspellDicts.en-us
hunspellDicts.en-gb-ise
seafile-client
alacritty
libreoffice-qt # fresh with KDE integration
backintime-common
anki
signal-desktop
(tor-browser-bundle-bin.override {
mediaSupport = true;
pulseaudioSupport = true;
})
pdfpc
quaternion
nheko
gpxsee
subsurface
yate
# split and merge PDFs in a GUI
pdfarranger
qbittorrent
#(pkgs.pidgin-with-plugins.override {
# plugins = [ pkgs.pidginotr ];})
logseq
# for Hibiscus banking software
jameica
#ToDo: which of these drivers is actually used?
geckodriver
chromedriver
];
graphicsApps =
[
inkscape
darktable
hugin
luminanceHDR
exiftool
gimp
xournal
]
++ (with gimpPlugins; [
fourier
lqrPlugin
]);
multimediaApps = [
mpv
vlc
#amarok
clementine
elisa
yt-dlp
#sonic-pi
musescore
tenacity
#linphone
soundkonverter
config.nur.repos.fooker.studio-link
];
cliApps = [
myVim
htop
tmux
httpie
ponysay
gti
tree
lsof
mosh
openssh
sshfs-fuse
cryfs
smbnetfs # for FUSE smb mounting
sshuttle
thefuck
gnupg
unar
lzop
p7zip
pwgen
pandoc
agrep
pdfgrep
torsocks
ncdu
psmisc # for killall
dos2unix
reptyr # re-bind running program to other tty
xclip
unzip
lnav
config.nur.repos.schmittlauch.lolcommits # from NUR
];
nixHelpers = [
nixpkgs-review
nixpkgs-fmt
nix-top
statix
nix-output-monitor
];
kdeTools =
with plasma5Packages;
with kdeGear;
[
okular
gwenview
yakuake
kmail
kontact
korganizer
akonadi-mime # for KOrganizer
kaddressbook
kdeconnect
dolphin
spectacle
kate
kleopatra
qdirstat
ark
kwalletmanager
ktouch
kcharselect
konversation
okteta
krdc
skanlite
akonadiconsole
tokodon # mastodon client
]
++ (with kdeFrameworks; [
networkmanager-qt
kcrash
breeze-gtk
]);
devTools = [
curl
httpie
gdb
strace
ltrace
valgrind
zeal
gcc
shellcheck
mtr
ripgrep
gitui
lazygit
pre-commit
# Haskell
ghc
cabal2nix
];
latexApps = [
texmaker
kile
biber
# customize texlive installation
(texlive.combine {
inherit (texlive)
scheme-medium
xetex
luatex
unicode-math
fontspec
collection-binextra
collection-fontsrecommended
collection-latex
collection-latexextra
collection-latexrecommended
collection-langgerman
moderncv
fontawesome5
academicons
acronym
ccicons
fontawesome
biblatex
logreq
koma-script
;
})
];
pythonApps = with python3Packages; [
notebook
ipython
pip
numpy
matplotlib
jedi
flake8
mypy
];
fonts = [
comic-neue
source-sans-pro
source-serif-pro
fira-code
ubuntu_font_family
twemoji-color-font
open-sans
(iosevka-bin.override { variant = "curly-slab"; })
config.nur.repos.schmittlauch.vollkorn
# TODO: humor-sans
];
games = [
superTuxKart
#hedgewars
];
in
{
nixpkgs.overlays = (import ./overlays.nix);
nixpkgs.config = {
clementine.spotify = false;
vim = {
gui = "gtk3";
python = true;
multibyteSupport = true;
};
};
home.packages =
desktopApps
++ latexApps
++ pythonApps
++ graphicsApps
++ cliApps
++ multimediaApps
++ devTools
++ kdeTools
++ fonts
++ nixHelpers
++ games;
programs.home-manager.enable = true;
home.stateVersion = "22.11";
programs.direnv = {
enable = true;
nix-direnv.enable = true;
enableZshIntegration = true;
};
# programs.vim =
# { enable = true;
# };
programs.bat.enable = true;
services.gpg-agent = {
enable = true;
#enableSshSupport = true;
pinentryFlavor = "qt";
};
programs.ssh = {
enable = true;
# ssh host config
matchBlocks = import "${inputs.mysecrets}/ssh_hosts.nix";
};
programs.tmux = {
enable = true;
keyMode = "vi";
extraConfig =
# for direnv not messing up the environment
''
set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
set-environment -gu DIRENV_DIFF
set-environment -gu DIRENV_DIR
set-environment -gu DIRENV_WATCHES
set-environment -gu DIRENV_LAYOUT
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel'';
terminal = "screen-256color";
};
systemd.user.startServices = true;
# for backwards compatibility
services.lorri.enable = true;
# media button control support from Bluetooth devices
services.mpris-proxy.enable = true;
fonts.fontconfig.enable = true;
programs.git =
let
contacts = import "${inputs.mysecrets}/contacts.nix";
in
{
enable = true;
includes =
[
{
condition = "gitdir:~/Seafile/Studium/";
contents = {
user.name = contacts.realName;
user.email = contacts.uniMail;
};
}
{
condition = "gitdir:~/src/nixpkgs/";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.nixosMail;
};
}
]
# set default name for several other common locations
++
map
(dir: {
condition = "gitdir:${dir}";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.mainMail;
};
})
[
"~/src/"
"~/bin/"
"~/tmp/"
"~/nixconfigs/"
];
extraConfig = {
credential.helper = "cache";
push.default = "simple";
init.defaultBranch = "mainline";
diff.tool = "vimdiff";
merge.tool = "vimdiff";
core.excludesfile = toString (
pkgs.writeText ".gitignore_global" ''
# Direnv stuff
.direnv
.envrc
# Editor files #
################
*~
*.swp
*.swo
''
);
core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab";
};
lfs.enable = true;
};
# shell config
programs.zsh = {
enable = 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]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
# automatic rehash of path completion
zstyle ':completion:*' rehash true
eval "$(${pkgs.thefuck}/bin/thefuck --alias)"
## helper functions
nixify() {
if [ ! -e ./.envrc ]; then
echo "eval \"$(lorri direnv)\"" > .envrc
direnv allow
fi
if [ ! -e shell.nix ]; then
cat > shell.nix <<'EOF'
with import <nixpkgs> {};
mkShell {
buildInputs = [
bashInteractive
];
}
EOF
${"EDITOR:-vim"} default.nix
fi
}
binpath() {
realpath $(${pkgs.which}/bin/which $1)
}
'';
oh-my-zsh = {
enable = true;
theme = "bira";
plugins = [
"git"
"python"
"systemd"
"gpg-agent"
];
};
};
home.shellAliases = {
ip = "ip --color";
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 = "nvim";
};
}

47
home/modules/latex.nix Normal file
View file

@ -0,0 +1,47 @@
{
pkgs,
inputs,
config,
system,
lib,
...
}:
with pkgs;
let
latexGuiTools = [
texmaker
kile
biber
];
in
{
options.schmittlauch.latex.guiTools = lib.mkEnableOption "Install GUI LaTeX tools like editors";
config.home.packages = [
(texlive.combine {
inherit (texlive)
scheme-medium
xetex
luatex
unicode-math
fontspec
collection-binextra
collection-fontsrecommended
collection-latex
collection-latexextra
collection-latexrecommended
collection-langgerman
moderncv
fontawesome5
academicons
acronym
ccicons
fontawesome
biblatex
logreq
koma-script
;
})
] ++ lib.optionals config.schmittlauch.latex.guiTools latexGuiTools;
}

284
home/modules/packages.nix Normal file
View file

@ -0,0 +1,284 @@
{
pkgs,
inputs,
config,
system,
...
}:
with pkgs;
let
cfg = config.schmittlauch.packages;
unstable = inputs.nixos-unstable.legacyPackages.${system};
graphicsApps =
[
inkscape
darktable
exiftool
gimp
]
++ (with gimpPlugins; [
fourier
lqrPlugin
])
++ lib.optionals pkgs.stdenv.isLinux [
hugin
luminanceHDR
xournal
];
multimediaApps =
[
mpv
yt-dlp
]
++ lib.optionals pkgs.stdenv.isLinux [
vlc
amarok
clementine
elisa
musescore
tenacity
soundkonverter
config.nur.repos.fooker.studio-link
];
cliApps =
[
myVim
htop
tmux
httpie
ponysay
gti
tree
lsof
mosh
openssh
sshfs-fuse
cryfs
openssh
sshuttle
thefuck
gnupg
unar
lzop
p7zip
pwgen
pandoc
pdfgrep
# zig dependency breaks occasionally, stay on C version for now
ncdu_1
dos2unix
unzip
fswatch
jq
age
lnav
nix-output-monitor # putting this here as a plain `nix` alternative
]
++ lib.optionals pkgs.stdenv.isLinux [
xclip
smbnetfs # for FUSE smb mounting
psmisc # for killall
torsocks
agrep
reptyr # re-bind running program to other tty
config.nur.repos.schmittlauch.lolcommits
];
nixHelpers = [
nixpkgs-review
unstable.nixfmt-rfc-style
nix-top
statix
];
devTools =
[
curl
httpie
gcc
shellcheck
mtr
ripgrep
gitui
lazygit
pre-commit
scriv
# Haskell
ghc
cabal2nix
]
++ lib.optionals pkgs.stdenv.isLinux [
gdb
strace
ltrace
valgrind
zeal
];
pythonTools = with python3Packages; [
notebook
ipython
pip
numpy
matplotlib
jedi
jedi-language-server
black
flake8
mypy
];
fonts = [
comic-neue
source-sans-pro
source-code-pro
source-serif-pro
ubuntu_font_family
twemoji-color-font
open-sans
(iosevka-bin.override { variant = "curly-slab"; })
config.nur.repos.schmittlauch.vollkorn
# TODO: humor-sans
# fcio corporate design, TODO module
fira-code
fira-mono
# TODO fira-sans + condensed
# TODO museo 500
];
games = [
superTuxKart
hedgewars
];
desktopApps = [
firefox
chromium
falkon
thunderbird
calibre
dino
zotero
keepassxc
ding
aspell
aspellDicts.de
aspellDicts.en
# for kate/KDE applications
hunspellDicts.de-de
hunspellDicts.en-us
hunspellDicts.en-gb-ise
seafile-client
alacritty
libreoffice-qt # fresh with KDE integration
backintime-common
anki
signal-desktop
(tor-browser-bundle-bin.override {
mediaSupport = true;
pulseaudioSupport = pkgs.stdenv.isLinux;
})
pdfpc
quaternion
nheko
gpxsee
subsurface
yate
# split and merge PDFs in a GUI
pdfarranger
qbittorrent
#(pkgs.pidgin-with-plugins.override {
# plugins = [ pkgs.pidginotr ];})
logseq
# for Hibiscus banking software
jameica
#ToDo: which of these drivers is actually used?
geckodriver
chromedriver
];
kdeTools =
with plasma5Packages;
with kdeGear;
[
okular
gwenview
yakuake
kmail
kontact
korganizer
akonadi-mime # for KOrganizer
kaddressbook
kdeconnect
dolphin
spectacle
kate
kleopatra
qdirstat
ark
kwalletmanager
ktouch
kcharselect
konversation
okteta
krdc
skanlite
akonadiconsole
tokodon # mastodon client
]
++ (with kdeFrameworks; [
networkmanager-qt
kcrash
breeze-gtk
]);
in
{
options.schmittlauch.packages = {
graphics = lib.mkEnableOption "Enable a common set of graphics apps";
multimedia = lib.mkEnableOption "Enable a common set of multimedia apps";
cli = lib.mkOption {
description = "Enable a common set of CLI tools";
type = lib.types.bool;
default = true;
};
nixHelpers = lib.mkEnableOption "Enable a common set of Nix helper tools";
devTools = lib.mkEnableOption "Enable a common set of dev tools";
pythonTools = lib.mkEnableOption "Enable a common set of python tools";
games = lib.mkEnableOption "Enable some games";
desktop = lib.mkEnableOption "Enable a common set of desktop applications";
kde = lib.mkEnableOption "Enable a common set of KDE applications";
};
# TODO fonts in separate module
# TODO latex in separate module
config = {
home.packages = lib.flatten (
(lib.optional cfg.graphics graphicsApps)
++ (lib.optional cfg.multimedia multimediaApps)
++ (lib.optional cfg.cli cliApps)
++ (lib.optional cfg.nixHelpers nixHelpers)
++ (lib.optional cfg.devTools devTools)
++ (lib.optional cfg.pythonTools pythonTools)
++ (lib.optional cfg.games games)
++ (lib.optional cfg.desktop desktopApps)
++ (lib.optional cfg.kde kdeTools)
);
nixpkgs.overlays = import ../overlays.nix;
nixpkgs.config = {
clementine.spotify = false;
vim = {
gui = "gtk3";
python = true;
multibyteSupport = true;
};
};
};
}

111
home/modules/vscodium.nix Normal file
View file

@ -0,0 +1,111 @@
{
pkgs,
inputs,
config,
system,
...
}:
{
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" = [ ];
};
};
}

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
}
''

@ -1 +1 @@
Subproject commit 068a4759e72948284c3de85d20a780723278f8b8
Subproject commit 72d2478b720fabf69971747641230387d0df7689

91
home/workmac.nix Normal file
View file

@ -0,0 +1,91 @@
{
pkgs,
inputs,
config,
system,
...
}:
with pkgs;
let
unstable = inputs.nixos-unstable.legacyPackages.${system};
in
{
schmittlauch.packages = {
graphics = true;
multimedia = true;
nixHelpers = true;
devTools = true;
pythonTools = true;
games = true;
desktop = true;
kde = true;
};
home.packages = [
wireshark # on NixOS systems enabled via system config
_1password
# also TODO: color schemes nix-darwin
];
# pinning theme is necessary until iTerm 3.5, because despite the dark terminal background, bat detects light mode and adapts theme
programs.bat.config.theme = "Visual Studio Dark+";
programs.ssh = {
enable = true;
# ssh host config
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.git =
let
contacts = import ./secrets/contacts.nix;
in
{
includes =
[
{
condition = "gitdir:~/src/schmittlauch/";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.nixosMail;
};
}
]
# set default name for several other common locations
++
map
(dir: {
condition = "gitdir:${dir}";
contents = {
user.name = contacts.realName;
user.email = contacts.fcioMail;
};
})
[
"~/src/"
"~/bin/"
"~/tmp/"
];
};
# some extra shell scripts
programs.zsh.initExtra =
lib.mkAfter (import ./scripts/reporsync.nix { inherit pkgs; })
+ (import ./scripts/ssh-loop-fc.nix { inherit pkgs; });
home.stateVersion = "22.05";
}