Here is how I solved this.
At the very beginning of my
~/.emacs.d/init.el file, I set a dedicated file where
customize will store its configuration without messing up my handcrafted init file (you can use any file here, so tweak as you like):
(add-to-list 'load-path "~/.emacs.d/config")
(setq-default custom-file "~/.emacs.d/config/custom-parameters.el")
Then, I rely on
use-package directives to automatically download and configure packages I want to use. The
:ensure t keyword is what automatically takes care of installation.
I only need this short snippet to make sure
use-package is installed before everything else (because it takes care of the rest), so this comes immediately after the configuration of
package.el repositories and parameters:
(unless (package-installed-p 'use-package)
With that, I only need to copy my
~/.emacs.d directory to a new system, and at the first startup Emacs will automatically install everything.
My entire Emacs configuration is here, if you want some inspiration (and, as the license already says, use at your own risk :-).