mkdir -p app/src lib/src ; git mv app{_slash_,/}example.cabal ; git mv app{_slash_src_slash_,/src/}Main.hs ; git mv lib{_slash_,/}lib.cabal ; git mv lib{_slash_src_slash_,/src/}MyLib.hs
nix-build
nix-shell
Then you can build with cabal build app
or build the library and then the app separately via cd lib && cabal v1-install && cd ../app && cabal v1-build
– with or without --nix=True
(or $HOME/.cabal/config
containing nix: True
).