Merge pull request #144 from fufexan/main

Fix Nix build and add updater
This commit is contained in:
vaxerski 2022-06-02 19:47:54 +02:00 committed by GitHub
commit feb0499597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 12 deletions

View file

@ -1,9 +1,6 @@
name: "Nix: update lockfile"
on:
schedule:
- cron: '0 0 */14 * *'
workflow_dispatch:
on: [push, workflow_dispatch]
jobs:
update:
@ -19,7 +16,7 @@ jobs:
auto-optimise-store = true
experimental-features = nix-command flakes
- name: Update lockfile
run: nix flake update
run: nix/update-inputs.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] bump flake inputs"

View file

@ -26,11 +26,11 @@
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1654018490,
"narHash": "sha256-6c/2lVXpr1qL/NAiaEwFO7kiTOMc6UJjYXtxDHifBwk=",
"lastModified": 1653658290,
"narHash": "sha256-zZaona39DOZNL93A1KG3zAi8vDttJBirxacq24hWCn4=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "ec328ca8cc82f5cac657141e31a81a590759150d",
"rev": "75d31509db8c28e8379fe9570118ef8c82284581",
"type": "gitlab"
},
"original": {

View file

@ -36,7 +36,7 @@
version = mkVersion inputs.wlroots.lastModifiedDate;
src = inputs.wlroots;
});
default = pkgsFor.${system}.callPackage ./default.nix {
default = pkgsFor.${system}.callPackage ./nix/default.nix {
version = mkVersion self.lastModifiedDate;
inherit (self.packages.${system}) wlroots;
};
@ -44,7 +44,7 @@
formatter = genSystems (system: pkgsFor.${system}.alejandra);
nixosModules.default = import ./module.nix self;
nixosModules.default = import ./nix/module.nix self;
# Deprecated
overlays.default = _: prev: {

View file

@ -24,7 +24,7 @@
stdenv.mkDerivation {
pname = "hyprland";
inherit version;
src = ./.;
src = ../.;
nativeBuildInputs = [
cmake
@ -52,8 +52,12 @@ stdenv.mkDerivation {
["-DCMAKE_BUILD_TYPE=Release"]
++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";
# enables building with nix-supplied wlroots instead of submodule
prePatch = ''
make config
sed -Ei 's/"\.\.\/wlroots\/include\/([a-zA-Z0-9./_-]+)"/<\1>/g' src/includes.hpp
'';
postPatch = ''
make protocols
'';
postBuild = ''

19
nix/update-inputs.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#moreutils nixpkgs#jq -c bash
# get wlroots revision from submodule
SUB_REV=$(git submodule status | awk '{ print substr($1,2)}')
# and from lockfile
CRT_REV=$(jq < flake.lock '.nodes.wlroots.locked.rev' -r)
if [ $SUB_REV != $CRT_REV ]; then
# update nixpkgs to latest version
nix flake lock --update-input nixpkgs
# update wlroots to submodule revision
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
# remove "dirty" mark from lockfile
jq < flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
else
echo "wlroots is up to date!"
fi