Light of day
Some checks failed
test / test (push) Has been cancelled

This commit is contained in:
Alexander Heldt
2025-11-09 15:35:21 +01:00
commit 3251ba433d
11 changed files with 176 additions and 0 deletions

19
.direnv/bin/nix-direnv-reload Executable file
View File

@@ -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

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

23
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: test
on:
push:
branches:
- master
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "27.1.2"
gleam-version: "1.12.0"
rebar3-version: "3"
# elixir-version: "1"
- run: gleam deps download
- run: gleam test
- run: gleam format --check src test

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.direnv
*.beam
*.ez
/build
erl_crash.dump

24
README.md Normal file
View File

@@ -0,0 +1,24 @@
# musicplayer
[![Package Version](https://img.shields.io/hexpm/v/musicplayer)](https://hex.pm/packages/musicplayer)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/musicplayer/)
```sh
gleam add musicplayer@1
```
```gleam
import musicplayer
pub fn main() -> Nil {
// TODO: An example of the project in use
}
```
Further documentation can be found at <https://hexdocs.pm/musicplayer>.
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```

27
flake.lock generated Normal file
View File

@@ -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
}

29
flake.nix Normal file
View File

@@ -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
];
};
}
);
};
}

19
gleam.toml Normal file
View File

@@ -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"

11
manifest.toml Normal file
View File

@@ -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" }

5
src/musicplayer.gleam Normal file
View File

@@ -0,0 +1,5 @@
import gleam/io
pub fn main() -> Nil {
io.println("Hello from musicplayer!")
}

View File

@@ -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!"
}