diff options
author | Ben Sima <ben@bsima.me> | 2020-11-18 20:20:27 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-11-18 20:20:27 -0500 |
commit | e223b28e6820dcd9fa5c38ba22de487ada2ca0e6 (patch) | |
tree | 66061bca039242bc55338280f767d0ff64d35ba0 /Que | |
parent | ac3d455a9c0dc0b2f4afb88b56db3d16c0508428 (diff) |
Extend bild to nix targets properly
Also had to capitalize some stuff, and move some nix files around and rename
the metadata directive from 'exe' to 'out' because that just makes more sense,
and fix some compiler errors. But now bild treats both nix and hs files as
buildable things. So that's cool.
One interesting example is Biz/Pie.{nix,hs} - I can either create a dev build of
the hs file with ghc, or I can create a fully-encapsulated nix build. Its nice
to have both options because a dev build with ghc takes half the amount of time,
and I can rely on my locally cached hi and ho files. I think this shows the
power of bild, but also can be a somewhat subtle thing.
The issue really is with the separate command calls in nix builds vs dev builds.
I figure there are a few ways to fix this:
1. Try to use bild inside the nix rules. That could be interesting, but could
also lead to some weird behavior or worm holes forming.
2. Extract the command line invocation into a separate file, some kind of
really simple template that gets pulled into both programs.
It is important to consider that in the future I might want to have bild do a
module-by-module nix build of programs, but I'm not sure how that would effect
my choice here.
Diffstat (limited to 'Que')
-rw-r--r-- | Que/Apidocs.md (renamed from Que/apidocs.md) | 0 | ||||
-rwxr-xr-x | Que/Client.py (renamed from Que/client.py) | 0 | ||||
-rw-r--r-- | Que/Host.hs | 2 | ||||
-rw-r--r-- | Que/Index.md (renamed from Que/index.md) | 0 | ||||
-rw-r--r-- | Que/Prod.nix | 35 | ||||
-rw-r--r-- | Que/Quescripts.md (renamed from Que/quescripts.md) | 0 | ||||
-rw-r--r-- | Que/Site.hs | 2 | ||||
-rw-r--r-- | Que/Site.nix | 2 | ||||
-rw-r--r-- | Que/Style.css (renamed from Que/style.css) | 0 | ||||
-rw-r--r-- | Que/Tutorial.md (renamed from Que/tutorial.md) | 0 |
10 files changed, 34 insertions, 7 deletions
diff --git a/Que/apidocs.md b/Que/Apidocs.md index f400889..f400889 100644 --- a/Que/apidocs.md +++ b/Que/Apidocs.md diff --git a/Que/client.py b/Que/Client.py index 1063eb8..1063eb8 100755 --- a/Que/client.py +++ b/Que/Client.py diff --git a/Que/Host.hs b/Que/Host.hs index 3303709..b8e7a1a 100644 --- a/Que/Host.hs +++ b/Que/Host.hs @@ -11,7 +11,7 @@ -- - <https://github.com/hargettp/courier> -- - sorta: <https://ngrok.com/> and <https://localtunnel.github.io/www/> -- --- : exe que-server +-- : out que-server -- -- : dep async -- : dep envy diff --git a/Que/index.md b/Que/Index.md index a9db12e..a9db12e 100644 --- a/Que/index.md +++ b/Que/Index.md diff --git a/Que/Prod.nix b/Que/Prod.nix index 23c6f0a..b755d7c 100644 --- a/Que/Prod.nix +++ b/Que/Prod.nix @@ -1,5 +1,22 @@ -{ config, pkgs, lib, ... }: -{ +{ bild, lib }: + +# The production server for que.run + +bild.os { + imports = [ + ../Biz/OsBase.nix + ../Biz/Packages.nix + ../Biz/Users.nix + ./Host.nix + ./Site.nix + ]; + networking.hostName = "prod-que"; + networking.domain = "que.run"; + services.que-server = { + enable = true; + port = 80; + package = bild.ghc ./Host.hs; + }; boot.loader.grub.device = "/dev/vda"; fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; swapDevices = [ @@ -30,7 +47,15 @@ }; }; }; - services.udev.extraRules = '' - ATTR{address}=="7a:92:a5:c6:db:c3", NAME="eth0" - ''; + services = { + que-website = { + enable = true; + namespace = "_"; + package = bild.ghc ./Site.hs; + }; + + udev.extraRules = '' + ATTR{address}=="7a:92:a5:c6:db:c3", NAME="eth0" + ''; + }; } diff --git a/Que/quescripts.md b/Que/Quescripts.md index 77e7004..77e7004 100644 --- a/Que/quescripts.md +++ b/Que/Quescripts.md diff --git a/Que/Site.hs b/Que/Site.hs index 794dd04..5d2dbb8 100644 --- a/Que/Site.hs +++ b/Que/Site.hs @@ -5,7 +5,7 @@ -- | spawns a few processes that serve the que.run website -- --- : exe que-website +-- : out que-website -- -- : dep async -- : dep config-ini diff --git a/Que/Site.nix b/Que/Site.nix index 685b3a6..ba2eeb2 100644 --- a/Que/Site.nix +++ b/Que/Site.nix @@ -5,6 +5,8 @@ , modulesPath }: + + let cfg = config.services.que-website; static = pkgs.stdenv.mkDerivation { diff --git a/Que/style.css b/Que/Style.css index f8d1ca4..f8d1ca4 100644 --- a/Que/style.css +++ b/Que/Style.css diff --git a/Que/tutorial.md b/Que/Tutorial.md index 6542ad3..6542ad3 100644 --- a/Que/tutorial.md +++ b/Que/Tutorial.md |