commit 8bbfae459238bb280053ab31497a18405cc1bc97 Author: Alexander Heldt Date: Sun Nov 9 15:35:21 2025 +0100 Light of day diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload new file mode 100755 index 0000000..f6405f2 --- /dev/null +++ b/.direnv/bin/nix-direnv-reload @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e +if [[ ! -d "/home/alex/code/own/musicplayer" ]]; then + echo "Cannot find source directory; Did you move it?" + echo "(Looking for "/home/alex/code/own/musicplayer")" + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' + exit 1 +fi + +# rebuild the cache forcefully +_nix_direnv_force_reload=1 direnv exec "/home/alex/code/own/musicplayer" true + +# Update the mtime for .envrc. +# This will cause direnv to reload again - but without re-building. +touch "/home/alex/code/own/musicplayer/.envrc" + +# Also update the timestamp of whatever profile_rc we have. +# This makes sure that we know we are up to date. +touch -r "/home/alex/code/own/musicplayer/.envrc" "/home/alex/code/own/musicplayer/.direnv"/*.rc 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/.gitignore b/.gitignore new file mode 100644 index 0000000..e11c086 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.direnv +*.beam +*.ez +/build +erl_crash.dump diff --git a/README.md b/README.md new file mode 100644 index 0000000..8be69c1 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# musicplayer + +## Development + +```sh +gleam run # Run the project +gleam test # Run the tests +``` diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..70660ac --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1762596750, + "narHash": "sha256-rXXuz51Bq7DHBlfIjN7jO8Bu3du5TV+3DSADBX7/9YQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b6a8526db03f735b89dd5ff348f53f752e7ddc8e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b7fe58d --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Flake for gleam music-player"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = + { nixpkgs, ... }: + let + systems = [ "x86_64-linux" ]; + in + { + devShells = nixpkgs.lib.genAttrs systems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = pkgs.mkShell { + packages = [ + pkgs.gleam + pkgs.erlang + ]; + }; + } + ); + }; +} diff --git a/gleam.toml b/gleam.toml new file mode 100644 index 0000000..51ec110 --- /dev/null +++ b/gleam.toml @@ -0,0 +1,19 @@ +name = "musicplayer" +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 = "", repo = "" } +# links = [{ title = "Website", href = "" }] +# +# 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.44.0 and < 2.0.0" + +[dev-dependencies] +gleeunit = ">= 1.0.0 and < 2.0.0" diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..61ab519 --- /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.65.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "7C69C71D8C493AE11A5184828A77110EB05A7786EBF8B25B36A72F879C3EE107" }, + { name = "gleeunit", version = "1.9.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "DA9553CE58B67924B3C631F96FE3370C49EB6D6DC6B384EC4862CC4AAA718F3C" }, +] + +[requirements] +gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" } +gleeunit = { version = ">= 1.0.0 and < 2.0.0" } diff --git a/src/musicplayer.gleam b/src/musicplayer.gleam new file mode 100644 index 0000000..1a32321 --- /dev/null +++ b/src/musicplayer.gleam @@ -0,0 +1,5 @@ +import gleam/io + +pub fn main() -> Nil { + io.println("Hello from musicplayer!") +} diff --git a/test/musicplayer_test.gleam b/test/musicplayer_test.gleam new file mode 100644 index 0000000..fba3c88 --- /dev/null +++ b/test/musicplayer_test.gleam @@ -0,0 +1,13 @@ +import gleeunit + +pub fn main() -> Nil { + gleeunit.main() +} + +// gleeunit test functions end in `_test` +pub fn hello_world_test() { + let name = "Joe" + let greeting = "Hello, " <> name <> "!" + + assert greeting == "Hello, Joe!" +}