diff options
| -rw-r--r-- | .envrc | 1 | ||||
| -rw-r--r-- | .formatter.exs | 4 | ||||
| -rw-r--r-- | .gitignore | 26 | ||||
| -rw-r--r-- | README.md | 21 | ||||
| -rw-r--r-- | flake.lock | 91 | ||||
| -rw-r--r-- | flake.nix | 68 | ||||
| -rw-r--r-- | lib/thulani.ex | 18 | ||||
| -rw-r--r-- | mix.exs | 28 | ||||
| -rw-r--r-- | test/test_helper.exs | 1 | ||||
| -rw-r--r-- | test/thulani_test.exs | 8 |
10 files changed, 266 insertions, 0 deletions
@@ -0,0 +1 @@ +use flake 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..7389f60 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# 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/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# 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"). +thulani-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..02c4078 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Thulani + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `thulani` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:thulani, "~> 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 <https://hexdocs.pm/thulani>. + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2216148 --- /dev/null +++ b/flake.lock @@ -0,0 +1,91 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "ref": "master", + "repo": "flake-utils", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1662220400, + "narHash": "sha256-9o2OGQqu4xyLZP9K6kNe1pTHnyPz0Wr3raGYnr9AIgY=", + "owner": "nmattia", + "repo": "naersk", + "rev": "6944160c19cb591eb85bbf9b2f2768a935623ed3", + "type": "github" + }, + "original": { + "owner": "nmattia", + "ref": "master", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1669896698, + "narHash": "sha256-rS9abD7QFyDLM75IZRmUgcTjTeOxmSVdF0uVq1YFZpU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "01e21c51cf084d0fd1e13286531cb4f83fd66f0f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "naersk": "naersk", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1669862269, + "narHash": "sha256-/ar+cbAKAxd2Ng9b7EhrIMz9CP353RbmLecvyOidyUM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "bfdf688742cf984c4837dbbe1c6cbca550365613", + "type": "github" + }, + "original": { + "owner": "oxalica", + "ref": "master", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..cbfd4b2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,68 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-22.11"; + flake-utils.url = "github:numtide/flake-utils/master"; + + rust-overlay = { + url = "github:oxalica/rust-overlay/master"; + + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; + }; + + naersk = { + url = "github:nmattia/naersk/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + description = "thulani discord bot"; + + outputs = { + self, + nixpkgs, + flake-utils, + ... + } @ inputs: let + mkBuildToolchain = pkgs: pkgs.rust-bin.nightly."2022-11-20".minimal; + + deps = pkgs: with pkgs; [ + openssl + pkgconfig + libopus + postgresql + ]; + + mkPkg = pkgs: null; + + + in (flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + + overlays = [ + (import inputs.rust-overlay) + ]; + }; + + pkg = mkPkg pkgs; + + local_elixir = pkgs.elixir_1_14; + + in { + devShells.default = pkgs.mkShell { + buildInputs = (with pkgs; [ + (elixir_ls.override { elixir = local_elixir; }) + local_elixir + ]) ++ (deps pkgs); + }; + }) // { + hydraJobs = { + inherit (self.packages) x86_64-linux; + }; + } + ); +} diff --git a/lib/thulani.ex b/lib/thulani.ex new file mode 100644 index 0000000..05b10ea --- /dev/null +++ b/lib/thulani.ex @@ -0,0 +1,18 @@ +defmodule Thulani do + @moduledoc """ + Documentation for `Thulani`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> Thulani.hello() + :world + + """ + def hello do + :world + end +end @@ -0,0 +1,28 @@ +defmodule Thulani.MixProject do + use Mix.Project + + def project do + [ + app: :thulani, + version: "0.1.0", + elixir: "~> 1.14", + 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/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() diff --git a/test/thulani_test.exs b/test/thulani_test.exs new file mode 100644 index 0000000..032d9e4 --- /dev/null +++ b/test/thulani_test.exs @@ -0,0 +1,8 @@ +defmodule ThulaniTest do + use ExUnit.Case + doctest Thulani + + test "greets the world" do + assert Thulani.hello() == :world + end +end |
