summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Biz/Bild/ShellHook.sh2
-rw-r--r--Biz/Dev.nix6
-rw-r--r--Biz/Devalloc.hs (renamed from Biz/Devalloc/Host.hs)33
-rw-r--r--Biz/Devalloc.nix (renamed from Biz/Devalloc/Host.nix)16
4 files changed, 29 insertions, 28 deletions
diff --git a/Biz/Bild/ShellHook.sh b/Biz/Bild/ShellHook.sh
index 65c3f10..b40b91e 100644
--- a/Biz/Bild/ShellHook.sh
+++ b/Biz/Bild/ShellHook.sh
@@ -106,7 +106,7 @@ function ci() {
stuff=(
Biz/Pie.hs
Biz/Pie.nix
- Biz/Devalloc/Host.hs
+ Biz/Devalloc.hs
Biz/Que/Site.hs
Biz/Que/Host.hs
Biz/Que/Prod.nix
diff --git a/Biz/Dev.nix b/Biz/Dev.nix
index d9f2cb6..14c0375 100644
--- a/Biz/Dev.nix
+++ b/Biz/Dev.nix
@@ -9,14 +9,14 @@ bild.os {
./Users.nix
./Dev/Configuration.nix
./Dev/Hardware.nix
- ./Devalloc/Host.nix
+ ./Devalloc.nix
];
networking.hostName = "lithium";
networking.domain = "dev.simatime.com";
- services.devalloc-host = {
+ services.devalloc = {
enable = true;
port = 8095;
- package = bild.ghc ./Devalloc/Host.hs;
+ package = bild.ghc ./Devalloc.hs;
};
}
diff --git a/Biz/Devalloc/Host.hs b/Biz/Devalloc.hs
index 522b9c6..7654785 100644
--- a/Biz/Devalloc/Host.hs
+++ b/Biz/Devalloc.hs
@@ -9,10 +9,10 @@
-- Developer allocation
--
--- : out devalloc-host
+-- : out devalloc
-- : dep clay
--- : dep cmark
--- : sys cmark
+-- dep cmark
+-- sys cmark
-- : dep envy
-- : dep lucid
-- : dep protolude
@@ -20,15 +20,13 @@
-- : dep servant-lucid
-- : dep servant-server
-- : dep warp
-module Biz.Devalloc.Host
+module Biz.Devalloc
( main,
)
where
import Alpha
import Biz.App (CSS (..), HtmlApp (..))
--- import qualified CMark as Cmark
-
import qualified Biz.Look
import qualified Clay
import qualified Control.Exception as Exception
@@ -48,8 +46,6 @@ main = Exception.bracket startup shutdown run
where
startup =
Envy.decodeWithDefaults Envy.defConfig >>= \cfg -> do
- -- pitchText <- readFile <| pitches cfg
- -- let pitch = Cmark.commonmarkToHtml [] pitchText
putText "@"
putText "devalloc"
putText <| "port: " <> (show <| port cfg)
@@ -61,8 +57,6 @@ main = Exception.bracket startup shutdown run
data Config = Config
{ port :: Warp.Port,
- -- | A yaml file of pitches
- pitches :: FilePath,
assets :: FilePath
}
deriving (Generic, Show)
@@ -71,7 +65,6 @@ instance Envy.DefConfig Config where
defConfig =
Config
{ port = 8005,
- pitches = "./Biz/Devalloc/pitch.md",
assets = "_/bild/dev/static/devalloc.js"
}
@@ -106,12 +99,12 @@ instance Lucid.ToHtml a => Lucid.ToHtml (HtmlApp a) where
-- * paths and pages
type AllPaths =
- Get '[HTML] (HtmlApp Path)
+ Get '[HTML] (HtmlApp Page)
:<|> Signup
:<|> ("static" :> Raw)
:<|> "css" :> "main.css" :> Get '[CSS] Text
-type Signup = "signup" :> Get '[HTML] (HtmlApp Path)
+type Signup = "signup" :> Get '[HTML] (HtmlApp Page)
paths :: Config -> Server AllPaths
paths cfg =
@@ -127,11 +120,18 @@ paths cfg =
Biz.Look.fuckingStyle
"body" Clay.? Biz.Look.fontStack
-data Path
+linkTo ::
+ (HasLink path, IsElem path api) =>
+ Proxy api ->
+ Proxy path ->
+ MkLink path Lucid.Attribute
+linkTo allPaths thisPath = Lucid.safeHref_ "/" allPaths thisPath
+
+data Page
= Home
| Signup
-instance Lucid.ToHtml Path where
+instance Lucid.ToHtml Page where
toHtmlRaw = Lucid.toHtml
toHtml = \case
Home -> Lucid.toHtml pitch
@@ -151,7 +151,8 @@ pitch =
"Devalloc analyzes your codebase trends, finds patterns \
\ in how your developers work, and protects against tech debt."
Lucid.p_ "Just hook it up to your CI system - it will warn you when it finds a problem."
- Lucid.a_ [Lucid.safeHref_ "/" (Proxy :: Proxy AllPaths) (Proxy :: Proxy Signup)]
+ Lucid.a_
+ [linkTo (Proxy :: Proxy AllPaths) (Proxy :: Proxy Signup)]
"Go to signup"
Lucid.h2_ "Identify blackholes in your codebase"
Lucid.p_
diff --git a/Biz/Devalloc/Host.nix b/Biz/Devalloc.nix
index 51aa85d..0fd1550 100644
--- a/Biz/Devalloc/Host.nix
+++ b/Biz/Devalloc.nix
@@ -6,33 +6,33 @@
}:
let
- cfg = config.services.devalloc-host;
+ cfg = config.services.devalloc;
in
{
- options.services.devalloc-host = {
- enable = lib.mkEnableOption "Enable the devalloc-host service";
+ options.services.devalloc = {
+ enable = lib.mkEnableOption "Enable the devalloc service";
port = lib.mkOption {
type = lib.types.int;
default = 3000;
description = ''
- The port on which devalloc-host will listen for
+ The port on which devalloc will listen for
incoming HTTP traffic.
'';
};
package = lib.mkOption {
type = lib.types.package;
- description = "devalloc-host package to use";
+ description = "devalloc package to use";
};
};
config = lib.mkIf cfg.enable {
- systemd.services.devalloc-host = {
+ systemd.services.devalloc = {
path = [ cfg.package ];
wantedBy = [ "multi-user.target" ];
script = ''
- ${cfg.package}/bin/devalloc-host
+ ${cfg.package}/bin/devalloc
'';
description = ''
- Devalloc.Host
+ Devalloc
'';
serviceConfig = {
Environment = ["PORT=${toString cfg.port}"];