mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 11:13:04 +03:00
feat(*): conda -> micromamba
This commit is contained in:
parent
f588e1a9fa
commit
609fc84e43
11 changed files with 93 additions and 86 deletions
31
.bashrc
31
.bashrc
|
|
@ -112,9 +112,9 @@ alias ls="exa --icons"
|
|||
alias ll="exa -lah --icons"
|
||||
alias q="exit"
|
||||
alias c="clear"
|
||||
alias ci="init_conda"
|
||||
alias ca="conda activate"
|
||||
alias cii="export INIT_CONDA=true && init_conda"
|
||||
alias ci="init_mamba"
|
||||
alias ca="micromamba activate"
|
||||
alias cii="export INIT_MAMBA=true && init_mamba"
|
||||
# Aliases:1 ends here
|
||||
|
||||
# [[file:Console.org::*Aliases][Aliases:2]]
|
||||
|
|
@ -124,26 +124,27 @@ if [[ ! -z "$SIMPLE" ]]; then
|
|||
fi
|
||||
# Aliases:2 ends here
|
||||
|
||||
# [[file:Console.org::*Anaconda][Anaconda:1]]
|
||||
init_conda () {
|
||||
__conda_setup="$('/home/pavel/.guix-extra-profiles/dev/dev/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||
# [[file:Console.org::*Micromamba][Micromamba:1]]
|
||||
init_mamba () {
|
||||
export MAMBA_EXE="/gnu/store/w0rrglxs2247nr4wawrh5dylisjra1q4-micromamba-bin-1.4.4-0/bin/micromamba";
|
||||
export MAMBA_ROOT_PREFIX="/home/pavel/micromamba";
|
||||
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
eval "$__mamba_setup"
|
||||
else
|
||||
if [ -f "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh" ]; then
|
||||
. "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh"
|
||||
if [ -f "/home/pavel/micromamba/etc/profile.d/micromamba.sh" ]; then
|
||||
. "/home/pavel/micromamba/etc/profile.d/micromamba.sh"
|
||||
else
|
||||
# export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
|
||||
echo "what"
|
||||
export PATH="/home/pavel/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
unset __mamba_setup
|
||||
}
|
||||
|
||||
if [[ ! -z "$INIT_CONDA" ]]; then
|
||||
init_conda
|
||||
if [[ ! -z "$INIT_MAMBA" ]]; then
|
||||
init_mamba
|
||||
fi
|
||||
# Anaconda:1 ends here
|
||||
# Micromamba:1 ends here
|
||||
|
||||
# [[file:Console.org::*Starship][Starship:1]]
|
||||
if [[ -z "$SIMPLE" && "$TERM" != "dumb" ]]; then
|
||||
|
|
|
|||
|
|
@ -34,13 +34,12 @@ colors:
|
|||
Cyan: '#a3f7ff'
|
||||
White: '#ffffff'
|
||||
|
||||
background_opacity: 0.80
|
||||
|
||||
window:
|
||||
padding:
|
||||
x: 0
|
||||
y: 0
|
||||
dynamic_padding: true
|
||||
opacity: 0.80
|
||||
|
||||
key_bindings:
|
||||
- { key: Paste, action: Paste }
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ alias ls="exa --icons"
|
|||
alias ll="exa -lah --icons"
|
||||
alias q="exit"
|
||||
alias c="clear"
|
||||
alias ci="init_conda"
|
||||
alias ca="conda activate"
|
||||
alias cii="export INIT_CONDA=true && init_conda"
|
||||
alias cad="conda activate (basename (pwd))"
|
||||
alias ci="init_mamba"
|
||||
alias ca="micromamba activate"
|
||||
alias cii="export INIT_MAMBA=true && init_mamba"
|
||||
# Fish:2 ends here
|
||||
|
||||
# [[file:../../Console.org::*Fish][Fish:3]]
|
||||
|
|
@ -29,21 +28,23 @@ end
|
|||
set fish_greeting
|
||||
# Fish:4 ends here
|
||||
|
||||
# [[file:../../Console.org::*Anaconda][Anaconda:1]]
|
||||
function init_conda
|
||||
eval /home/pavel/.guix-extra-profiles/dev/dev/bin/conda "shell.fish" "hook" $argv | source
|
||||
# [[file:../../Console.org::*Micromamba][Micromamba:1]]
|
||||
function init_mamba
|
||||
set -gx MAMBA_EXE "/gnu/store/w0rrglxs2247nr4wawrh5dylisjra1q4-micromamba-bin-1.4.4-0/bin/micromamba"
|
||||
set -gx MAMBA_ROOT_PREFIX "/home/pavel/micromamba"
|
||||
$MAMBA_EXE shell hook --shell fish --prefix $MAMBA_ROOT_PREFIX | source
|
||||
end
|
||||
|
||||
if test -n "$INIT_CONDA";
|
||||
init_conda
|
||||
if test -n "$INIT_MAMBA";
|
||||
init_mamba
|
||||
end
|
||||
# Anaconda:1 ends here
|
||||
# Micromamba:1 ends here
|
||||
|
||||
# [[file:../../Console.org::*Anaconda][Anaconda:2]]
|
||||
if test -n "$EMACS_CONDA_ENV";
|
||||
conda activate $EMACS_CONDA_ENV
|
||||
end
|
||||
# Anaconda:2 ends here
|
||||
# [[file:../../Console.org::*Micromamba][Micromamba:2]]
|
||||
# if test -n "$EMACS_CONDA_ENV";
|
||||
# conda activate $EMACS_CONDA_ENV
|
||||
# end
|
||||
# Micromamba:2 ends here
|
||||
|
||||
# [[file:../../Console.org::*Colors][Colors:1]]
|
||||
set fish_color_command cyan
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
(cons*
|
||||
(channel
|
||||
(name 'channel-q)
|
||||
(url "file:///home/pavel/Code/channel-q"))
|
||||
(url "file:///home/pavel/_channel-q"))
|
||||
(channel
|
||||
(name 'flat)
|
||||
(url "https://github.com/flatwhatson/guix-channel.git")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
(specifications->manifest
|
||||
'(
|
||||
"ncdu"
|
||||
"megacmd"
|
||||
"jless"
|
||||
"jless-bin"
|
||||
"direnv"
|
||||
"glibc-locales"
|
||||
"git-lfs"
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@
|
|||
"postgresql"
|
||||
"docker-compose"
|
||||
"pandoc"
|
||||
"conda"))
|
||||
"micromamba-bin"))
|
||||
|
|
|
|||
|
|
@ -82,24 +82,11 @@
|
|||
(lambda (data)
|
||||
(message "%f Gb" (/ (float data) 1024 1024)))))
|
||||
|
||||
(use-package conda
|
||||
:straight t
|
||||
:if (executable-find "conda")
|
||||
(use-package micromamba
|
||||
:straight (:local-repo "~/10-19 Code/12 My Emacs Packages/12.12 micromamba.el")
|
||||
:if (executable-find "micromamba")
|
||||
:config
|
||||
(setq conda-anaconda-home (string-replace "/bin/conda" "" (executable-find "conda")))
|
||||
(setq conda-env-home-directory (expand-file-name "~/.conda/"))
|
||||
(setq conda-env-subdirectory "envs")
|
||||
|
||||
(advice-add 'conda-env-activate :after
|
||||
(lambda (&rest _)
|
||||
(setenv "EMACS_CONDA_ENV" conda-env-current-name)
|
||||
(setenv "INIT_CONDA" "true")))
|
||||
(advice-add 'conda-env-deactivate :after
|
||||
(lambda (&rest _)
|
||||
(setenv "EMACS_CONDA_ENV" nil)
|
||||
(setenv "INIT_CONDA" nil)))
|
||||
(unless (getenv "CONDA_DEFAULT_ENV")
|
||||
(conda-env-activate "general")))
|
||||
(micromamba-activate "general"))
|
||||
|
||||
(setq custom-file (concat user-emacs-directory "custom.el"))
|
||||
(load custom-file 'noerror)
|
||||
|
|
@ -6019,7 +6006,7 @@ base toot."
|
|||
|
||||
(defun my/ement-room-send-reaction (key position)
|
||||
(interactive (list
|
||||
(completing-read "Add reaction: " telega-emoji-reaction-list)
|
||||
(completing-read "Add reaction: " (append telega-emoji-reaction-list '("👋")))
|
||||
(point)))
|
||||
(ement-room-send-reaction key position))
|
||||
|
||||
|
|
|
|||
61
Console.org
61
Console.org
|
|
@ -374,9 +374,9 @@ alias ls="exa --icons"
|
|||
alias ll="exa -lah --icons"
|
||||
alias q="exit"
|
||||
alias c="clear"
|
||||
alias ci="init_conda"
|
||||
alias ca="conda activate"
|
||||
alias cii="export INIT_CONDA=true && init_conda"
|
||||
alias ci="init_mamba"
|
||||
alias ca="micromamba activate"
|
||||
alias cii="export INIT_MAMBA=true && init_mamba"
|
||||
#+end_src
|
||||
|
||||
#+begin_src bash
|
||||
|
|
@ -385,32 +385,36 @@ if [[ ! -z "$SIMPLE" ]]; then
|
|||
alias ll="ls -lah"
|
||||
fi
|
||||
#+end_src
|
||||
*** Anaconda
|
||||
*** Micromamba
|
||||
I've moved from conda to [[https://github.com/mamba-org/mamba][micromamba]] because it's faster.
|
||||
|
||||
#+begin_quote
|
||||
managed by 'conda init' !!!
|
||||
managed by 'mamba init' !!!
|
||||
#+end_quote
|
||||
Yeah, tell this to yourself
|
||||
|
||||
#+begin_src bash
|
||||
init_conda () {
|
||||
__conda_setup="$('/home/pavel/.guix-extra-profiles/dev/dev/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||
init_mamba () {
|
||||
export MAMBA_EXE="/gnu/store/w0rrglxs2247nr4wawrh5dylisjra1q4-micromamba-bin-1.4.4-0/bin/micromamba";
|
||||
export MAMBA_ROOT_PREFIX="/home/pavel/micromamba";
|
||||
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
eval "$__mamba_setup"
|
||||
else
|
||||
if [ -f "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh" ]; then
|
||||
. "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh"
|
||||
if [ -f "/home/pavel/micromamba/etc/profile.d/micromamba.sh" ]; then
|
||||
. "/home/pavel/micromamba/etc/profile.d/micromamba.sh"
|
||||
else
|
||||
# export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
|
||||
echo "what"
|
||||
export PATH="/home/pavel/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
unset __mamba_setup
|
||||
}
|
||||
|
||||
if [[ ! -z "$INIT_CONDA" ]]; then
|
||||
init_conda
|
||||
if [[ ! -z "$INIT_MAMBA" ]]; then
|
||||
init_mamba
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
*** Starship
|
||||
#+begin_src bash
|
||||
if [[ -z "$SIMPLE" && "$TERM" != "dumb" ]]; then
|
||||
|
|
@ -450,7 +454,6 @@ Enable vi keybindings & aliases. The alias syntax is the same as in bash, so it'
|
|||
fish_vi_key_bindings
|
||||
|
||||
<<shell-aliases>>
|
||||
alias cad="conda activate (basename (pwd))"
|
||||
#+end_src
|
||||
|
||||
|
||||
|
|
@ -469,23 +472,25 @@ Suppress fish greeting
|
|||
#+begin_src fish
|
||||
set fish_greeting
|
||||
#+end_src
|
||||
** Anaconda
|
||||
First, a function to initialize anaconda.
|
||||
** Micromamba
|
||||
First, a function to initialize micromamba.
|
||||
#+begin_src fish
|
||||
function init_conda
|
||||
eval /home/pavel/.guix-extra-profiles/dev/dev/bin/conda "shell.fish" "hook" $argv | source
|
||||
function init_mamba
|
||||
set -gx MAMBA_EXE "/gnu/store/w0rrglxs2247nr4wawrh5dylisjra1q4-micromamba-bin-1.4.4-0/bin/micromamba"
|
||||
set -gx MAMBA_ROOT_PREFIX "/home/pavel/micromamba"
|
||||
$MAMBA_EXE shell hook --shell fish --prefix $MAMBA_ROOT_PREFIX | source
|
||||
end
|
||||
|
||||
if test -n "$INIT_CONDA";
|
||||
init_conda
|
||||
if test -n "$INIT_MAMBA";
|
||||
init_mamba
|
||||
end
|
||||
#+end_src
|
||||
|
||||
Then, check if launched from Emacs with environment activated.
|
||||
#+begin_src fish
|
||||
if test -n "$EMACS_CONDA_ENV";
|
||||
conda activate $EMACS_CONDA_ENV
|
||||
end
|
||||
# if test -n "$EMACS_CONDA_ENV";
|
||||
# conda activate $EMACS_CONDA_ENV
|
||||
# end
|
||||
#+end_src
|
||||
** Colors
|
||||
Fish seems to have hardcoded colorcodes in some color settings. I set these to base16 colors, so they would match Xresources.
|
||||
|
|
@ -776,13 +781,12 @@ colors:
|
|||
Cyan: '<<get-xrdb(color="color14")>>'
|
||||
White: '<<get-xrdb(color="color15")>>'
|
||||
|
||||
background_opacity: 0.80
|
||||
|
||||
window:
|
||||
padding:
|
||||
x: 0
|
||||
y: 0
|
||||
dynamic_padding: true
|
||||
opacity: 0.80
|
||||
|
||||
key_bindings:
|
||||
- { key: Paste, action: Paste }
|
||||
|
|
@ -831,8 +835,9 @@ key_bindings:
|
|||
| git-lfs | |
|
||||
| glibc-locales | |
|
||||
| direnv | |
|
||||
| jless | JSON viewer |
|
||||
| jless-bin | JSON viewer |
|
||||
| megacmd | mega.nz client |
|
||||
| ncdu | disk usage analyzer |
|
||||
|
||||
** ripgrep config
|
||||
Occasionally I can't exclude certain files from ripgrep via the VCS settings, so here is a simple config to ignore certain files globally.
|
||||
|
|
|
|||
|
|
@ -3355,7 +3355,7 @@ This section generates manifests for various desktop software that I'm using.
|
|||
** Dev
|
||||
| Category | Guix dependency | Disabled |
|
||||
|----------+-------------------+----------|
|
||||
| dev | conda | |
|
||||
| dev | micromamba-bin | |
|
||||
| dev | pandoc | |
|
||||
| dev | docker-compose | |
|
||||
| dev | postgresql | |
|
||||
|
|
|
|||
19
Emacs.org
19
Emacs.org
|
|
@ -217,7 +217,7 @@ I have some concerns that =ps -o rss= may be unrepresentative because of [[https
|
|||
(lambda (data)
|
||||
(message "%f Gb" (/ (float data) 1024 1024)))))
|
||||
#+end_src
|
||||
** Anaconda
|
||||
** OFF Anaconda
|
||||
[[https://www.anaconda.com/][Anaconda]] is a free package and environment manager. I currently use it to manage multiple versions of Python and Node.js. Take a look at [[file:Guix.org::*conda][the corresponding entry]] in the Guix config for details about using it on Guix.
|
||||
|
||||
The following code uses the =conda= package to activate the base environment on startup if Emacs is launched outside the environment.
|
||||
|
|
@ -228,12 +228,13 @@ References:
|
|||
- [[https://docs.anaconda.com/][Anaconda docs]]
|
||||
- [[https://github.com/necaris/conda.el][conda.el repo]]
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(use-package conda
|
||||
:straight t
|
||||
:if (executable-find "conda")
|
||||
:config
|
||||
(setq conda-anaconda-home (string-replace "/bin/conda" "" (executable-find "conda")))
|
||||
(setq conda--executable-path (executable-find "micromamba"))
|
||||
(setq conda-env-home-directory (expand-file-name "~/.conda/"))
|
||||
(setq conda-env-subdirectory "envs")
|
||||
|
||||
|
|
@ -248,6 +249,18 @@ References:
|
|||
(unless (getenv "CONDA_DEFAULT_ENV")
|
||||
(conda-env-activate "general")))
|
||||
#+end_src
|
||||
** Micromamba
|
||||
[[https://github.com/mamba-org/mamba][mamba]] is a faster alternative to [[https://www.anaconda.com/][Anaconda]], a package and environment manager. =micromamba= is a tiny version that provides a subset of mamba commands.
|
||||
|
||||
=micromamba.el= is my package to interact with the latter.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package micromamba
|
||||
:straight (:local-repo "~/10-19 Code/12 My Emacs Packages/12.12 micromamba.el")
|
||||
:if (executable-find "micromamba")
|
||||
:config
|
||||
(micromamba-activate "general"))
|
||||
#+end_src
|
||||
** Config files
|
||||
*** Custom file location
|
||||
By default, =custom= writes stuff to =init.el=, which is somewhat annoying. The following makes it write to a separate file =custom.el=
|
||||
|
|
@ -1225,7 +1238,7 @@ Setting up quick access to various completions.
|
|||
"" '(:which-key "various completions")'
|
||||
;; "b" 'counsel-switch-buffer
|
||||
"b" 'persp-ivy-switch-buffer
|
||||
"e" 'conda-env-activate
|
||||
"e" 'micromamba-activate
|
||||
"f" 'project-find-file
|
||||
"c" 'counsel-yank-pop
|
||||
"a" 'counsel-rg
|
||||
|
|
|
|||
2
Guix.org
2
Guix.org
|
|
@ -127,7 +127,7 @@ References:
|
|||
(cons*
|
||||
(channel
|
||||
(name 'channel-q)
|
||||
(url "file:///home/pavel/Code/channel-q"))
|
||||
(url "file:///home/pavel/_channel-q"))
|
||||
(channel
|
||||
(name 'flat)
|
||||
(url "https://github.com/flatwhatson/guix-channel.git")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue