From ced9f86a4ff0f980bd7f1dab654a8bebbdf8f5c6 Mon Sep 17 00:00:00 2001 From: Samuel Martineau Date: Sun, 1 Sep 2024 15:44:44 -0400 Subject: [PATCH] Package for NixOS (#21) Fix #19 --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 18 ++++++++++++++++++ package.nix | 31 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 package.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f4bcb6f --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1721949857, + "narHash": "sha256-DID446r8KsmJhbCzx4el8d9SnPiE8qa6+eEQOJ40vR0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a1cc729dcbc31d9b0d11d86dc7436163548a9665", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "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..d27f5b3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + + outputs = + { self, nixpkgs }: + { + packages = + nixpkgs.lib.genAttrs + [ + "x86_64-linux" + "aarch64-linux" + ] + (system: rec { + bluetui = nixpkgs.legacyPackages.${system}.callPackage ./package.nix { }; + default = bluetui; + }); + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..b4def88 --- /dev/null +++ b/package.nix @@ -0,0 +1,31 @@ +{ + lib, + rustPlatform, + pkg-config, + dbus, +}: + +let + cargo = (lib.importTOML ./Cargo.toml).package; +in +rustPlatform.buildRustPackage { + pname = cargo.name; + version = cargo.version; + + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ dbus ]; + + meta = { + description = cargo.description; + homepage = cargo.homepage; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ samuel-martineau ]; + }; +}