first commit

This commit is contained in:
암냥 2026-06-23 08:36:15 +09:00
commit 10be425f9d
9 changed files with 96922 additions and 0 deletions

115
flake.nix Normal file
View file

@ -0,0 +1,115 @@
{
description = "Cross-platform TUI music player development shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ nixpkgs, ... }:
let
systems = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
perSystem =
system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
linuxAudioRuntime = lib.optionals pkgs.stdenv.isLinux [
pkgs.alsa-lib
pkgs.pulseaudio
];
tui-build = pkgs.writeShellApplication {
name = "tui-build";
runtimeInputs = [
pkgs.cmake
pkgs.ninja
];
text = ''
cmake -S . -B build -G Ninja
cmake --build build
'';
};
tui-run = pkgs.writeShellApplication {
name = "tui-run";
runtimeInputs = [
tui-build
];
text = ''
tui-build
exec ./build/tui-music-player "$@"
'';
};
tui-clean = pkgs.writeShellApplication {
name = "tui-clean";
text = ''
rm -rf build tui-music-player tui-music-player.exe
'';
};
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "tui-music-player";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [
pkgs.cmake
pkgs.ninja
];
buildInputs = linuxAudioRuntime;
cmakeFlags = [
"-G"
"Ninja"
];
installPhase = ''
runHook preInstall
install -Dm755 tui-music-player "$out/bin/tui-music-player"
runHook postInstall
'';
};
devShells.default = pkgs.mkShell {
packages =
[
pkgs.cmake
pkgs.ninja
pkgs.gnumake
pkgs.pkg-config
pkgs.clang-tools
tui-build
tui-run
tui-clean
]
++ linuxAudioRuntime;
shellHook = ''
mkdir -p music
echo "TUI Music Player devshell"
echo " tui-build - configure and build with CMake + Ninja"
echo " tui-run - build, then run ./build/tui-music-player"
echo " tui-clean - remove generated build outputs"
echo "Put audio files in ./music, then run: tui-run"
'';
};
};
in
{
packages = forAllSystems (system: (perSystem system).packages);
devShells = forAllSystems (system: (perSystem system).devShells);
};
}