From 26e3e270704b0c96b6d2e51db16388501cb8806f Mon Sep 17 00:00:00 2001 From: Philipp Mandler Date: Fri, 15 Dec 2023 02:12:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Get=20name=20and=20version=20of?= =?UTF-8?q?=20nix=20derivations=20from=20project=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nix/common.nix | 4 ---- nix/pkgs/backend.nix | 5 +++-- nix/pkgs/frontend.nix | 5 +++-- nix/pkgs/worker.nix | 7 ++++--- 4 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 nix/common.nix diff --git a/nix/common.nix b/nix/common.nix deleted file mode 100644 index c270fb3b..00000000 --- a/nix/common.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - name = "transcribee"; - version = "0.0.1"; -} diff --git a/nix/pkgs/backend.nix b/nix/pkgs/backend.nix index ad0dce94..ade5f4f4 100644 --- a/nix/pkgs/backend.nix +++ b/nix/pkgs/backend.nix @@ -5,10 +5,11 @@ }: let common = import ../common.nix; + pyproject = builtins.fromTOML (builtins.readFile ../../backend/pyproject.toml); in python3Packages.buildPythonApplication rec { - pname = "${common.name}-backend"; - version = common.version; + pname = pyproject.project.name; + version = pyproject.project.version; src = ../..; format = "pyproject"; diff --git a/nix/pkgs/frontend.nix b/nix/pkgs/frontend.nix index cf13d8f1..3a1590c0 100644 --- a/nix/pkgs/frontend.nix +++ b/nix/pkgs/frontend.nix @@ -1,10 +1,11 @@ { pkgs, stdenv }: let common = import ../common.nix; + package = builtins.fromJSON (builtins.readFile ../../frontend/package.json); in stdenv.mkDerivation { - pname = "${common.name}-frontend"; - version = common.version; + pname = package.name; + version = package.version; src = ../..; nativeBuildInputs = [ diff --git a/nix/pkgs/worker.nix b/nix/pkgs/worker.nix index a50b9895..46b1088a 100644 --- a/nix/pkgs/worker.nix +++ b/nix/pkgs/worker.nix @@ -1,13 +1,14 @@ { config, pkgs, lib, ... }: with lib; let - common = import ../common.nix; python3Packages = pkgs.python3.pkgs; + pyproject = builtins.fromTOML (builtins.readFile ../../worker/pyproject.toml); in python3Packages.buildPythonApplication rec { - pname = "${common.name}-worker"; - version = common.version; + pname = pyproject.project.name; + version = pyproject.project.version; src = ../..; + format = "pyproject"; nativeBuildInputs = [