Skip to content
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

nix: build improvements #5952

Merged
merged 6 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
# hyprland-extras

xdg-desktop-portal-hyprland
# dependencies

hyprland-protocols
;
});

Expand Down
21 changes: 4 additions & 17 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
pkgconf,
makeWrapper,
cmake,
meson,
ninja,
binutils,
cairo,
expat,
fribidi,
git,
hyprcursor,
hyprland-protocols,
hyprlang,
hyprwayland-scanner,
jq,
Expand Down Expand Up @@ -72,22 +70,12 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
postPatch = ''
# Fix hardcoded paths to /usr installation
sed -i "s#/usr#$out#" src/render/OpenGL.cpp

# Generate version.h
cp src/version.h.in src/version.h
substituteInPlace src/version.h \
--replace-warn "@HASH@" '${commit}' \
--replace-warn "@BRANCH@" "" \
--replace-warn "@MESSAGE@" "" \
--replace-warn "@DATE@" "${date}" \
--replace-warn "@TAG@" "" \
--replace-warn "@DIRTY@" '${
if commit == ""
then "dirty"
else ""
}'
'';

DATE = date;
HASH = commit;
DIRTY = if commit == "" then "dirty" else "";

nativeBuildInputs = lib.concatLists [
[
hyprwayland-scanner
Expand Down Expand Up @@ -118,7 +106,6 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
fribidi
git
hyprcursor.dev
hyprland-protocols
hyprlang
libGL
libdrm
Expand Down
14 changes: 7 additions & 7 deletions scripts/generateVersion.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
cp -fr ./src/version.h.in ./src/version.h

HASH=$(git rev-parse HEAD)
BRANCH=$(git branch --show-current)
MESSAGE=$(git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')
DATE=$(git show ${GIT_COMMIT_HASH} --no-patch --format=%cd --date=local)
DIRTY=$(git diff-index --quiet HEAD -- || echo dirty)
TAG=$(git describe --tags)
COMMITS=$(git rev-list --count HEAD)
HASH=${HASH-$(git rev-parse HEAD)}
BRANCH=${BRANCH-$(git branch --show-current)}
MESSAGE=${MESSAGE-$(git show | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')}
DATE=${DATE-$(git show --no-patch --format=%cd --date=local)}
DIRTY=${DIRTY-$(git diff-index --quiet HEAD -- || echo dirty)}
TAG=${TAG-$(git describe --tags)}
COMMITS=${COMMITS-$(git rev-list --count HEAD)}

sed -i -e "s#@HASH@#${HASH}#" ./src/version.h
sed -i -e "s#@BRANCH@#${BRANCH}#" ./src/version.h
Expand Down
Loading