Skip to content

Commit 43d4159

Browse files
authored
Merge pull request #211 from mipmip/master
initial flake for development with Nix
2 parents 51e4d37 + 2c0f9c2 commit 43d4159

File tree

5 files changed

+213
-0
lines changed

5 files changed

+213
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ gsettings set org.gnome.mutter center-new-windows true
108108
3. Open the project in GNOME Builder and compile it.
109109
4. Once compiled, you can run the program from the compiled executable.
110110

111+
<a href="https://nixos.org">
112+
<picture>
113+
<source srcset="https://raw.githubusercontent.com/mipmip/newelle-Assets/refs/heads/main/nix.svg" media="(prefers-color-scheme: light)">
114+
<source srcset="https://raw.githubusercontent.com/mipmip/newelle-Assets/refs/heads/main/nix-dark.svg" media="(prefers-color-scheme: dark)">
115+
<img src="https://raw.githubusercontent.com/mipmip/newelle-Assets/refs/heads/main/nix.svg" alt="builder">
116+
</picture>
117+
</a>
118+
119+
1. Install Nix on your system.
120+
2. Clone the Newelle repository from GitHub.
121+
3. In terminal change dir to repository
122+
4. run `nix run .` to start the program or run `nix develop .` to start a developer shell;
123+
111124
<a href="https://github.com/qwersyk/Newelle/actions">
112125
<picture>
113126
<source srcset="https://raw.githubusercontent.com/qwersyk/Assets/main/beta.svg" media="(prefers-color-scheme: light)">

flake.lock

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

flake.nix

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
description = "Newelle";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
6+
outputs = { self, nixpkgs, }:
7+
let
8+
overlay = import ./overlay.nix;
9+
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
10+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
11+
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; config.allowUnfree = true; overlays = [ overlay ]; });
12+
in {
13+
packages = forAllSystems (system:
14+
let
15+
pkgs = nixpkgsFor.${system};
16+
in
17+
{
18+
newelle = pkgs.callPackage ./package.nix { };
19+
});
20+
21+
defaultPackage = forAllSystems (system: self.packages.${system}.newelle);
22+
23+
devShells = forAllSystems (system:
24+
let
25+
pkgs = nixpkgsFor.${system};
26+
in
27+
{
28+
default = pkgs.mkShell {
29+
buildInputs = [
30+
self.packages.${system}.newelle
31+
];
32+
};
33+
});
34+
};
35+
}

overlay.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
(self0: super0:
2+
let
3+
myOverride = {
4+
packageOverrides = self: super: {
5+
6+
"pip-install-test" = super.buildPythonPackage rec {
7+
pname = "pip-install-test";
8+
version = "0.5";
9+
src = super0.fetchurl {
10+
url = "https://files.pythonhosted.org/packages/15/8e/4fbc92846184e1080af77da38d55928a5486e0bc5e2ec8342c7db378d7f1/pip_install_test-0.5-py3-none-any.whl";
11+
sha256 =
12+
"623887f5ce0b4695ec3c0503aa4f394253a403e2bb952417b3a778f0802dbe0b";
13+
};
14+
format = "wheel";
15+
doCheck = false;
16+
buildInputs = [ ];
17+
checkInputs = [ ];
18+
nativeBuildInputs = [ ];
19+
propagatedBuildInputs = [
20+
];
21+
};
22+
23+
"newspaper3k" = super.buildPythonPackage rec {
24+
pname = "newspaper3k";
25+
version = "0.2.8";
26+
src = super0.fetchurl {
27+
url =
28+
"https://files.pythonhosted.org/packages/d7/b9/51afecb35bb61b188a4b44868001de348a0e8134b4dfa00ffc191567c4b9/newspaper3k-0.2.8-py3-none-any.whl";
29+
sha256 =
30+
"44a864222633d3081113d1030615991c3dbba87239f6bbf59d91240f71a22e3e";
31+
};
32+
format = "wheel";
33+
doCheck = false;
34+
buildInputs = [ ];
35+
checkInputs = [ ];
36+
nativeBuildInputs = [ ];
37+
propagatedBuildInputs = [
38+
super.feedparser
39+
super.tldextract
40+
];
41+
};
42+
43+
};
44+
};
45+
in {
46+
python3 = super0.python3.override myOverride;
47+
}
48+
)

package.nix

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
stdenv,
3+
lib,
4+
python3,
5+
meson,
6+
ninja,
7+
pkg-config,
8+
wrapGAppsHook4,
9+
docutils,
10+
desktopToDarwinBundle,
11+
vte-gtk4,
12+
dconf,
13+
gobject-introspection,
14+
gsettings-desktop-schemas,
15+
adwaita-icon-theme,
16+
gtksourceview5,
17+
desktop-file-utils,
18+
lsb-release
19+
}:
20+
21+
let
22+
pythonDependencies = with python3.pkgs; [
23+
pygobject3
24+
libxml2
25+
requests
26+
pydub
27+
gtts
28+
speechrecognition
29+
numpy
30+
matplotlib
31+
newspaper3k
32+
lxml
33+
lxml-html-clean
34+
pylatexenc
35+
pyaudio
36+
tiktoken
37+
openai
38+
ollama
39+
llama-index-core
40+
llama-index-readers-file
41+
pip-install-test
42+
];
43+
in
44+
stdenv.mkDerivation rec {
45+
pname = "newelle";
46+
version = "0.9.6";
47+
48+
format = "other";
49+
50+
src = ./.;
51+
52+
strictDeps = true;
53+
54+
nativeBuildInputs = [
55+
meson
56+
ninja
57+
gobject-introspection # for setup hook populating GI_TYPELIB_PATH
58+
docutils
59+
wrapGAppsHook4
60+
desktop-file-utils
61+
pkg-config
62+
] ++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle;
63+
64+
buildInputs =
65+
[
66+
python3
67+
vte-gtk4
68+
dconf
69+
adwaita-icon-theme
70+
gsettings-desktop-schemas
71+
gtksourceview5
72+
desktop-file-utils
73+
lsb-release
74+
];
75+
76+
preFixup = ''
77+
glib-compile-schemas $out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas
78+
gappsWrapperArgs+=(--set PYTHONPATH "${python3.pkgs.makePythonPath pythonDependencies}")
79+
patchShebangs $out/bin
80+
'';
81+
82+
meta = with lib; {
83+
homepage = "https://github.com/qwersyk/Newelle";
84+
description = "Newelle - Your Ultimate Virtual Assistant ";
85+
mainProgram = "newelle";
86+
license = licenses.gpl3;
87+
platforms = platforms.unix;
88+
};
89+
90+
}

0 commit comments

Comments
 (0)