aaaaa
This commit is contained in:
parent
003c1d71f8
commit
f17cbde666
@ -83,13 +83,16 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 8080 ];
|
networking.firewall.enable = false; #.allowedTCPPorts = [ 8080 ];
|
||||||
networking.extraHosts = ''
|
networking.extraHosts = ''
|
||||||
86.95.92.180 apprise.prod.gaiaplant.app
|
86.95.92.180 apprise.prod.gaiaplant.app
|
||||||
192.145.59.184 marshallingyard.steph.tools
|
192.145.59.184 marshallingyard.steph.tools
|
||||||
'';
|
'';
|
||||||
|
|
||||||
services.avahi.enable = false;
|
services.avahi.enable = true;
|
||||||
|
services.minidlna.settings.enable = true;
|
||||||
|
services.minidlna.settings.media_dir = [
|
||||||
|
"/media" ];
|
||||||
|
|
||||||
virtualisation.podman.enable = true;
|
virtualisation.podman.enable = true;
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
@ -106,6 +109,7 @@
|
|||||||
vistafonts
|
vistafonts
|
||||||
];
|
];
|
||||||
|
|
||||||
|
environment.localBinInPath = true;
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
podman
|
podman
|
||||||
docker-compose
|
docker-compose
|
||||||
|
98
git-identity.sh
Executable file
98
git-identity.sh
Executable file
@ -0,0 +1,98 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
IFS=""
|
||||||
|
|
||||||
|
function print_menu() # selected_item, ...menu_items
|
||||||
|
{
|
||||||
|
local function_arguments=($@)
|
||||||
|
|
||||||
|
local selected_item="$1"
|
||||||
|
local menu_items=(${function_arguments[@]:1})
|
||||||
|
local menu_size="${#menu_items[@]}"
|
||||||
|
|
||||||
|
for (( i = 0; i < $menu_size; ++i ))
|
||||||
|
do
|
||||||
|
if [ "$i" = "$selected_item" ]
|
||||||
|
then
|
||||||
|
echo -e "\033[1;34m > \033[0m\e[1m${menu_items[i]}\033[0m"
|
||||||
|
else
|
||||||
|
echo " ${menu_items[i]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_menu() # selected_item, ...menu_items
|
||||||
|
{
|
||||||
|
local function_arguments=($@)
|
||||||
|
|
||||||
|
local selected_item="$1"
|
||||||
|
local menu_items=(${function_arguments[@]:1})
|
||||||
|
local menu_size="${#menu_items[@]}"
|
||||||
|
local menu_limit=$((menu_size - 1))
|
||||||
|
|
||||||
|
print_menu "$selected_item" "${menu_items[@]}"
|
||||||
|
|
||||||
|
while read -rsn1 input
|
||||||
|
do
|
||||||
|
case "$input"
|
||||||
|
in
|
||||||
|
$'\x1B') # ESC ASCII code (https://dirask.com/posts/ASCII-Table-pJ3Y0j)
|
||||||
|
read -rsn1 -t 0.1 input
|
||||||
|
if [ "$input" = "[" ] # occurs before arrow code
|
||||||
|
then
|
||||||
|
read -rsn1 -t 0.1 input
|
||||||
|
case "$input"
|
||||||
|
in
|
||||||
|
A) # Up Arrow
|
||||||
|
if [ "$selected_item" -ge 1 ]
|
||||||
|
then
|
||||||
|
selected_item=$((selected_item - 1))
|
||||||
|
echo -en "\033[s\033[${menu_size}A"
|
||||||
|
print_menu "$selected_item" "${menu_items[@]}"
|
||||||
|
echo -en "\033[u\033[0m"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
B) # Down Arrow
|
||||||
|
if [ "$selected_item" -lt "$menu_limit" ]
|
||||||
|
then
|
||||||
|
selected_item=$((selected_item + 1))
|
||||||
|
echo -en "\033[s\033[${menu_size}A"
|
||||||
|
print_menu "$selected_item" "${menu_items[@]}"
|
||||||
|
echo -en "\033[u\033[0m"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
read -rsn5 -t 0.1 # flushing stdin
|
||||||
|
;;
|
||||||
|
"") # Enter key
|
||||||
|
return "$selected_item"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Usage example:
|
||||||
|
|
||||||
|
selected_item=0
|
||||||
|
menu_items=("Stephan Stanisic <s.stanisic@student.uu.nl>"
|
||||||
|
"Stephan Stanisic <s.stanisic@ru.nl>"
|
||||||
|
"Stephan Stanisic <stephan@stanisic.nl>"
|
||||||
|
"Steph <steph+noreply@code.steph.tools>")
|
||||||
|
|
||||||
|
run_menu "$selected_item" "${menu_items[@]}"
|
||||||
|
menu_result="$?"
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
sel=${menu_items[$menu_result]}
|
||||||
|
|
||||||
|
name=$(echo $sel | cut -d \< -f 1 | head -c -2)
|
||||||
|
email=$(echo $sel | cut -d \< -f 2 | head -c -2)
|
||||||
|
|
||||||
|
echo "Setting username to $name and email to $email"
|
||||||
|
|
||||||
|
git config user.email "$email"
|
||||||
|
git config user.name "$name"
|
||||||
|
|
5
home.nix
5
home.nix
@ -64,6 +64,7 @@
|
|||||||
entr
|
entr
|
||||||
pandoc
|
pandoc
|
||||||
texliveFull
|
texliveFull
|
||||||
|
steam
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
@ -121,5 +122,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
home.file.".background-image".source = "${./.}/Morskie Oko.jpg";
|
home.file.".background-image".source = "${./.}/Morskie Oko.jpg";
|
||||||
|
home.file.".local/bin/git-identity" = {
|
||||||
|
executable = true;
|
||||||
|
source = "${./git-identity.sh}";
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,5 +44,6 @@ $NEW_PROMPT_COMMAND"
|
|||||||
programs.bash.sessionVariables = {
|
programs.bash.sessionVariables = {
|
||||||
NIX_SHELL_PRESERVE_PROMPT = 1;
|
NIX_SHELL_PRESERVE_PROMPT = 1;
|
||||||
NIXPKGS_ALLOW_UNFREE = 1;
|
NIXPKGS_ALLOW_UNFREE = 1;
|
||||||
|
HISTCONTROL = "ignoreboth:erasedups";
|
||||||
};
|
};
|
||||||
}
|
}
|
115
programs/git-identity.nix
Normal file
115
programs/git-identity.nix
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
{ pkgs, lib, config, specialArgs, options, modulesPath }:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
git-identity = (writeShellApplication {
|
||||||
|
name = "git-identity";
|
||||||
|
text = ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
IFS=""
|
||||||
|
|
||||||
|
function print_menu() # selected_item, ...menu_items
|
||||||
|
{
|
||||||
|
local function_arguments=("''$@")
|
||||||
|
|
||||||
|
local selected_item="''$1"
|
||||||
|
local menu_items=("''${function_arguments[@]:1}")
|
||||||
|
local menu_size="''${#menu_items[@]}"
|
||||||
|
|
||||||
|
for (( i = 0; i < menu_size; ++i ))
|
||||||
|
do
|
||||||
|
if [ "''$i" = "''$selected_item" ]
|
||||||
|
then
|
||||||
|
echo -e "\033[1;34m > \033[0m\e[1m''${menu_items[i]}\033[0m"
|
||||||
|
else
|
||||||
|
echo " ''${menu_items[i]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_menu() # selected_item, ...menu_items
|
||||||
|
{
|
||||||
|
local function_arguments=("''$@")
|
||||||
|
|
||||||
|
local selected_item="''$1"
|
||||||
|
local menu_items=("''${function_arguments[@]:1}")
|
||||||
|
local menu_size="''${#menu_items[@]}"
|
||||||
|
local menu_limit=''$((menu_size - 1))
|
||||||
|
|
||||||
|
print_menu "''$selected_item" "''${menu_items[@]}"
|
||||||
|
|
||||||
|
while read -rsn1 input
|
||||||
|
do
|
||||||
|
case "''$input"
|
||||||
|
in
|
||||||
|
''$'\x1B') # ESC ASCII code (https://dirask.com/posts/ASCII-Table-pJ3Y0j)
|
||||||
|
read -rsn1 -t 0.1 input
|
||||||
|
if [ "''$input" = "[" ] # occurs before arrow code
|
||||||
|
then
|
||||||
|
read -rsn1 -t 0.1 input
|
||||||
|
case "''$input"
|
||||||
|
in
|
||||||
|
A) # Up Arrow
|
||||||
|
if [ "''$selected_item" -ge 1 ]
|
||||||
|
then
|
||||||
|
selected_item=''$((selected_item - 1))
|
||||||
|
echo -en "\033[s\033[''${menu_size}A"
|
||||||
|
print_menu "''$selected_item" "''${menu_items[@]}"
|
||||||
|
echo -en "\033[u\033[0m"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
B) # Down Arrow
|
||||||
|
if [ "''$selected_item" -lt "''$menu_limit" ]
|
||||||
|
then
|
||||||
|
selected_item=''$((selected_item + 1))
|
||||||
|
echo -en "\033[s\033[''${menu_size}A"
|
||||||
|
print_menu "''$selected_item" "''${menu_items[@]}"
|
||||||
|
echo -en "\033[u\033[0m"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
read -rsn5 -t 0.1 # flushing stdin
|
||||||
|
;;
|
||||||
|
"") # Enter key
|
||||||
|
echo "enter key"
|
||||||
|
return "''$selected_item"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Usage example:
|
||||||
|
|
||||||
|
selected_item=0
|
||||||
|
menu_items=("Stephan Stanisic <s.stanisic@student.uu.nl>"
|
||||||
|
"Stephan Stanisic <s.stanisic@ru.nl>"
|
||||||
|
"Stephan Stanisic <stephan@stanisic.nl>"
|
||||||
|
"Steph <steph+noreply@code.steph.tools>")
|
||||||
|
|
||||||
|
run_menu "''$selected_item" "''${menu_items[@]}"
|
||||||
|
menu_result="''$?"
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
sel=''${menu_items[''$menu_result]}
|
||||||
|
|
||||||
|
name=''$(echo "''$sel" | cut -d \< -f 1 | head -c -2)
|
||||||
|
email=''$(echo "''$sel" | cut -d \< -f 2 | head -c -2)
|
||||||
|
|
||||||
|
echo "Setting username to ''$name and email to ''$email"
|
||||||
|
|
||||||
|
git config user.email "''$email"
|
||||||
|
git config user.name "''$name"
|
||||||
|
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ git-identity ];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user