Question: What should I put in the preamble (preferably packages) for this to work as expected with its unicode characters?

```
\documentclass{article}
\usepackage{listings}
\begin{document}
  $α$ α
  \begin{lstlisting}
     α = 1.;
  \end{lstlisting}
\end{document}

```

Note that alpha (α) appears in three contexts: as text, as math and as code (listings).

(I can use `lualatex` if it simplifies things)

---

For a higher challenge, in this case I introduce a second level of difficulty, by introducing a second kind of alpha (: 0x1d6fc Mathematical italic small alpha vs. α: Greek small letter alpha). To see to what degree TeX can deal with the nuance (e.g. by make into $\alpha$, or by making --0x1D45D Mathematical italic small p-- into $p$):

```
\documentclass[]{article}
\usepackage[]{listings}
\begin{document}
$α$ α $$  
\begin{lstlisting}
α = 1.
 = 2.
\end{lstlisting}
\end{document}

```

Answer: 
For the `listings` part of the question, you'll need something like the following (adapting the answers from the questions that @morbusg pointed to).
This works in `xelatex`. I agree with @morbusg that the tricky part will be to find fonts that contain your glyphs, especially typewriter and math fonts.

```
\documentclass{article}
\usepackage{fontspec}
\setmainfont{FreeSerif}
\usepackage{listings}
\lstset{inputencoding=utf8,extendedchars=true}
\makeatletter
\lst@InputCatcodes
\def\lst@DefEC{%
 \lst@CCECUse \lst@ProcessLetter
  ^^^^03b1% α
  ^^^^^^01d6fc% 
  ^^^^^^01d45d% 
  ^^00}
\lst@RestoreCatcodes
\makeatother
\begin{document}
\begin{lstlisting}
α = 1.
 = 2.
 = 3.
\end{lstlisting}
\end{document}

```
You can use [unicode-math](/questions/tagged/unicode-math "show questions tagged 'unicode-math'") and [fontspec](/questions/tagged/fontspec "show questions tagged 'fontspec'") packages for use with [xelatex](/questions/tagged/xelatex "show questions tagged 'xelatex'") and [lualatex](/questions/tagged/lualatex "show questions tagged 'lualatex'"), but unfortunately [listings](/questions/tagged/listings "show questions tagged 'listings'") doesn't work with [unicode](/questions/tagged/unicode "show questions tagged 'unicode'") so it has been suggested on this site to use packages like [minted](/questions/tagged/minted "show questions tagged 'minted'") instead. ([UTF8 for listings](https://tex.stackexchange.com/questions/110020/utf8-for-listings), [The 'listings' package and UTF-8](https://tex.stackexchange.com/questions/25391/the-listings-package-and-utf-8?lq=1), [Having problems with listings and UTF-8. Can it be fixed?](https://tex.stackexchange.com/questions/24528/having-problems-with-listings-and-utf-8-can-it-be-fixed?lq=1), [verbments (listings alternative) and UTF-8](https://tex.stackexchange.com/questions/110028/verbments-listings-alternative-and-utf-8?lq=1), [UTF-8 (BMP character set) support in listings.](https://tex.stackexchange.com/questions/16005/utf-8-bmp-character-set-support-in-listings?rq=1), etc. etc.)

But otherwise:

```
\documentclass{article}
\usepackage{fontspec,unicode-math}
\setmainfont{Cambria}
\setmathfont{Cambria Math}
\setmonofont{Consolas}
\begin{document}
$\alpha$, $α$, $$, α
\end{document}

```

![enter image description here](https://i.stack.imgur.com/Z5Sdf.png)

Note that text fonts don't include (all of) the mathematical glyphs. Especially not the mathematical alphanumeric range.