This commit is contained in:
pingu 2024-05-23 00:41:31 +02:00
parent d7d21eee83
commit b3cec2fd69
10 changed files with 209 additions and 11 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

4
.formatter.exs Normal file
View File

@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

38
.gitignore vendored
View File

@ -1,12 +1,28 @@
# ---> Elixir
/_build
/cover
/deps
/doc
/.fetch
erl_crash.dump
*.ez
*.beam
/config/*.secret.exs
.elixir_ls/
# 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").
elixirsssh-*.tar
# Temporary files, for example, from tests.
/tmp/
.direnv/

View File

@ -1,2 +1,21 @@
# Elixirsssh
**TODO: Add description**
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `elixirsssh` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:elixirsssh, "~> 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/elixirsssh>.

43
flake.lock Normal file
View File

@ -0,0 +1,43 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1716312448,
"narHash": "sha256-PH3w5av8d+TdwCkiWN4UPBTxrD9MpxIQPDVWctlomVo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e381a1288138aceda0ac63db32c7be545b446921",
"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
}

52
flake.nix Normal file
View File

@ -0,0 +1,52 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = {
nixpkgs,
systems,
...
} @ inputs: let
inherit (nixpkgs) lib;
# Set the Erlang version
erlangVersion = "erlang_26";
# Set the Elixir version
elixirVersion = "elixir_1_15";
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (
system:
f (import nixpkgs {
inherit system;
overlays = [
(final: _: let
erlang = final.beam.interpreters.${erlangVersion};
beamPackages = final.beam.packages.${erlangVersion};
elixir = beamPackages.${elixirVersion};
in {
inherit erlang elixir;
inherit (beamPackages) elixir-ls hex;
})
];
})
);
in {
# packages = eachSystem (pkgs:
# );
devShells = eachSystem (
pkgs: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
erlang
elixir
elixir-ls
];
};
}
);
};
}

25
lib/elixirsssh.ex Normal file
View File

@ -0,0 +1,25 @@
defmodule Elixirsssh do
use Application
def start(_type, _args) do
IO.puts(hello())
{:ok, self()}
end
@moduledoc """
Documentation for `Elixirsssh`.
"""
@doc """
Hello world.
## Examples
iex> Elixirsssh.hello()
:world
"""
def hello do
:world
end
end

29
mix.exs Normal file
View File

@ -0,0 +1,29 @@
defmodule Elixirsssh.MixProject do
use Mix.Project
def project do
[
app: :elixirsssh,
version: "0.1.0",
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
mod: {Elixirsssh, []}
]
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

8
test/elixirsssh_test.exs Normal file
View File

@ -0,0 +1,8 @@
defmodule ElixirssshTest do
use ExUnit.Case
doctest Elixirsssh
test "greets the world" do
assert Elixirsssh.hello() == :world
end
end

1
test/test_helper.exs Normal file
View File

@ -0,0 +1 @@
ExUnit.start()