-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
143 lines (128 loc) · 5.02 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{
description = "Open Educational Portal App for IT competency development integrated with Schulstick";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
commonPythonBuildInputs = with pkgs.python3Packages; [
pyqt5
pyqtwebengine
pillow
platformdirs
qt-material
setuptools # Provides pkg_resources
requests
pyyaml
toml
fuzzywuzzy
python-Levenshtein
dataclass-wizard
packaging # for release script
];
commonQtBuildInputs = with pkgs.qt5; [
qttools # Adds lrelease and other Qt tools
qtbase
qtwayland
qtwebchannel
];
commonBuildInputs = commonPythonBuildInputs ++ commonQtBuildInputs;
in
rec {
packages = {
schulstick-portal = pkgs.python3Packages.buildPythonApplication {
pname = "schulstick-portal";
version = "0.1.4";
src = ./.;
format = "pyproject";
# Build and install translations
preBuild = ''
for package in welcome tutor; do
cd src/$package
mkdir -p translations
for ts in translations/*.ts; do
${pkgs.qt5.qttools.dev}/bin/lrelease $ts
done
cd ../..
done
'';
# Include data files in the package
postInstall = ''
# Copy translation files
# for all translations
for package in welcome tutor; do
mkdir -p $out/${pkgs.python3.sitePackages}/$package/translations/
cp -r src/$package/translations/*.qm $out/${pkgs.python3.sitePackages}/$package/translations/
done
cp -r $src/src/vision_assistant/assets $out/${pkgs.python3.sitePackages}/vision_assistant/
'';
nativeBuildInputs = with pkgs.python3Packages; [
hatchling
pkgs.qt5.wrapQtAppsHook
pkgs.qt5.qttools # Adds lrelease
];
propagatedBuildInputs = commonBuildInputs;
doCheck = false;
};
default = packages.schulstick-portal;
};
apps = {
vision-assistant = flake-utils.lib.mkApp {
drv = self.packages.${system}.schulstick-portal;
name = "vision-assistant";
};
welcome = flake-utils.lib.mkApp {
drv = self.packages.${system}.schulstick-portal;
name = "welcome";
};
icon-finder = flake-utils.lib.mkApp {
drv = self.packages.${system}.schulstick-portal;
name = "icon-finder";
};
portal = flake-utils.lib.mkApp {
drv = self.packages.${system}.schulstick-portal;
name = "portal";
};
tutor = flake-utils.lib.mkApp {
drv = self.packages.${system}.schulstick-portal;
name = "tutor";
};
release = flake-utils.lib.mkApp {
drv = self.packages.${system}.schulstick-portal;
name = "release";
};
default = self.apps.${system}.portal;
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
python3
debian-devscripts
x11docker # for testing the debian build in a XFCE environment
] ++ commonBuildInputs;
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
QT_QPA_PLATFORM_PLUGIN_PATH="${pkgs.qt5.qtbase.bin}/lib/qt-${pkgs.qt5.qtbase.version}/plugins/platforms";
SCHULSTICK_ENV = "development";
# Add shell aliases for development convenience
shellHook = ''
export PYTHONPATH="$PWD/src:$PYTHONPATH"
alias vision-assistant="python -m vision_assistant.main"
alias welcome="python -m welcome.main"
alias icon-finder="python -m helper.icon_finder"
alias portal="python -m portal.main"
alias tutor="python -m tutor.main"
alias devserver="npx @liascript/devserver --live --input ./OER-materials" ## broken. might want use: "node dist/index.js -i ../schulstick-portal/OER-materials/"
echo "Development shell aliases available:"
echo " vision-assistant - Run the vision assistant"
echo " welcome - Run the welcome wizard"
echo " icon-finder - Run the icon finder utility"
echo " portal - Run the portal app"
echo " tutor - Run the tutor app"
echo " devserver - Run the devserver for the example courses"
'';
};
}
);
}