Initial Elixir project

This commit is contained in:
bluepython508
2024-09-15 11:37:00 +01:00
commit cb207114a7
12 changed files with 200 additions and 0 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}"]
]

30
.gitignore vendored Normal file
View File

@@ -0,0 +1,30 @@
/.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/
# 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").
frajtano-*.tar
# Temporary files, for example, from tests.
/tmp/
/.nix-hex
/.nix-mix

21
README.md Normal file
View File

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

24
default.nix Normal file
View File

@@ -0,0 +1,24 @@
{
mixRelease,
fetchMixDeps,
elixir,
}:
mixRelease rec {
pname = "frajtano";
version = "0.0.1";
inherit elixir;
src = builtins.path {
path = ./.;
name = "${pname}-source";
filter = path: _type: baseNameOf path != "flake.nix" && baseNameOf path != "flake.lock";
};
mixFodDeps = fetchMixDeps {
pname = "mix-deps-${pname}";
inherit version src;
sha256 = "sha256-lknkq6b1yDOLgTpR/tPEk9UKqpqQT6H1N5g15M60nCA=";
};
ELIXIR_MAKE_CACHE_DIR = "/tmp/.elixir-make-cache";
meta.mainProgram = "${pname}";
}

39
flake.lock generated Normal file
View File

@@ -0,0 +1,39 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1721924956,
"narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=",
"path": "/nix/store/xblysc3prg1zqsi59fr36nj6wdiqryzp-source",
"rev": "5ad6a14c6bf098e98800b091668718c336effc95",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
}
},
"root": "root",
"version": 7
}

27
flake.nix Normal file
View File

@@ -0,0 +1,27 @@
{
description = "frajtano: an ssh agent multiplexer";
outputs = {
self,
nixpkgs,
systems,
}: let
inherit (nixpkgs) lib;
eachSystem = f:
lib.genAttrs (import systems) (system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
ownPkgs = self.packages.${system};
});
in {
devShells = eachSystem ({pkgs, ownPkgs, ...}: {
default = pkgs.beam.packages.erlang_26.callPackage ./shell.nix {
inherit ownPkgs;
};
});
packages = eachSystem ({pkgs, ...}: {
default = pkgs.beam.packages.erlang_26.callPackage ./default.nix {};
});
};
}

2
lib/frajtano.ex Normal file
View File

@@ -0,0 +1,2 @@
defmodule Frajtano do
end

23
mix.exs Normal file
View File

@@ -0,0 +1,23 @@
defmodule Frajtano.MixProject do
use Mix.Project
def project do
[
app: :frajtano,
version: "0.0.1",
elixir: "~> 1.16",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
def application do
[
extra_applications: [:logger]
]
end
defp deps do
[]
end
end

24
shell.nix Normal file
View File

@@ -0,0 +1,24 @@
{
lib,
pkgs,
ownPkgs,
mkShell,
elixir-ls,
inotify-tools,
}:
mkShell {
inputsFrom = [ ownPkgs.default ];
packages =
[elixir-ls]
++ lib.lists.optional (pkgs.system == "x86_64-linux") inotify-tools
++ lib.lists.optionals (pkgs.system == "aarch64-darwin") (with pkgs.darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
]);
shellHook = ''
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
'';
}

4
test/frajtano_test.exs Normal file
View File

@@ -0,0 +1,4 @@
defmodule FrajtanoTest do
use ExUnit.Case
doctest Frajtano
end

1
test/test_helper.exs Normal file
View File

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