A .envrc => .envrc +1 -0
M .gitignore => .gitignore +2 -0
@@ 24,3 24,5 @@ rust-project.json
# Added by cargo
/target
+
+.direnv/
M Cargo.toml => Cargo.toml +1 -0
@@ 1,5 1,6 @@
[package]
name = "mpris-ctl"
+description = "Cli control of mpris players, supporting controlling recent player with a daemon"
version = "0.1.0"
edition = "2021"
A default.nix => default.nix +40 -0
@@ 0,0 1,40 @@
+{ lib
+, naersk
+, stdenv
+, clangStdenv
+, hostPlatform
+, targetPlatform
+, pkg-config
+, dbus
+, libiconv
+, rustfmt
+, cargo
+, rustc
+}:
+
+let
+ cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
+in
+naersk.lib."${targetPlatform.system}".buildPackage rec {
+ src = ./.;
+ buildInputs = [
+ rustfmt
+ pkg-config
+ cargo
+ rustc
+ libiconv
+ dbus
+ ];
+
+ checkInputs = [ cargo rustc ];
+
+ doCheck = true;
+ copyLibs = true;
+
+ meta = {
+ description = cargoToml.package.description;
+ homepage = cargoToml.package.homepage;
+ license = [ lib.licenses.mit ];
+ maintainers = [];
+ };
+}
A flake.lock => flake.lock +48 -0
@@ 0,0 1,48 @@
+{
+ "nodes": {
+ "naersk": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1694081375,
+ "narHash": "sha256-vzJXOUnmkMCm3xw8yfPP5m8kypQ3BhAIRe4RRCWpzy8=",
+ "owner": "nmattia",
+ "repo": "naersk",
+ "rev": "3f976d822b7b37fc6fb8e6f157c2dd05e7e94e89",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nmattia",
+ "repo": "naersk",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1696757521,
+ "narHash": "sha256-cfgtLNCBLFx2qOzRLI6DHfqTdfWI+UbvsKYa3b3fvaA=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "2646b294a146df2781b1ca49092450e8a32814e1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "naersk": "naersk",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
A flake.nix => flake.nix +55 -0
@@ 0,0 1,55 @@
+{
+ description = "Mpris control utility that keeps track of the last playing player";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ naersk = {
+ url = "github:nmattia/naersk";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = { self, naersk, nixpkgs }: let
+ cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
+ supportedSystems = ["x86_64-linux"];
+ forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
+ in {
+ overlay = final: prev: {
+ "${cargoToml.package.name}" = final.callPackage ./. { inherit naersk; };
+ };
+
+ packages = forAllSystems (system:
+ let
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [
+ self.overlay
+ ];
+ };
+ in {
+ "${cargoToml.package.name}" = pkgs."${cargoToml.package.name}";
+ });
+
+ defaultPackage = forAllSystems (system:
+ self.packages."${system}"."${cargoToml.package.name}"
+ );
+
+ devShell = forAllSystems (system: let
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [
+ self.overlay
+ ];
+ };
+ in pkgs.mkShell {
+ inputsFrom = [
+ pkgs."${cargoToml.package.name}"
+ ];
+
+ buildInputs = [
+ pkgs.rustfmt
+ pkgs.nixpkgs-fmt
+ ];
+ });
+ };
+}