commit 4fe3b96832fb3ccb14b32d6b3baafdde88431306 Author: lilly Date: Tue May 19 19:38:35 2026 +0200 initi elixir project diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..164e774 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +if has nix; then + use flake +fi diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f917da1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +.direnv + +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Ignore package tarball (built via "mix hex.build"). +p2p_chat-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..88c7dbb --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# P2pChat + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `p2p_chat` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:p2p_chat, "~> 0.1.0"} + ] +end +``` + +Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) +and published on [HexDocs](https://hexdocs.pm). Once published, the docs can +be found at . + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4bb83cc --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1778869304, + "narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d233902339c02a9c334e7e593de68855ad26c4cb", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7776d70 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "p2p-chat to troll tessa"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { system = system; }; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + elixir + elixir-ls + ]; + }; + } + ); +} diff --git a/lib/p2p_chat.ex b/lib/p2p_chat.ex new file mode 100644 index 0000000..2ba9b26 --- /dev/null +++ b/lib/p2p_chat.ex @@ -0,0 +1,18 @@ +defmodule P2pChat do + @moduledoc """ + Documentation for `P2pChat`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> P2pChat.hello() + :world + + """ + def hello do + :world + end +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..b6dc4ba --- /dev/null +++ b/mix.exs @@ -0,0 +1,28 @@ +defmodule P2pChat.MixProject do + use Mix.Project + + def project do + [ + app: :p2p_chat, + version: "0.1.0", + elixir: "~> 1.18", + start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + # Run "mix help compile.app" to learn about applications. + def application do + [ + extra_applications: [:logger] + ] + end + + # Run "mix help deps" to learn about dependencies. + defp deps do + [ + # {:dep_from_hexpm, "~> 0.3.0"}, + # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} + ] + end +end diff --git a/test/p2p_chat_test.exs b/test/p2p_chat_test.exs new file mode 100644 index 0000000..93f1335 --- /dev/null +++ b/test/p2p_chat_test.exs @@ -0,0 +1,8 @@ +defmodule P2pChatTest do + use ExUnit.Case + doctest P2pChat + + test "greets the world" do + assert P2pChat.hello() == :world + end +end diff --git a/test/test_helper.exs b/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start()