git/grrs/main

nix: added a nix flake

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
index ea8c4bf..2d5df85 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/target
+.direnv
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..39e06ca
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,82 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1787135253,
+ "narHash": "sha256-RD2kNWCG+Bjo6h+JVjWVNntZs2GtRoeY2xHjts/FNkA=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "ffb3c9b700e759be2ef13237c9d8f953b32a1e46",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs",
+ "rust-overlay": "rust-overlay"
+ }
+ },
+ "rust-overlay": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1787194935,
+ "narHash": "sha256-Gt6JpppReMxPGkbPcQhz+1qp+NUUf4oIwzRy+ptJgTk=",
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "rev": "cb98e96d632d0010a7e56c098c51729cb179cc75",
+ "type": "github"
+ },
+ "original": {
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "type": "github"
+ }
+ },
+ "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..7cb4a4b
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,87 @@
+{
+ description = "A minimal TUI for Gensokyo Radio";
+
+ inputs = {
+ flake-utils.url = "github:numtide/flake-utils";
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ rust-overlay.url = "github:oxalica/rust-overlay";
+ rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ outputs = {
+ self,
+ flake-utils,
+ nixpkgs,
+ rust-overlay,
+ }:
+ flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system: let
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [rust-overlay.overlays.default];
+ };
+
+ rust = pkgs.rust-bin.stable.latest.default.override {
+ extensions = ["rust-src" "rust-analyzer"];
+ };
+
+ grrs = pkgs.rustPlatform.buildRustPackage {
+ pname = "myn-grrs";
+ version = "0.1.1";
+ src = ./.;
+
+ cargoLock.lockFile = ./Cargo.lock;
+
+ nativeBuildInputs = [
+ pkgs.makeWrapper
+ pkgs.pkg-config
+ ];
+ buildInputs = [
+ pkgs.dbus
+ pkgs.openssl
+ ];
+
+ postInstall = ''
+ wrapProgram $out/bin/grrs \
+ --prefix PATH : ${pkgs.lib.makeBinPath [pkgs.mpv]}
+ '';
+
+ meta = {
+ description = "A minimal TUI for Gensokyo Radio";
+ homepage = "https://radicle.network/nodes/rosa.radicle.network/rad%3Az3dnwE7h9y4ndGdqeafNLP8eDPn3Y";
+ license = pkgs.lib.licenses.unlicense;
+ mainProgram = "grrs";
+ platforms = pkgs.lib.platforms.linux;
+ };
+ };
+
+ runApp = {
+ type = "app";
+ program = "${grrs}/bin/grrs";
+ meta = {
+ description = "A minimal TUI for Gensokyo Radio";
+ mainProgram = "grrs";
+ };
+ };
+ in {
+ packages = {
+ default = grrs;
+ inherit grrs;
+ };
+
+ apps = {
+ default = runApp;
+ grrs = runApp;
+ };
+
+ devShells.default = pkgs.mkShell {
+ packages = [
+ rust
+ pkgs.pkg-config
+ pkgs.openssl
+ pkgs.mpv
+ pkgs.dbus
+ ];
+ RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
+ };
+ });
+}