diff --git a/.envrc b/.envrc old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/flake.lock b/flake.lock old mode 100644 new mode 100755 index 94a0bc8..846d196 --- a/flake.lock +++ b/flake.lock @@ -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" } } }, diff --git a/flake.nix b/flake.nix old mode 100644 new mode 100755 index 345bad4..23508b5 --- a/flake.nix +++ b/flake.nix @@ -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; + }; + }; }; } diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100755 index 0000000..7295c4f --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,7 @@ +/dist +/.elm-land +/.env +/elm-stuff +/node_modules +.DS_Store +*.pem \ No newline at end of file diff --git a/frontend/README.md b/frontend/README.md new file mode 100755 index 0000000..cca2e01 --- /dev/null +++ b/frontend/README.md @@ -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. \ No newline at end of file diff --git a/frontend/elm-land.json b/frontend/elm-land.json new file mode 100755 index 0000000..2ca0790 --- /dev/null +++ b/frontend/elm-land.json @@ -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 + } + } +} \ No newline at end of file diff --git a/frontend/elm.json b/frontend/elm.json new file mode 100755 index 0000000..c12da99 --- /dev/null +++ b/frontend/elm.json @@ -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": {} + } +} diff --git a/frontend/review/elm.json b/frontend/review/elm.json new file mode 100644 index 0000000..fd4ba17 --- /dev/null +++ b/frontend/review/elm.json @@ -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": {} + } +} \ No newline at end of file diff --git a/frontend/review/src/ReviewConfig.elm b/frontend/review/src/ReviewConfig.elm new file mode 100644 index 0000000..2a3a988 --- /dev/null +++ b/frontend/review/src/ReviewConfig.elm @@ -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 + ] diff --git a/frontend/src/Config/Identity.elm b/frontend/src/Config/Identity.elm new file mode 100644 index 0000000..6d61334 --- /dev/null +++ b/frontend/src/Config/Identity.elm @@ -0,0 +1,4 @@ +module Config.Identity exposing (..) + +myName : String +myName = "The Nutrivore" \ No newline at end of file diff --git a/frontend/src/Config/Theme.elm b/frontend/src/Config/Theme.elm new file mode 100644 index 0000000..33c5a2c --- /dev/null +++ b/frontend/src/Config/Theme.elm @@ -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 + } diff --git a/frontend/src/Pages/Contact.elm b/frontend/src/Pages/Contact.elm new file mode 100644 index 0000000..4be50f5 --- /dev/null +++ b/frontend/src/Pages/Contact.elm @@ -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) + } diff --git a/frontend/src/Pages/Home_.elm b/frontend/src/Pages/Home_.elm new file mode 100755 index 0000000..c39d625 --- /dev/null +++ b/frontend/src/Pages/Home_.elm @@ -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 space―somewhere 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) " + ] + ] + ] + ] + ] diff --git a/frontend/src/View.elm b/frontend/src/View.elm new file mode 100755 index 0000000..9143e89 --- /dev/null +++ b/frontend/src/View.elm @@ -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 + } diff --git a/frontend/static/discord.png b/frontend/static/discord.png new file mode 100644 index 0000000..2019fb5 Binary files /dev/null and b/frontend/static/discord.png differ diff --git a/frontend/static/mastodon.png b/frontend/static/mastodon.png new file mode 100644 index 0000000..9b78af5 Binary files /dev/null and b/frontend/static/mastodon.png differ diff --git a/frontend/static/mastodon.svg b/frontend/static/mastodon.svg new file mode 100644 index 0000000..87ec2c5 --- /dev/null +++ b/frontend/static/mastodon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/static/peertube.png b/frontend/static/peertube.png new file mode 100644 index 0000000..6778d24 Binary files /dev/null and b/frontend/static/peertube.png differ diff --git a/parts/devshells.nix b/parts/config/devshells.nix old mode 100644 new mode 100755 similarity index 83% rename from parts/devshells.nix rename to parts/config/devshells.nix index eab67e3..d192f84 --- a/parts/devshells.nix +++ b/parts/config/devshells.nix @@ -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 diff --git a/parts/default.nix b/parts/default.nix old mode 100644 new mode 100755 index 8aae71f..27fb3cf --- a/parts/default.nix +++ b/parts/default.nix @@ -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; }; }