diff options
author | vaxerski <[email protected]> | 2022-06-02 19:47:54 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-06-02 19:47:54 +0200 |
commit | feb0499597602b9dfd576b987df7c43bc350aff4 (patch) | |
tree | 22852ff23c649c121ba7c9121cf869375bb8affe | |
parent | 601abc7e92521534d0ff7137275988555c561c36 (diff) | |
parent | 7451890fd71bd8e5a0abe4c22e3d7d6e1b0b2fce (diff) | |
download | Hyprland-feb0499597602b9dfd576b987df7c43bc350aff4.tar.gz Hyprland-feb0499597602b9dfd576b987df7c43bc350aff4.zip |
Merge pull request #144 from fufexan/main
Fix Nix build and add updater
-rw-r--r-- | .github/workflows/nix-update.yaml | 7 | ||||
-rw-r--r-- | flake.lock | 6 | ||||
-rw-r--r-- | flake.nix | 4 | ||||
-rw-r--r-- | nix/default.nix (renamed from default.nix) | 8 | ||||
-rw-r--r-- | nix/module.nix (renamed from module.nix) | 0 | ||||
-rwxr-xr-x | nix/update-inputs.sh | 19 |
6 files changed, 32 insertions, 12 deletions
diff --git a/.github/workflows/nix-update.yaml b/.github/workflows/nix-update.yaml index 323b34a8..91a5c686 100644 --- a/.github/workflows/nix-update.yaml +++ b/.github/workflows/nix-update.yaml @@ -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" @@ -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": { @@ -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: { diff --git a/default.nix b/nix/default.nix index cb0b7218..20586b9f 100644 --- a/default.nix +++ b/nix/default.nix @@ -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 = '' diff --git a/module.nix b/nix/module.nix index a7460b34..a7460b34 100644 --- a/module.nix +++ b/nix/module.nix diff --git a/nix/update-inputs.sh b/nix/update-inputs.sh new file mode 100755 index 00000000..8c238222 --- /dev/null +++ b/nix/update-inputs.sh @@ -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 |