From 969870b3c3db85752643244e7d5bc644ddd0baf9 Mon Sep 17 00:00:00 2001 From: pingu Date: Fri, 5 Jun 2026 00:59:45 +0200 Subject: [PATCH] Now we have some elixir --- .envrc | 1 + .formatter.exs | 4 +++ .gitignore | 53 ++++++++++++++---------------------- README.md | 22 +++++++++++++-- flake.lock | 43 +++++++++++++++++++++++++++++ flake.nix | 59 ++++++++++++++++++++++++++++++++++++++++ lib/bunny_mask.ex | 18 ++++++++++++ mix.exs | 28 +++++++++++++++++++ test/bunny_mask_test.exs | 8 ++++++ test/test_helper.exs | 1 + 10 files changed, 202 insertions(+), 35 deletions(-) create mode 100644 .envrc create mode 100644 .formatter.exs create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 lib/bunny_mask.ex create mode 100644 mix.exs create mode 100644 test/bunny_mask_test.exs create mode 100644 test/test_helper.exs diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -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 index a8a92dc..b4018be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,38 +1,26 @@ -# ---> Elixir -/_build -/cover -/deps -/doc -/.fetch +# 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/ + +# Temporary files, for example, from tests. +/tmp/ + +# 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 -*.beam -/config/*.secret.exs -.elixir_ls/ -# ---> Phoenix -# gitignore template for Phoenix projects -# website: http://www.phoenixframework.org/ -# -# Recommended template: Elixir.gitignore - -# Temporary files -/tmp - -# Static artifacts -/node_modules -/assets/node_modules - -# Since we are building assets from web/static, -# we ignore priv/static. You may want to comment -# this depending on your deployment strategy. -/priv/static/ - -# Installer-related files -/installer/_build -/installer/tmp -/installer/doc -/installer/deps +# Ignore package tarball (built via "mix hex.build"). +bunny_mask-*.tar # ---> Nix # Ignore build outputs from performing a nix-build or `nix build` command @@ -41,4 +29,3 @@ result-* # Ignore automatically generated direnv output .direnv - diff --git a/README.md b/README.md index df5139d..1b06a0f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ -# bunny-mask +# BunnyMask + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `bunny_mask` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:bunny_mask, "~> 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 . -A ntfy.sh based weather information tool \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8a7aa89 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1780365719, + "narHash": "sha256-QfWfccTN+70ZQ4m2qlU9PiKfz2Yppq94058iJyARNwc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ffa10e26ae11d676b2db836259889f1f571cb14f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "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..5a3e2ed --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: Unlicense +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + }; + + outputs = + { nixpkgs, ... }@inputs: + let + inherit (nixpkgs) lib; + + # Set the Erlang version + beamVersion = "beam28Packages"; + # Set the Elixir version + elixirVersion = "elixir_1_20"; + + eachSystem = + f: + nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed ( + system: + f system ( + import nixpkgs { + inherit system; + overlays = [ + ( + final: _: + let + beamPackages = final.${beamVersion}; + erlang = beamPackages.erlang; + elixir = beamPackages.${elixirVersion}; + in + { + inherit erlang elixir; + inherit (beamPackages) elixir-ls hex; + } + ) + ]; + } + ) + ); + in + { + # packages = eachSystem (_system: pkgs: + # ); + + devShells = eachSystem ( + _system: pkgs: { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + erlang + elixir + elixir-ls + ]; + }; + } + ); + }; +} diff --git a/lib/bunny_mask.ex b/lib/bunny_mask.ex new file mode 100644 index 0000000..658072f --- /dev/null +++ b/lib/bunny_mask.ex @@ -0,0 +1,18 @@ +defmodule BunnyMask do + @moduledoc """ + Documentation for `BunnyMask`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> BunnyMask.hello() + :world + + """ + def hello do + :world + end +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..082ac7c --- /dev/null +++ b/mix.exs @@ -0,0 +1,28 @@ +defmodule BunnyMask.MixProject do + use Mix.Project + + def project do + [ + app: :bunny_mask, + version: "0.1.0", + elixir: "~> 1.20-rc", + 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/bunny_mask_test.exs b/test/bunny_mask_test.exs new file mode 100644 index 0000000..43a969a --- /dev/null +++ b/test/bunny_mask_test.exs @@ -0,0 +1,8 @@ +defmodule BunnyMaskTest do + use ExUnit.Case + doctest BunnyMask + + test "greets the world" do + assert BunnyMask.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()