-
-
Notifications
You must be signed in to change notification settings - Fork 2
Updated flake.nix and added to gitignore #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,3 +54,7 @@ AppDir | |
| .cache | ||
| imgui.ini | ||
| compile_commands.json | ||
|
|
||
| # Flake.nix stuff | ||
| result | ||
| result-* | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,28 +3,83 @@ | |
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
| }; | ||
|
|
||
| outputs = { self, nixpkgs }: { | ||
| packages.x86_64-linux.oshot = | ||
| with import nixpkgs { system = "x86_64-linux"; }; | ||
| stdenv.mkDerivation { | ||
| name = "oshot"; | ||
| src = self; | ||
| nativeBuildInputs = [ cmake gnumake pkg-config git ]; | ||
| buildInputs = [ glfw3 leptonica libx11.dev tesseract zbar.dev libappindicator-gtk3.dev dbus.dev systemd.dev libsysprof-capture pcre2.dev libxdmcp.dev libuuid.dev libselinux.dev libsepol.dev libthai.dev libdatrie.dev libdeflate lerc.dev xz.dev zstd.dev libwebp libxkbcommon.dev libepoxy.dev libxtst giflib ]; | ||
| configurePhase = '' | ||
| cmake -DCMAKE_BUILD_PREFIX=/usr -DDEBUG=0 -G "Unix Makefiles" -B build -S . | ||
| ''; | ||
| buildPhase = '' | ||
| cmake --build build -j$(nproc) | ||
| ''; | ||
| installPhase = '' | ||
| install -Dm755 build/oshot $out/bin/oshot | ||
| install -Dm644 oshot.desktop $out/share/applications/oshot.desktop | ||
| install -Dm644 LICENSE $out/share/licenses/oshot/LICENSE | ||
| ''; | ||
| }; | ||
| packages.x86_64-linux.default = self.packages.x86_64-linux.oshot; | ||
| oshot-src = { | ||
| url = "github:Toni500github/oshot"; | ||
| flake = false; | ||
| }; | ||
| }; | ||
|
|
||
| outputs = { self, nixpkgs, oshot-src }: | ||
| let | ||
| supportedSystems = [ "x86_64-linux" ]; | ||
| forAllSystems = nixpkgs.lib.genAttrs supportedSystems; | ||
| nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); | ||
| in | ||
| { | ||
| packages = forAllSystems (system: | ||
| let | ||
| pkgs = nixpkgsFor.${system}; | ||
| in | ||
| { | ||
| oshot = pkgs.stdenv.mkDerivation { | ||
| pname = "oshot"; | ||
| version = "0.1.0"; | ||
|
|
||
| src = oshot-src; | ||
|
|
||
| nativeBuildInputs = with pkgs; [ | ||
| cmake | ||
| gnumake | ||
| pkg-config | ||
| git | ||
| wrapGAppsHook3 | ||
| ]; | ||
|
|
||
| buildInputs = with pkgs; [ | ||
| glfw3 | ||
| leptonica | ||
| tesseract | ||
| zbar | ||
| gtk3 | ||
| libappindicator-gtk3 | ||
| dbus | ||
| systemd | ||
| libX11 | ||
| libXtst | ||
| giflib | ||
| libwebp | ||
| libsysprof-capture | ||
| libXdmcp | ||
| zenity | ||
| ]; | ||
|
|
||
| # Initialize git AND add a tag so `git describe` works | ||
| preConfigure = '' | ||
| git init | ||
| git config user.name "Nix" | ||
| git config user.email "nix@localhost" | ||
| git add . | ||
| git commit -m "dummy commit for build" | ||
| git tag -a v0.1.0 -m "v0.1.0" | ||
| ''; | ||
|
|
||
| installPhase = '' | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that the flake still only considers oshot being built without plugins support. I don't use nixOS so idk, but is it possible to pass an argument to wether to build or not with plugins support? Thus install the shared libraries too?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, nix has support for different branches natively, but installing shared libraries has to be manually configured. I would have to do a bit more testing to make sure it works for that. |
||
| runHook preInstall | ||
|
|
||
| install -Dm755 oshot $out/bin/oshot | ||
| if [ -f oshot.desktop ]; then | ||
| install -Dm644 oshot.desktop $out/share/applications/oshot.desktop | ||
| fi | ||
| if [ -f LICENSE ]; then | ||
| install -Dm644 LICENSE $out/share/licenses/oshot/LICENSE | ||
| fi | ||
|
|
||
| runHook postInstall | ||
| ''; | ||
| }; | ||
|
|
||
| default = self.packages.${system}.oshot; | ||
| }); | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are at version v0.5.0-rc1. Is this related to oshot's package version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is related to the oshot package version. Forgot to adjust it.