Skip to content

Commit

Permalink
🚸 Get name and version of nix derivations from project files
Browse files Browse the repository at this point in the history
  • Loading branch information
phlmn committed Dec 15, 2023
1 parent f99ad11 commit 26e3e27
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 0 additions & 4 deletions nix/common.nix

This file was deleted.

5 changes: 3 additions & 2 deletions nix/pkgs/backend.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 3 additions & 2 deletions nix/pkgs/frontend.nix
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
7 changes: 4 additions & 3 deletions nix/pkgs/worker.nix
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down

0 comments on commit 26e3e27

Please sign in to comment.