nix-community / nix-on-droid

Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]
https://nix-on-droid.unboiled.info
MIT License
1.15k stars 65 forks source link

huh(home manger error #368

Closed Greenarrow4245 closed 4 weeks ago

Greenarrow4245 commented 4 weeks ago

Screenshot_20240603_102811_Nix.png

Greenarrow4245 commented 4 weeks ago

forgot to mention this error occurred when I put this in my .bashrc (made by gpt 4o)

~/.bashrc: executed by bash(1) for non-login shells.

If not running interactively, don't do anything

case $- in i) ;; *) return;; esac

Enable Nix command if available

if [ -e /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh ]; then . /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh fi

don't put duplicate lines or lines starting with space in the history.

See bash(1) for more options

HISTCONTROL=ignoreboth

append to the history file, don't overwrite it

shopt -s histappend

for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

HISTSIZE=1000 HISTFILESIZE=2000

check the window size after each command and, if necessary,

update the values of LINES and COLUMNS.

shopt -s checkwinsize

Enable bash completion for Nix

if [ -e /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh ]; then . /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh fi

Prompt customization

case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac

if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then color_prompt=yes else color_prompt= fi fi

if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}[\033[01;31m]\u[\033[00m]@[\033[01;32m]\h[\033[00m]:[\033[01;34m]\w[\033[00m]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt

If this is an xterm set the title to user@host:dir

case "$TERM" in xterm|rxvt) PS1="[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a]$PS1" ;; *) ;; esac

enable color support of ls and also add handy aliases

if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto'

alias dir='dir --color=auto'

#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

fi

colored GCC warnings and errors

export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

some more ls aliases

alias ll='ls -alF' alias la='ls -A' alias l='ls -CF'

Add an "alert" alias for long running commands. Use like so:

sleep 10; alert

alias alert='notify-send --urgency=low -i "$(test $? -eq 0 && echo terminal || echo error)" "$(history | tail -n1 | sed -e "s/^[ ][0-9]+[ ]//;s/[;&|][ ]*alert$//")"'

Alias definitions.

You may want to put all your additions into a separate file like

~/.bash_aliases, instead of adding them here directly.

See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi

enable programmable completion features (you don't need to enable

this, if it's already enabled in /etc/bash.bashrc and /etc/profile

sources /etc/bash.bashrc).

if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi

Add Nix profiles to PATH

if [ -d "$HOME/.nix-profile/bin" ]; then export PATH="$HOME/.nix-profile/bin:$PATH" fi

Nix environment variables

export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH export NIX_REMOTE=daemon

Load the NixOS environment variables

if [ -f /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh ]; then . /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh fi

Source NixOS environment

if [ -f ~/.nix-profile/etc/profile.d/nix.sh ]; then . ~/.nix-profile/etc/profile.d/nix.sh fi

Nix command auto-completion

if [ -e $HOME/.nix-profile/etc/bash_completion.d/nix ]; then . $HOME/.nix-profile/etc/bash_completion.d/nix fi

and .bash_profile

~/.bash_profile: executed by bash(1) for login shells.

Source the user's bashrc if it exists

if [ -f ~/.bashrc ]; then . ~/.bashrc fi

Enable nix command if available

if [ -e /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh ]; then . /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh fi

Add Nix profiles to PATH

if [ -d "$HOME/.nix-profile/bin" ]; then export PATH="$HOME/.nix-profile/bin:$PATH" fi

Nix environment variables

export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH export NIX_REMOTE=daemon

Load NixOS environment variables

if [ -f /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh ]; then . /data/data/com.termux.nix/files/usr/etc/profile.d/nix.sh fi

Source NixOS environment

if [ -f ~/.nix-profile/etc/profile.d/nix.sh ]; then . ~/.nix-profile/etc/profile.d/nix.sh fi

Nix command auto-completion

if [ -e $HOME/.nix-profile/etc/bash_completion.d/nix ]; then . $HOME/.nix-profile/etc/bash_completion.d/nix fi

Set default editor to nano or vim, as per user preference

export EDITOR=nano

export EDITOR=vim

Set less options

export LESS=-R

Set up locale environment variables

export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8

Set up XDG directories (useful if you use graphical applications)

export XDG_CONFIG_HOME=$HOME/.config export XDG_CACHE_HOME=$HOME/.cache export XDG_DATA_HOME=$HOME/.local/share

Set up some environment variables for Java development (if applicable)

export JAVA_HOME=/usr/lib/jvm/default

export PATH=$JAVA_HOME/bin:$PATH

Add custom paths for user-installed software

if [ -d "$HOME/.local/bin" ]; then export PATH="$HOME/.local/bin:$PATH" fi

if [ -d "$HOME/bin" ]; then export PATH="$HOME/bin:$PATH" fi

PS1 prompt customization with colors

Color codes:

[\033[01;31m] - Red (username)

[\033[01;32m] - Green (hostname)

[\033[01;34m] - Blue (current directory)

[\033[00m] - Reset to default

case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac

if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then color_prompt=yes else color_prompt= fi fi

if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}[\033[01;31m]\u[\033[00m]@[\033[01;32m]\h[\033[00m]:[\033[01;34m]\w[\033[00m]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt

t184256 commented 4 weeks ago

error: cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Connection refused

export NIX_REMOTE=daemon

Case closed, it broke because you broke it.

this error occurred when I put this in my .bashrc (made by gpt 4o)

Look, I can't stop you from inputting garbage from a hallucinating plagiarism machine into my software, but at least don't ask me why it's broken when you do.

Greenarrow4245 commented 4 weeks ago

error: cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Connection refused

export NIX_REMOTE=daemon

Case closed, it broke because you broke it.

this error occurred when I put this in my .bashrc (made by gpt 4o)

Look, I can't stop you from inputting garbage from a hallucinating plagiarism machine into my software, but at least don't ask me why it's broken when you do.

I found out that the .bashrc and .bash_profile are the problem I should have keep it simple

t184256 commented 4 weeks ago

My problem is that you're filing tickets suggesting something's wrong with nix-on-droid while it's not. If you want to see how it behaves with a hallucinated up .bashrc, feel free to, just don't waste my time in the process.