Skip to content

Instantly share code, notes, and snippets.

@mon-jai
Last active December 27, 2022 18:55
Show Gist options
  • Save mon-jai/5a0a9e6af95e29b5cedaa51cd4f6f44d to your computer and use it in GitHub Desktop.
Save mon-jai/5a0a9e6af95e29b5cedaa51cd4f6f44d to your computer and use it in GitHub Desktop.
# https://superuser.com/a/1492456
echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" | sudo dd of="/etc/sudoers.d/$(whoami)"
sudo apt install -y wslu
# https://superuser.com/a/1568668/1172895
WINDOWS_USER_PROFILE="$(wslpath "$(wslvar USERPROFILE)")"
HOME_DICECTORY="/home/$(whoami)"
# https://askubuntu.com/a/86891
cp -vra ~/. $WINDOWS_USER_PROFILE
sudo rm -r $HOME_DICECTORY
sudo ln -s $WINDOWS_USER_PROFILE $HOME_DICECTORY
sudo chown $(whoami):$(whoami) -R $HOME_DICECTORY
sudo apt install -y clang
sudo apt install -y pkg-config libssl-dev libxcb-composite0-dev libx11-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -y
source $HOME/.cargo/env
cargo install nu --features=extra
# https://www.nushell.sh/book/installation.html#setting-the-login-shell-nix
echo $(which nu) | sudo tee -a /etc/shells > '/dev/null'
# https://unix.stackexchange.com/a/111367
sudo chsh -s "$(command -v nu)" "${USER}"
printf "alias git = git.exe\n" >> ~/.config/nushell/config.nu
printf "alias code = code-insiders\n" >> ~/.config/nushell/config.nu
printf "alias npm = npm.exe\nalias npx = npx.exe\nalias node = node.exe\n" >> ~/.config/nushell/config.nu
printf "alias docker = docker.exe\nalias docker-compose = docker-compose.exe" >> ~/.config/nushell/config.nu
sed -i 's/show_banner: true/show_banner: false/' ~/.config/nushell/config.nu
sed -i 's/def create_left_prompt/let home_directory_symlink_target = (wslpath (wslvar USERPROFILE) | str trim)\n\ndef create_left_prompt/' ~/.config/nushell/env.nu
sed -i 's/$path_segment/$path_segment | str replace --string $home_directory_symlink_target "~"/' ~/.config/nushell/env.nu
@mon-jai
Copy link
Author

mon-jai commented May 10, 2022

setopt -s glob_dots
cp -v -r ~/* "$(wslpath "$(wslvar USERPROFILE)")"

@mon-jai
Copy link
Author

mon-jai commented May 12, 2022

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | sed 's/\[\[ "\${EUID:-\${UID}}" == "0" ]]/false/' | sed 's/HOMEBREW_PREFIX_DEFAULT="\/home\/linuxbrew\/\.linuxbrew"/HOMEBREW_PREFIX_DEFAULT="\${HOME}\/.linuxbrew"/')"
sed -i 's/\[\[ "$(id -u)" == 0 ]] ||//' /root/.linuxbrew/Homebrew/Library/Homebrew/brew.sh

@mon-jai
Copy link
Author

mon-jai commented May 26, 2022

# https://github.com/nushell/nushell/issues/4771#issuecomment-1061143403
cd (if ((pwd | str trim) == "/mnt/c/Windows/system32") { "~" } else { $nu.cwd })

@mon-jai
Copy link
Author

mon-jai commented Jun 18, 2022

$path_segment | str replace (wslpath (wslvar USERPROFILE) | str trim) "~"

@mon-jai
Copy link
Author

mon-jai commented Aug 16, 2022

let-env HOMEBREW_PREFIX = "/home/linuxbrew/.linuxbrew"
let-env HOMEBREW_CELLAR = "/home/linuxbrew/.linuxbrew/Cellar"
let-env HOMEBREW_REPOSITORY = "/home/linuxbrew/.linuxbrew/Homebrew"
let-env PATH = ($env.PATH | append ":/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin")
let-env MANPATH = "/home/linuxbrew/.linuxbrew/share/man:"
let-env INFOPATH = "/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment