This commit is contained in:
Dmitriy Kholkin 2022-08-18 20:22:52 +03:00
parent df75d3efe4
commit 71296f5a7d
2 changed files with 120 additions and 115 deletions

View File

@ -19,6 +19,14 @@ with config.deviceSpecific; {
decrypted = "/root/.ssh/ssh-builder"; decrypted = "/root/.ssh/ssh-builder";
}; };
programs.ssh.extraConfig = ''
Host nix-builder
hostname 192.168.0.100
user alukard
identitiesOnly yes
identityFile ${config.secrets.ssh-builder.decrypted}
'';
home-manager.users.alukard = { home-manager.users.alukard = {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@ -46,12 +54,6 @@ with config.deviceSpecific; {
hostname = "192.168.0.100"; hostname = "192.168.0.100";
user = "alukard"; user = "alukard";
}; };
"nix-builder" = {
hostname = "192.168.0.100";
user = "alukard";
identitiesOnly = true;
identityFile = config.secrets.ssh-builder.decrypted;
};
}; };
extraConfig = '' extraConfig = ''
Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye" Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye"

View File

@ -1,126 +1,129 @@
{ pkgs, config, inputs, ... }: { { pkgs, config, inputs, ... }: {
environment.pathsToLink = [ "/share/zsh" ]; environment.pathsToLink = [ "/share/zsh" ];
environment.sessionVariables.SHELL = "zsh"; environment.sessionVariables.SHELL = "${pkgs.zsh}/bin/zsh";
home-manager.users.alukard.programs = { home-manager.users.alukard = {
zsh = { home.sessionVariables.SHELL = "${pkgs.zsh}/bin/zsh";
enable = true; programs = {
enableAutosuggestions = true; zsh = {
enableCompletion = true;
oh-my-zsh = {
enable = true; enable = true;
theme = "agnoster"; enableAutosuggestions = true;
plugins = [ "git" "dirhistory" ]; enableCompletion = true;
}; oh-my-zsh = {
plugins = [ enable = true;
# { theme = "agnoster";
# name = "zsh-nix-shell"; plugins = [ "git" "dirhistory" ];
# file = "nix-shell.plugin.zsh"; };
# src = inputs.zsh-nix-shell; plugins = [
# } # {
{ # name = "zsh-nix-shell";
name = "zsh-autosuggestions"; # file = "nix-shell.plugin.zsh";
src = inputs.zsh-autosuggestions; # src = inputs.zsh-nix-shell;
} # }
{ {
name = "you-should-use"; name = "zsh-autosuggestions";
src = inputs.zsh-you-should-use; src = inputs.zsh-autosuggestions;
} }
]; {
name = "you-should-use";
src = inputs.zsh-you-should-use;
}
];
dotDir = ".config/zsh"; dotDir = ".config/zsh";
history = rec { history = rec {
size = 1000000; size = 1000000;
save = size; save = size;
path = "$HOME/.local/share/zsh/history"; path = "$HOME/.local/share/zsh/history";
}; };
envExtra = '' envExtra = ''
SHELL="${pkgs.zsh}/bin/zsh"; SHELL="${pkgs.zsh}/bin/zsh";
''; '';
shellAliases = { shellAliases = {
"clr" = "clear"; "clr" = "clear";
"weather" = "curl wttr.in/Volzhskiy"; "weather" = "curl wttr.in/Volzhskiy";
"rede" = "systemctl --user start gammastep.service &"; "rede" = "systemctl --user start gammastep.service &";
"redd" = "systemctl --user stop gammastep.service &"; "redd" = "systemctl --user stop gammastep.service &";
"show-packages" = "_ nix-store -q --references /run/current-system/sw"; "show-packages" = "_ nix-store -q --references /run/current-system/sw";
"nsp" = "nix-shell --run zsh -p"; "nsp" = "nix-shell --run zsh -p";
"nd" = "nix develop"; "nd" = "nix develop";
"nb" = "nix build"; "nb" = "nix build";
"nr" = "nix run"; "nr" = "nix run";
"e" = "$EDITOR"; "e" = "$EDITOR";
"q" = "qalc"; "q" = "qalc";
# "grep" = "${pkgs.ripgrep}/bin/rg"; # "grep" = "${pkgs.ripgrep}/bin/rg";
"man" = "${pkgs.pinfo}/bin/pinfo"; "man" = "${pkgs.pinfo}/bin/pinfo";
"l" = "exa -lahgF@ --git --group-directories-first"; "l" = "exa -lahgF@ --git --group-directories-first";
"tree" = "exa -T"; "tree" = "exa -T";
"ltree" = "exa -lhgFT@ --git"; "ltree" = "exa -lhgFT@ --git";
"atree" = "exa -aT"; "atree" = "exa -aT";
"latree" = "exa -lahgFT@ --git"; "latree" = "exa -lahgFT@ --git";
# "gif2webm" = "(){ ${pkgs.ffmpeg.bin}/bin/ffmpeg -i $1 -c:v libvpx-vp9 -crf 20 -b:v 0 $1.webm ;}"; # "gif2webm" = "(){ ${pkgs.ffmpeg.bin}/bin/ffmpeg -i $1 -c:v libvpx-vp9 -crf 20 -b:v 0 $1.webm ;}";
"hpc" = "bluetoothctl connect D8:37:3B:60:5D:55"; "hpc" = "bluetoothctl connect D8:37:3B:60:5D:55";
"hpd" = "bluetoothctl disconnect D8:37:3B:60:5D:55"; "hpd" = "bluetoothctl disconnect D8:37:3B:60:5D:55";
}; };
initExtra = '' initExtra = ''
nixify() { nixify() {
if [ ! -e ./.envrc ]; then if [ ! -e ./.envrc ]; then
echo 'use flake' > .envrc echo 'use flake' > .envrc
direnv allow direnv allow
fi fi
if [ ! -e flake.nix ]; then if [ ! -e flake.nix ]; then
cat > flake.nix <<'EOF' cat > flake.nix <<'EOF'
{ {
description = "shell environment"; description = "shell environment";
inputs = { inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
};
outputs = { self, nixpkgs, ... }@inputs: {
devShell.x86_64-linux = let
pkgs = import nixpkgs { config.allowUnfree = true; localSystem = "x86_64-linux"; };
in pkgs.mkShell {
nativeBuildInputs = [ ];
buildInputs = with pkgs; [ ];
shellHook = "";
}; };
};
}
EOF
fi
}
rga-fzf() { outputs = { self, nixpkgs, ... }@inputs: {
RG_PREFIX="rga --files-with-matches" devShell.x86_64-linux = let
local file pkgs = import nixpkgs { config.allowUnfree = true; localSystem = "x86_64-linux"; };
file="$( in pkgs.mkShell {
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \ nativeBuildInputs = [ ];
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \ buildInputs = with pkgs; [ ];
--phony -q "$1" \ shellHook = "";
--bind "change:reload:$RG_PREFIX {q}" \ };
--preview-window="70%:wrap" };
)" && }
echo "opening $file" && EOF
xdg-open "$file" fi
} }
manix-fzf() {
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix
}
XDG_DATA_DIRS=$XDG_DATA_DIRS:$GSETTINGS_SCHEMAS_PATH rga-fzf() {
RG_PREFIX="rga --files-with-matches"
local file
file="$(
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
--phony -q "$1" \
--bind "change:reload:$RG_PREFIX {q}" \
--preview-window="70%:wrap"
)" &&
echo "opening $file" &&
xdg-open "$file"
}
manix-fzf() {
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix
}
source ${pkgs.nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh XDG_DATA_DIRS=$XDG_DATA_DIRS:$GSETTINGS_SCHEMAS_PATH
fpath=(${pkgs.nix-zsh-completions}/share/zsh/site-functions $fpath)
autoload -U compinit && compinit
'';
};
fzf = { source ${pkgs.nix-zsh-completions}/share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh
enable = true; fpath=(${pkgs.nix-zsh-completions}/share/zsh/site-functions $fpath)
enableBashIntegration = true; autoload -U compinit && compinit
enableZshIntegration = true; '';
};
fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}; };
}; };
} }