2024-12-11 02:38:42 -06:00
|
|
|
module Pages.Services.Nix exposing (Model, Msg, page)
|
|
|
|
|
2024-12-22 04:36:03 -06:00
|
|
|
import Config.Helpers.Cards.Helpers exposing (cardMaker)
|
|
|
|
import Config.Helpers.Cards.Types as C
|
2024-12-12 01:36:31 -06:00
|
|
|
import Config.Helpers.Format exposing (..)
|
2024-12-22 04:36:03 -06:00
|
|
|
import Config.Helpers.Headers.Helpers exposing (..)
|
2024-12-18 20:11:04 -06:00
|
|
|
import Config.Helpers.Headers.Types exposing (Header)
|
2024-12-12 01:36:31 -06:00
|
|
|
import Config.Helpers.Response
|
|
|
|
exposing
|
|
|
|
( pageList
|
|
|
|
, topLevelContainer
|
|
|
|
)
|
2024-12-18 20:11:04 -06:00
|
|
|
import Config.Helpers.ServiceFormat exposing (..)
|
2024-12-12 01:36:31 -06:00
|
|
|
import Config.Helpers.ToolTip exposing (..)
|
2024-12-23 03:15:35 -06:00
|
|
|
import Config.Helpers.Viewport exposing (resetViewport)
|
2024-12-15 02:31:26 -06:00
|
|
|
import Config.Pages.Services.Records.NixBuilds exposing (servicesNixBuilds)
|
2024-12-12 22:48:20 -06:00
|
|
|
import Config.Style.Colour exposing (..)
|
2024-12-12 01:36:31 -06:00
|
|
|
import Config.Style.Transitions
|
|
|
|
exposing
|
|
|
|
( hoverFontDarkOrange
|
|
|
|
, transitionStyleFast
|
|
|
|
, transitionStyleSlow
|
|
|
|
)
|
2024-12-11 02:38:42 -06:00
|
|
|
import Effect exposing (Effect)
|
2024-12-12 01:36:31 -06:00
|
|
|
import Element as E exposing (..)
|
|
|
|
import Element.Background as B
|
|
|
|
import Element.Border as D
|
|
|
|
import Element.Font as F
|
2024-12-11 02:38:42 -06:00
|
|
|
import Html
|
2024-12-12 01:36:31 -06:00
|
|
|
import Html.Attributes as H exposing (style)
|
|
|
|
import Layouts
|
2024-12-11 02:38:42 -06:00
|
|
|
import Page exposing (Page)
|
2024-12-12 01:36:31 -06:00
|
|
|
import Route exposing (Route)
|
|
|
|
import Route.Path as Path
|
2024-12-11 02:38:42 -06:00
|
|
|
import Shared
|
|
|
|
import View exposing (View)
|
|
|
|
|
|
|
|
|
|
|
|
page : Shared.Model -> Route () -> Page Model Msg
|
|
|
|
page shared route =
|
|
|
|
Page.new
|
|
|
|
{ init = init
|
|
|
|
, update = update
|
|
|
|
, subscriptions = subscriptions
|
2024-12-12 01:36:31 -06:00
|
|
|
, view = view shared
|
2024-12-11 02:38:42 -06:00
|
|
|
}
|
2024-12-12 01:36:31 -06:00
|
|
|
|> Page.withLayout toLayout
|
|
|
|
|
|
|
|
|
|
|
|
toLayout : Model -> Layouts.Layout Msg
|
|
|
|
toLayout model =
|
|
|
|
Layouts.Navbar {}
|
|
|
|
|
2024-12-11 02:38:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
-- INIT
|
|
|
|
|
|
|
|
|
|
|
|
type alias Model =
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
init : () -> ( Model, Effect Msg )
|
|
|
|
init () =
|
|
|
|
( {}
|
2024-12-22 19:42:23 -06:00
|
|
|
, Effect.map
|
|
|
|
(\_ -> NoOp)
|
|
|
|
(Effect.sendCmd resetViewport)
|
2024-12-11 02:38:42 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
= NoOp
|
|
|
|
|
|
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Effect Msg )
|
|
|
|
update msg model =
|
|
|
|
case msg of
|
|
|
|
NoOp ->
|
|
|
|
( model
|
|
|
|
, Effect.none
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- SUBSCRIPTIONS
|
|
|
|
|
|
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
|
|
subscriptions model =
|
|
|
|
Sub.none
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- VIEW
|
|
|
|
|
|
|
|
|
2024-12-12 01:36:31 -06:00
|
|
|
view : Shared.Model -> Model -> View Msg
|
|
|
|
view shared model =
|
|
|
|
{ title = "services (nixConfigs)"
|
|
|
|
, attributes = []
|
|
|
|
, element = elmBuildsContainer shared.device
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
elmBuildsContainer : Device -> Element msg
|
|
|
|
elmBuildsContainer device =
|
|
|
|
topLevelContainer (elmBuildsList device)
|
|
|
|
|
|
|
|
|
|
|
|
elmBuildsList : Device -> Element msg
|
|
|
|
elmBuildsList device =
|
2024-12-21 23:23:59 -06:00
|
|
|
column
|
|
|
|
(case ( device.class, device.orientation ) of
|
|
|
|
_ ->
|
2024-12-22 19:42:23 -06:00
|
|
|
pageList device
|
2024-12-21 23:23:59 -06:00
|
|
|
)
|
|
|
|
<|
|
2024-12-12 01:36:31 -06:00
|
|
|
List.concat
|
2024-12-22 04:36:03 -06:00
|
|
|
[ List.map
|
2024-12-21 23:23:59 -06:00
|
|
|
(\service ->
|
2024-12-22 04:36:03 -06:00
|
|
|
cardMaker device (C.ServicePage service) contentList
|
2024-12-21 23:23:59 -06:00
|
|
|
)
|
2024-12-22 04:36:03 -06:00
|
|
|
[ servicesNixBuilds ]
|
2024-12-21 23:23:59 -06:00
|
|
|
]
|
2024-12-21 04:07:50 -06:00
|
|
|
|
|
|
|
|
|
|
|
contentList : List (Element msg)
|
|
|
|
contentList =
|
|
|
|
[ column
|
|
|
|
bodyFormat
|
|
|
|
[ chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph1
|
|
|
|
, chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph2
|
|
|
|
, chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph3
|
|
|
|
, titleMaker servicesNixBuilds.serviceArticle.articleTitles.title1
|
|
|
|
, numberMaker servicesNixBuilds.serviceArticle.articleListEntries.list1
|
|
|
|
, titleMaker servicesNixBuilds.serviceArticle.articleTitles.title2
|
|
|
|
, bulletPointMaker servicesNixBuilds.serviceArticle.articleListEntries.list2
|
|
|
|
, titleMaker servicesNixBuilds.serviceArticle.articleTitles.title3
|
|
|
|
, nixCodeRenderer
|
2024-12-12 01:36:31 -06:00
|
|
|
]
|
2024-12-21 04:07:50 -06:00
|
|
|
]
|
2024-12-12 22:48:20 -06:00
|
|
|
|
|
|
|
|
|
|
|
renderCodeLine : SyntaxColors -> List (Element msg) -> Element msg
|
|
|
|
renderCodeLine colors elements =
|
|
|
|
paragraph
|
|
|
|
[ F.color colors.text
|
|
|
|
, F.alignLeft
|
|
|
|
, F.family
|
|
|
|
[ F.monospace ]
|
|
|
|
]
|
|
|
|
elements
|
|
|
|
|
|
|
|
|
|
|
|
nixCodeRenderer : Element msg
|
|
|
|
nixCodeRenderer =
|
|
|
|
el
|
|
|
|
[ paddingEach
|
|
|
|
{ top = 15
|
|
|
|
, bottom = 15
|
|
|
|
, left = 20
|
|
|
|
, right = 20
|
|
|
|
}
|
|
|
|
, B.color colourTheme.backgroundLightGrey
|
|
|
|
, D.rounded 10
|
|
|
|
, width fill
|
|
|
|
, spacing 8
|
|
|
|
]
|
|
|
|
<|
|
|
|
|
column
|
|
|
|
[ F.size 14
|
|
|
|
, spacing 5
|
|
|
|
, width fill
|
|
|
|
]
|
|
|
|
[ renderCodeLine syntaxTheme
|
|
|
|
[ text "{"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 8 0 ]
|
|
|
|
, text "description"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
2024-12-13 00:12:56 -06:00
|
|
|
, text "\"Elm/Haskell Environment\""
|
2024-12-12 22:48:20 -06:00
|
|
|
|> el [ F.color syntaxTheme.string ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 8 0 ]
|
|
|
|
, text "inputs"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "{"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "nixpkgs.url"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "\"github:NixOS/nixpkgs/nixos-unstable\""
|
|
|
|
|> el [ F.color syntaxTheme.string ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "nixpkgs-stable.url"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "\"github:NixOS/nixpkgs/nixos-23.11\""
|
|
|
|
|> el [ F.color syntaxTheme.string ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "haskell-flake.url"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "\"github:srid/haskell-flake\""
|
|
|
|
|> el [ F.color syntaxTheme.string ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 8 0 ]
|
|
|
|
, text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 8 0 ]
|
|
|
|
, text "outputs"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "inputs"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " @ "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "{"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "flake-parts"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text ","
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "self"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text ","
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "..."
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 8 0 ]
|
|
|
|
, text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ": "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "let"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "system"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "\"x86_64-linux\""
|
|
|
|
|> el [ F.color syntaxTheme.string ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 8 0 ]
|
|
|
|
, text "in"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "flake-parts.lib.mkFlake"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " { "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text "inherit inputs"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " } "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text "{"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 24 0 ]
|
|
|
|
, text "imports"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "["
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 32 0 ]
|
|
|
|
, text "./parts"
|
|
|
|
|> el [ F.color syntaxTheme.string ]
|
|
|
|
, text ","
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 32 0 ]
|
|
|
|
, text "inputs.haskell-flake.flakeModule"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 24 0 ]
|
|
|
|
, text "]"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 24 0 ]
|
|
|
|
, text "systems"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "[ "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text "system"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " ]"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 24 0 ]
|
|
|
|
, text "perSystem"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "{ "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text "pkgs"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text ", ... "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "} "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ": "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "{"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 32 0 ]
|
|
|
|
, text "_module.args.pkgs"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "import"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " inputs.nixpkgs "
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text "{ "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 40 0 ]
|
|
|
|
, text "inherit system"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 32 0 ]
|
|
|
|
, text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 32 0 ]
|
|
|
|
, text "_module.args.pkgs-stable"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text " = "
|
|
|
|
|> el [ F.color syntaxTheme.operator ]
|
|
|
|
, text "import"
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text " inputs.nixpkgs-stable "
|
|
|
|
|> el [ F.color syntaxTheme.keyword ]
|
|
|
|
, text "{ "
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 40 0 ]
|
|
|
|
, text "inherit system"
|
|
|
|
|> el [ F.color syntaxTheme.key ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 32 0 ]
|
|
|
|
, text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 24 0 ]
|
|
|
|
, text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text ""
|
|
|
|
|> el [ paddingXY 16 0 ]
|
|
|
|
, text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
, text ";"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
, renderCodeLine syntaxTheme
|
|
|
|
[ text "}"
|
|
|
|
|> el [ F.color syntaxTheme.punctuation ]
|
|
|
|
]
|
|
|
|
]
|