website/frontend/src/Pages/Services/Nix.elm

477 lines
16 KiB
Elm
Raw Normal View History

2024-12-11 02:38:42 -06:00
module Pages.Services.Nix exposing (Model, Msg, page)
2024-12-12 01:36:31 -06:00
import Config.Helpers.ArticleFormat exposing (..)
import Config.Helpers.CardFormat exposing (..)
import Config.Helpers.Format exposing (..)
import Config.Helpers.Response
exposing
( pageList
, topLevelContainer
)
import Config.Helpers.ToolTip exposing (..)
import Config.Pages.Headers.Types exposing (..)
import Config.Pages.Services.Services.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 () =
( {}
, Effect.none
)
-- 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 =
column pageList <|
List.concat
(case ( device.class, device.orientation ) of
_ ->
[ [ serviceMaker ] ]
)
serviceMaker : Element msg
serviceMaker =
row
topLevelBox
[ cardMaker
[ cardTitleMaker (String.toUpper servicesNixBuilds.serviceName)
, cardFormatter
[ cardContentSpacing
[ column
fieldSpacer
[ cardSubTitleMaker
[ column
bodyFormat
2024-12-12 22:48:20 -06:00
[ chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph1
, chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph2
, 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-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 ]
]
]