Skip to content

Commit 44a3d85

Browse files
committed
fix(nix): patch references to package.json from python
1 parent c82ac46 commit 44a3d85

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

flake.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@
7676
ui_static = "${ui-static}";
7777
ui_templates = "${ui-templates}";
7878
})
79-
./patches/2-not-beta.patch
79+
(pkgs.replaceVars ./patches/2-not-beta.patch {
80+
inherit version;
81+
})
8082
];
8183
meta.mainProgram = "bapsicle";
8284
};

patches/2-not-beta.patch

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
diff --git a/package.py b/package.py
2-
index 1689140..bacf68f 100644
2+
index 1689140..ec4f56a 100644
33
--- a/package.py
44
+++ b/package.py
5-
@@ -12,15 +12,7 @@ with open(resolve_local_file_path("package.json")) as file:
5+
@@ -1,28 +1,6 @@
6+
# BAPSicle Details
7+
-from json import loads
8+
-from helpers.os_environment import resolve_local_file_path
69

7-
build_commit = "Dev"
8-
build_branch = "Local"
10+
-with open(resolve_local_file_path("package.json")) as file:
11+
- config = loads(file.read())
12+
- NAME: str = config["name"]
13+
- NICE_NAME: str = config["nice_name"]
14+
- DESCRIPTION: str = config["description"]
15+
- AUTHOR: str = config["author"]
16+
- LICENSE: str = config["license"]
17+
-
18+
- build_commit = "Dev"
19+
- build_branch = "Local"
920
- build_beta = True
1021
- try:
1122
- import build
@@ -15,7 +26,12 @@ index 1689140..bacf68f 100644
1526
- build_beta = build_branch != "release"
1627
- except (ModuleNotFoundError, AttributeError):
1728
- pass
18-
+ build_beta = False
19-
BUILD: str = build_commit
20-
BRANCH: str = build_branch
21-
BETA: bool = build_beta
29+
- BUILD: str = build_commit
30+
- BRANCH: str = build_branch
31+
- BETA: bool = build_beta
32+
-
33+
- VERSION: str = config["version"] + "b" if BETA else config["version"]
34+
+BUILD = "%version%"
35+
+BRANCH = "nixpkgs"
36+
+BETA = False
37+
+VERSION = "%version%"

0 commit comments

Comments
 (0)