feat: init

This commit is contained in:
Nick 2024-11-10 22:55:49 -06:00
parent be12403f13
commit 7145b8a9fa
21 changed files with 591 additions and 9 deletions

0
.envrc Normal file → Executable file
View file

0
.gitignore vendored Normal file → Executable file
View file

19
flake.lock generated Normal file → Executable file
View file

@ -45,10 +45,27 @@
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720535198,
"narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
}
}
},

11
flake.nix Normal file → Executable file
View file

@ -1,10 +1,9 @@
{
description = "Elm Environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs = inputs @ {
flake-parts,
self,
@ -17,5 +16,13 @@
./parts
];
systems = [system];
perSystem = {pkgs, ...}: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
};
_module.args.pkgs-stable = import inputs.nixpkgs-stable {
inherit system;
};
};
};
}

7
frontend/.gitignore vendored Executable file
View file

@ -0,0 +1,7 @@
/dist
/.elm-land
/.env
/elm-stuff
/node_modules
.DS_Store
*.pem

16
frontend/README.md Executable file
View file

@ -0,0 +1,16 @@
# frontend
> Built with [Elm Land](https://elm.land) 🌈
## Local development
```bash
# Requires Node.js v18+ (https://nodejs.org)
npx elm-land server
```
## Deploying to production
Elm Land projects are most commonly deployed as static websites.
Please visit [the "Deployment" guide](https://elm.land/guide/deploying) to learn more
about deploying your app for free using Netlify or Vercel.

28
frontend/elm-land.json Executable file
View file

@ -0,0 +1,28 @@
{
"app": {
"elm": {
"development": { "debugger": true },
"production": { "debugger": false }
},
"env": [],
"html": {
"attributes": {
"html": { "lang": "en" },
"head": {}
},
"title": "Elm Land",
"meta": [
{ "charset": "UTF-8" },
{ "http-equiv": "X-UA-Compatible", "content": "IE=edge" },
{ "name": "viewport", "content": "width=device-width, initial-scale=1.0" }
],
"link": [
{ "rel": "stylesheet", "href": "https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&display=swap" }
],
"script": []
},
"router": {
"useHashRouting": false
}
}
}

26
frontend/elm.json Executable file
View file

@ -0,0 +1,26 @@
{
"type": "application",
"source-directories": [
"src",
".elm-land/src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"mdgriffith/elm-ui": "1.1.8"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

39
frontend/review/elm.json Normal file
View file

@ -0,0 +1,39 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/core": "1.0.5",
"elm/json": "1.1.3",
"elm/project-metadata-utils": "1.0.2",
"jfmengels/elm-review": "2.14.1",
"jfmengels/elm-review-code-style": "1.2.0",
"jfmengels/elm-review-common": "1.3.3",
"jfmengels/elm-review-debug": "1.0.8",
"jfmengels/elm-review-documentation": "2.0.4",
"jfmengels/elm-review-simplify": "2.1.5",
"jfmengels/elm-review-unused": "1.2.3",
"stil4m/elm-syntax": "7.3.7"
},
"indirect": {
"elm/bytes": "1.0.8",
"elm/html": "1.0.0",
"elm/parser": "1.1.0",
"elm/random": "1.0.0",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3",
"elm-explorations/test": "2.2.0",
"pzp1997/assoc-list": "1.0.0",
"rtfeldman/elm-hex": "1.0.0",
"stil4m/structured-writer": "1.0.3"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

View file

@ -0,0 +1,58 @@
module ReviewConfig exposing (config)
{-| Do not rename the ReviewConfig module or the config function, because
`elm-review` will look for these.
To add packages that contain rules, add them to this review project using
`elm install author/packagename`
when inside the directory containing this file.
-}
import Docs.ReviewAtDocs
import NoConfusingPrefixOperator
import NoDebug.Log
import NoDebug.TodoOrToString
import NoExposingEverything
import NoImportingEverything
import NoMissingTypeAnnotation
import NoMissingTypeAnnotationInLetIn
import NoMissingTypeExpose
import NoPrematureLetComputation
import NoSimpleLetBody
import NoUnused.CustomTypeConstructorArgs
import NoUnused.CustomTypeConstructors
import NoUnused.Dependencies
import NoUnused.Exports
import NoUnused.Parameters
import NoUnused.Patterns
import NoUnused.Variables
import Review.Rule as Rule exposing (Rule)
import Simplify
config : List Rule
config =
[ Docs.ReviewAtDocs.rule
, NoConfusingPrefixOperator.rule
, NoDebug.Log.rule
, NoDebug.TodoOrToString.rule
|> Rule.ignoreErrorsForDirectories [ "tests/" ]
, NoExposingEverything.rule
, NoImportingEverything.rule []
, NoMissingTypeAnnotation.rule
, NoMissingTypeAnnotationInLetIn.rule
, NoMissingTypeExpose.rule
, NoSimpleLetBody.rule
, NoPrematureLetComputation.rule
, NoUnused.CustomTypeConstructors.rule []
, NoUnused.CustomTypeConstructorArgs.rule
, NoUnused.Dependencies.rule
, NoUnused.Exports.rule
, NoUnused.Parameters.rule
, NoUnused.Patterns.rule
, NoUnused.Variables.rule
, Simplify.rule Simplify.defaults
]

View file

@ -0,0 +1,4 @@
module Config.Identity exposing (..)
myName : String
myName = "The Nutrivore"

View file

@ -0,0 +1,24 @@
module Config.Theme exposing (..)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
type alias Theme =
{ nonHighlightedText : Color
, nonHighlightedDarkText : Color
, highlightText : Color
, backgroundColour : Color
, debugColour : Color
}
colourTheme : Theme
colourTheme =
{ nonHighlightedText = rgb255 212 212 212
, nonHighlightedDarkText = rgb255 126 126 126
, highlightText = rgb255 204 102 0
, backgroundColour = rgb255 40 40 40
, debugColour = rgb255 227 28 121
}

View file

@ -0,0 +1,82 @@
module Pages.Contact exposing (Model, Msg, page)
import Config.Identity as ID exposing (..)
import Config.Theme as T exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
import Element.Events as E
import Page exposing (Page)
import Route exposing (Route)
import Shared
import View exposing (View)
page : Shared.Model -> Route () -> Page Model Msg
page shared route =
Page.new
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}
-- INIT
type alias Model =
{ num : Int }
init : () -> ( Model, Effect Msg )
init () =
( { num = 0 }
, Effect.none
)
-- UPDATE
type Msg
= Inc
| Dec
update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
case msg of
Inc ->
( { model | num = model.num + 1 }
, Effect.none
)
Dec ->
( { model | num = model.num - 1 }
, Effect.none
)
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- VIEW
view : Model -> View Msg
view model =
{ title = ""
, attributes = []
, element = el [E.onClick Inc] (text <| "a string is fun" ++ String.fromInt model.num)
}

170
frontend/src/Pages/Home_.elm Executable file
View file

@ -0,0 +1,170 @@
module Pages.Home_ exposing (page)
import Config.Identity as ID exposing (..)
import Config.Theme as T exposing (..)
import Element exposing (..)
import Element.Background as B
import Element.Font as F
import Element.Region exposing (description)
import View exposing (View)
-- Use this if you fuck something up
-- Element.explain Debug.todo
page : View msg
page =
{ title = myName
, attributes = [ F.family [ spartanFont ] ]
, element = topLevelContainer
}
spartanFont : F.Font
spartanFont =
F.typeface "League Spartan"
topLevelContainer : Element msg
topLevelContainer =
el
[ width fill
, height fill
, B.color colourTheme.backgroundColour
]
linkList
linkList : Element msg
linkList =
column
[ spacing 20
, centerX
, centerY
, F.color (rgb255 67 67 67)
]
links
imageSpacer : Attribute msg
imageSpacer =
spacing 20
titleFormat : List (Attr () msg)
titleFormat =
[ F.size 23
, F.bold
, F.color colourTheme.highlightText
]
paragraphFontSize : Attr decorative msg
paragraphFontSize =
F.size 17
paragraphLinkFormat : { url : String, label : Element msg } -> Element msg
paragraphLinkFormat =
newTabLink
[ paragraphFontSize
, F.color colourTheme.highlightText
]
paragraphFormat : List (Attr () msg)
paragraphFormat =
[ spacing 8
, paragraphFontSize
, F.color colourTheme.nonHighlightedText
]
paragraphColumnFormat : List (Attribute msg)
paragraphColumnFormat =
[ spacing 20
, width <| px 700
]
imageFormat : List (Attribute msg)
imageFormat =
[ width <| px 150
, alignTop
]
recommendedClients : Element msg
recommendedClients =
el [ F.bold ] (text "Recommended Clients: ")
links : List (Element msg)
links =
[ column
[ spacing 40 ]
[ row [ imageSpacer ]
[ image imageFormat
{ src = "mastodon.png"
, description = "mastodon logo"
}
, column paragraphColumnFormat
[ newTabLink titleFormat
{ url = "https://the-nutrivore.social/"
, label = text "MASTODON"
}
, paragraph paragraphFormat [ text "Microblogging will now be posted to my own self-hosted Mastodon instance. I've kinda grown tired of microblogging on X, where political correctness and unclear ban policies force me to constantly self-censor. I considered and ultimately rejected several alternative platforms. Eventually, I realized the solution to this problem is to simply self-host my own spacesomewhere where I can be myself and speak as I please. And I recently obtained the necessary infrastructure to do this." ]
, paragraph paragraphFormat [ text "This instance is 100% mine, and I can't be censored or fucked with there. I invite everyone who values my content and interactions to follow me on this new platform (whether you agree with my views or not). My instance is a \"single-user\" instances, meaning I'm the only user. But you can still follow me! Just make an account on another instance, like ", paragraphLinkFormat { url = "https://mastodon.social", label = text "Mastodon.social" }, text " (alternatively, you can select whatever instance you wish from the ",paragraphLinkFormat { url = "https://instances.social/", label = text "official index"} , text "), follow me, and turn on notifications." ]
, paragraph paragraphFormat
[ recommendedClients
, paragraphLinkFormat { url = "https://github.com/LucasGGamerM/moshidon", label = text "Moshidon" }
, text " (android) "
, paragraphLinkFormat { url = "https://github.com/mastodon/mastodon-android", label = text "Official" }
, text " (android) "
, paragraphLinkFormat { url = "https://github.com/tuskyapp/Tusky", label = text "Tusky" }
, text " (android) "
, paragraphLinkFormat { url = "https://apps.apple.com/us/app/mastodon/id1571998974", label = text "Official" }
, text " (iOS)"
]
]
]
, row [ imageSpacer ]
[ image imageFormat
{ src = "peertube.png"
, description = "mastodon logo"
}
, column paragraphColumnFormat
[ newTabLink titleFormat
{ url = "https://video.the-nutrivore.social/"
, label = text "PEERTUBE"
}
, paragraph paragraphFormat [ text "I'm transitioning my video content from YouTube to my self-hosted PeerTube instance, because I strongly believe in freedom of speech, copyleft, and digital autonomy. YouTube has proven unreliable due to both censorship and copyright strikes levied against my channel. This shift allows me to better control my content and avoid these silly pitfalls." ]
, paragraph paragraphFormat [ text "Full-length videos are now exclusively available on PeerTube, while YouTube will only host clips. By registering on PeerTube and subscribing to my channels, you'll have access to all content. Just be sure to enable email notifications to be alerted of new uploads. I believe that those who are truly fans of my work and want the best experience possible will see this as a positive change." ]
, paragraph paragraphFormat [ recommendedClients, text "Unfortunately, I can't recommend any mobile clients for PeerTube at this time. They're all trash. Please use your browser, either on your mobile device or personal computer. Just be use to enable email notifications in your account settings." ]
]
]
, row [ imageSpacer ]
[ image imageFormat
{ src = "discord.png"
, description = "mastodon logo"
}
, column paragraphColumnFormat
[ newTabLink titleFormat
{ url = "https://discord.gg/eeYQ2wJknS"
, label = text "DISCORD"
}
, paragraph paragraphFormat [ text "The Nutrivore Discord server is an evidence-based community dedicated to debunking pseudoscience, especially in the fields of nutrition, health and fitness. Casual discourse is welcome, and includes topics such as cooking, gaming, technology, and more. Current members span many disciplines and include both students and professionals, all levels of interest and expertise are welcome." ]
, paragraph paragraphFormat [ text "The Discord server is not explicitly a debate server. However, we strongly encourage that disagreements be resolved using debate (preferably verbal), as long as it is conducted respectfully and in good faith. Though we also firmly believe that shaming sophistry and bad faith behaviour is a net good overall. The Discord server is planned to be replaced with a Matrix server in future." ]
, paragraph paragraphFormat
[ recommendedClients
, paragraphLinkFormat { url = "https://github.com/Vendicated/Vencord", label = text "Vencord" }
, text " (desktop) "
, paragraphLinkFormat { url = "https://discord.com/download", label = text "Official" }
, text " (multi-platform) "
]
]
]
]
]

89
frontend/src/View.elm Executable file
View file

@ -0,0 +1,89 @@
module View exposing
( View, map
, none, fromString
, toBrowserDocument
)
{-|
@docs View, map
@docs none, fromString
@docs toBrowserDocument
-}
import Browser
import Element exposing (Attribute, Element, layout, mapAttribute, text)
import Route exposing (Route)
import Shared.Model
type alias View msg =
{ title : String
, attributes : List (Attribute msg)
, element : Element msg
}
{-| Used internally by Elm Land to create your application
so it works with Elm's expected `Browser.Document msg` type.
-}
toBrowserDocument :
{ shared : Shared.Model.Model
, route : Route ()
, view : View msg
}
-> Browser.Document msg
toBrowserDocument { view } =
{ title = view.title
, body = [ layout view.attributes view.element ]
}
-- toBrowserDocument :
-- { shared : Shared.Model.Model
-- , route : Route ()
-- , view : View msg
-- }
-- -> Browser.Document msg
-- toBrowserDocument { view } =
-- { title = view.title
-- , body = view.body
-- }
{-| Used internally by Elm Land to connect your pages together.
-}
map : (msg1 -> msg2) -> View msg1 -> View msg2
map fn view =
{ title = view.title
, attributes = List.map (mapAttribute fn) view.attributes
, element = Element.map fn view.element
}
{-| Used internally by Elm Land whenever transitioning between
authenticated pages.
-}
none : View msg
none =
{ title = ""
, attributes = []
, element = Element.none
}
{-| If you customize the `View` module, anytime you run `elm-land add page`,
the generated page will use this when adding your `view` function.
That way your app will compile after adding new pages, and you can see
the new page working in the web browser!
-}
fromString : String -> View msg
fromString moduleName =
{ title = moduleName
, attributes = []
, element = text moduleName
}

BIN
frontend/static/discord.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="61.076954mm" height="65.47831mm" viewBox="0 0 216.4144 232.00976">
<path fill="#2b90d9" d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915"/>
<path fill="#fff" d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

8
parts/devshells.nix → parts/config/devshells.nix Normal file → Executable file
View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
pkgs,
pkgs-stable,
...
}: {
devShells = {
default = pkgs.mkShell {
packages = builtins.attrValues {
@ -9,7 +13,7 @@
nil
;
inherit
(pkgs.elmPackages)
(pkgs-stable.elmPackages)
elm
elm-format
elm-land

15
parts/default.nix Normal file → Executable file
View file

@ -5,9 +5,16 @@
config,
self',
...
}: {
imports = [
./devshells.nix
];
}: let
configPath = ./config;
devshellImports = let
files = builtins.attrNames (builtins.readDir configPath);
in
map
(name: configPath + "/${name}")
(builtins.filter (name: builtins.match ".*\\.nix$" name != null) files);
in {
imports = devshellImports;
};
}