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

View file

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

View file

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

View file

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