Skip to content

Commit 4b7e82f

Browse files
author
nix
committed
add nix flake package
1 parent 7cb898d commit 4b7e82f

File tree

5 files changed

+85
-91
lines changed

5 files changed

+85
-91
lines changed

contrib/Installer/assets/main.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
json = require "json"
2-
-- MTFG LUA Wrappper Version 2.0.1
2+
-- MTFG LUA Wrappper Version 2.0.2
33

44
-- global var
55
processHandleMTFG = nil
@@ -88,8 +88,8 @@ function exec_mtfg(no_tracking)
8888
cmd = "/usr/bin/bash"
8989
table.insert(args, ofs.ExtensionDir() .. "/Python-Funscript-Editor/conda_wrapper.sh")
9090
elseif platform == "Linux, Nix" then
91-
cmd = "/usr/bin/bash"
92-
table.insert(args, ofs.ExtensionDir() .. "/Python-Funscript-Editor/nix_wrapper.sh")
91+
os.execute("chmod +x \"" .. ofs.ExtensionDir() .. "/Python-Funscript-Editor/nix_wrapper.sh" .. "\"")
92+
cmd = ofs.ExtensionDir() .. "/Python-Funscript-Editor/nix_wrapper.sh"
9393
else
9494
print("ERROR: Platform Not Implemented (", platform, ")")
9595
end

flake.lock

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 81 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,88 @@
1-
# usage: `nix develop --command zsh`
21
{
32
description = "MTFG";
43

54
inputs = {
6-
nixpkgs = {
7-
url = "github:NixOS/nixpkgs/nixos-22.05";
8-
};
9-
flake-utils = {
10-
url = "github:numtide/flake-utils";
11-
};
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
126
};
137

14-
outputs = { self, nixpkgs, flake-utils }:
15-
flake-utils.lib.eachDefaultSystem
16-
(system:
17-
let pkgs = nixpkgs.legacyPackages.${system}; in
18-
{
19-
devShells.default = import ./shell.nix { inherit pkgs; };
20-
}
21-
);
8+
outputs = { self, nixpkgs, ... }:
9+
let
10+
system = "x86_64-linux";
11+
pkgs = import nixpkgs {
12+
system = "${system}";
13+
};
14+
mtfgDependencies = with pkgs; [
15+
qt5.qtbase
16+
qt5.full
17+
qt5.wrapQtAppsHook
18+
libsForQt5.breeze-qt5
19+
libsForQt5.qt5ct
20+
customPythonPackages.pkgs.opencv4
21+
customPythonPackages.pkgs.simplification
22+
(python39.withPackages (p: with p; [
23+
coloredlogs
24+
cryptography
25+
matplotlib
26+
mpv
27+
pillow
28+
pip
29+
playsound
30+
pynput
31+
pyqt5
32+
pyqtgraph
33+
pyyaml
34+
scipy
35+
screeninfo
36+
]))
37+
];
38+
libPath = pkgs.lib.makeLibraryPath mtfgDependencies;
39+
binPath = pkgs.lib.makeBinPath mtfgDependencies;
40+
41+
customPythonPackages =
42+
let
43+
packageOverrides = self:
44+
super: {
45+
opencv4 = super.opencv4.overrideAttrs (old: rec {
46+
buildInputs = old.buildInputs ++ [ pkgs.qt5.full ];
47+
cmakeFlags = old.cmakeFlags ++ [ "-DWITH_QT=ON" ];
48+
});
49+
50+
simplification = pkgs.python39Packages.buildPythonPackage rec {
51+
pname = "simplification";
52+
version = "0.6.2";
53+
format = "wheel";
54+
55+
src = pkgs.fetchurl {
56+
url = "https://files.pythonhosted.org/packages/02/3e/829b59a5d072feb45e14879d3149a2dad743a18f83db29d8f3800a33aa64/simplification-0.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
57+
sha256 = "20fb00f219bdd33319fc7526d23ef1fb7e52a40027a010f1013dd60626282325";
58+
};
59+
60+
doCheck = false;
61+
};
62+
};
63+
in
64+
pkgs.python39.override { inherit packageOverrides; self = customPythonPackages; };
65+
in
66+
{
67+
packages.${system}.mtfg = pkgs.stdenv.mkDerivation {
68+
pname = "MTFG";
69+
version = "0.5.3";
70+
src = pkgs.fetchgit {
71+
url = "https://github.com/michael-mueller-git/Python-Funscript-Editor.git";
72+
rev = "7cb898de9fec72c7e7b0ce2c3f25ad52f1d3a24e";
73+
sha256 = "sha256-SMHaGIMkoVdc2gENR1ILV/H+BZ7yHB4yxcpVxJaY9oo=";
74+
};
75+
buildInputs = mtfgDependencies;
76+
QT_QPA_PLATFORM = "xcb";
77+
};
78+
defaultPackage.${system} = self.packages.x86_64-linux.mtfg;
79+
formatter.${system} = pkgs.nixpkgs-fmt;
80+
devShells.${system}.default = pkgs.mkShell {
81+
buildInputs = mtfgDependencies;
82+
shellHook = ''
83+
# use xwayland not wayland
84+
export QT_QPA_PLATFORM="xcb"
85+
'';
86+
};
87+
};
2288
}

nix_wrapper.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
unset LD_LIBRARY_PATH
34
root_dir="$(dirname $0)"
45
cmd="python3 `dirname $0`/funscript-editor.py"
56
echo "dir: $root_dir" > /tmp/mtfg-nix.log

shell.nix

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)