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/.gitattributes b/.gitattributes new file mode 100644 index 0000000..219ced1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/flake.lock -diff +/manifest.toml -diff diff --git a/.gitignore b/.gitignore index fc5d8e3..e0b29b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ -# ---> Elixir -/_build -/cover -/deps -/doc -/.fetch -erl_crash.dump -*.ez -*.beam -/config/*.secret.exs -.elixir_ls/ +/result +/.direnv +*.beam +*.ez +/build +erl_crash.dump diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..67c1102 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gleam2nix": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1713458730, + "narHash": "sha256-1iHuPTH2CVnyNhHrns0edU8cb7O5C7BARWgkwEAfsW4=", + "owner": "mtoohey31", + "repo": "gleam2nix", + "rev": "5566163d1638faaeede739090ef4339532e5c524", + "type": "github" + }, + "original": { + "owner": "mtoohey31", + "repo": "gleam2nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712757991, + "narHash": "sha256-kR7C7Fqt3JP40h0mzmSZeWI5pk1iwqj4CSeGjnUbVHc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d6b3ddd253c578a7ab98f8011e59990f21dc3932", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "gleam2nix": "gleam2nix", + "nixpkgs": [ + "gleam2nix", + "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..8b071c3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Gleamish"; + + inputs = { + nixpkgs.follows = "gleam2nix/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + gleam2nix.url = "github:mtoohey31/gleam2nix"; + }; + + outputs = { self, nixpkgs, flake-utils, gleam2nix }: { + overlays = rec { + expects-gleam2nix = final: _: { + Gleamish = final.buildGleamProgram { + src = builtins.path { path = ./.; name = "Gleamish-src"; }; + }; + }; + default = nixpkgs.lib.composeManyExtensions [ + gleam2nix.overlays.default + expects-gleam2nix + ]; + buildInputs = with nixpkgs; [ + tree-sitter-grammars.tree-sitter-gleam + ]; + }; + } // flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + overlays = [ self.overlays.default ]; + inherit system; + }; + inherit (pkgs) Gleamish mkShell; + in + { + packages.default = Gleamish; + + devShells.default = mkShell { + inputsFrom = [ Gleamish ]; + }; + }); +} diff --git a/gleam.toml b/gleam.toml new file mode 100644 index 0000000..c566ab8 --- /dev/null +++ b/gleam.toml @@ -0,0 +1,19 @@ +name = "gleamish" +version = "1.0.0" + +# Fill out these fields if you intend to generate HTML documentation or publish +# your project to the Hex package manager. +# +# description = "" +# licences = ["Apache-2.0"] +# repository = { type = "github", user = "username", repo = "project" } +# links = [{ title = "Website", href = "https://gleam.run" }] +# +# For a full reference of all the available options, you can have a look at +# https://gleam.run/writing-gleam/gleam-toml/. + +[dependencies] +gleam_stdlib = "~> 0.34 or ~> 1.0" + +[dev-dependencies] +gleeunit = "~> 1.0" diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..37eae7c --- /dev/null +++ b/manifest.toml @@ -0,0 +1,11 @@ +# This file was generated by Gleam +# You typically do not need to edit this file + +packages = [ + { name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" }, + { name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" }, +] + +[requirements] +gleam_stdlib = { version = "~> 0.34 or ~> 1.0" } +gleeunit = { version = "~> 1.0" } diff --git a/src/gleamish.gleam b/src/gleamish.gleam new file mode 100644 index 0000000..953e75d --- /dev/null +++ b/src/gleamish.gleam @@ -0,0 +1,5 @@ +import gleam/io + +pub fn main() { + io.println("Hello from changeme!") +} diff --git a/test/gleamish_test.gleam b/test/gleamish_test.gleam new file mode 100644 index 0000000..3831e7a --- /dev/null +++ b/test/gleamish_test.gleam @@ -0,0 +1,12 @@ +import gleeunit +import gleeunit/should + +pub fn main() { + gleeunit.main() +} + +// gleeunit test functions end in `_test` +pub fn hello_world_test() { + 1 + |> should.equal(1) +}