thalesmg / reflex-skeleton

A skeleton Reflex project with Hpack, Nix and Emacs/HIE/LSP integration
GNU General Public License v3.0
7 stars 1 forks source link

Extend this template to include the backend as well? #2

Open pmiddend opened 4 years ago

pmiddend commented 4 years ago

Could this be easily extended?

thalesmg commented 4 years ago

Good question! Since I'm still learning both Reflex and Nix, I still don't know exactly how people usually structure such projects.

My guess is that one could organize the frontend and backend in folders like:

├── backend
│   └── src
└── frontend
    └── src

And then modify default.nix to something like:

{ pkgs ? import <nixpkgs> {}
, reflex-platform ? import ./nix/reflex-platform.nix
, compiler ? "ghcjs"
}:

reflex-platform.project (_: {
  withHoogle = false;
  useWarp = true;

  packages = {
    backend = ./backend;
    frontend = ./frontend;
  };

  shells = {
    ghc   = [
      "backend"
      "frontend"
    ];
    ghcjs = [
      "backend"
      "frontend"
    ];
  };
})

But I'm not sure what to do with the compiler argument. Perhaps override that in a default.nix inside ./backend?

Once I get more acquainted with both Nix and Reflex, I'll probably update this template with my findings.

Thanks for the idea!

pmiddend commented 4 years ago

Not sure how to solve this, but I got the idea from:

https://github.com/ElvishJerricco/reflex-project-skeleton

I think it'd be very desirable. Using Haskell "full-stack" (or any language, for that matter) sounds pretty enticing. :)