Skip to content

Commit

Permalink
river: init (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrgz committed Jun 8, 2023
1 parent ba45a9d commit b2d1d72
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Commands like `nix run ...`, `nix develop ...`, and others, when using our flake
mpv-vapoursynth
openmohaa
proton-ge-custom # recommended option: chaotic.steam.extraCompatPackages
river_git
sway-unwrapped_git
sway_git # and -unwrapped_git
swaylock-plugin_git
Expand Down
18 changes: 18 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
flake = false;
};

river-git-src = {
url = "github:riverwm/river/master";
flake = false;
};

sway-git-src = {
url = "github:swaywm/sway/master";
flake = false;
Expand Down
2 changes: 2 additions & 0 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ in
protonGeTitle = "Proton-GE";
};

river_git = callOverride ../pkgs/river-git { };

sway-unwrapped_git = callOverride ../pkgs/sway-unwrapped-git { };
sway_git = prev.sway.override {
sway-unwrapped = final.sway-unwrapped_git;
Expand Down
41 changes: 41 additions & 0 deletions pkgs/river-git/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ inputs
, nyxUtils
, prev
, final
, ...
}:
let
src = builtins.fromJSON (builtins.readFile ./src.json);
zig-wayland = final.fetchFromGitHub {
owner = "ifreund";
repo = "zig-wayland";
inherit (src.zig-wayland) rev hash;
};
zig-pixman = final.fetchFromGitHub {
owner = "ifreund";
repo = "zig-pixman";
inherit (src.zig-pixman) rev hash;
};
zig-xkbcommon = final.fetchFromGitHub {
owner = "ifreund";
repo = "zig-xkbcommon";
inherit (src.zig-xkbcommon) rev hash;
};
zig-wlroots = final.fetchFromGitHub {
owner = "swaywm";
repo = "zig-wlroots";
inherit (src.zig-wlroots) rev hash;
};
in
prev.river.overrideAttrs (prevAttrs: rec {
version = nyxUtils.gitToVersion src;
src = inputs.river-git-src;
postUnpack = ''
cp -R --no-preserve=mode,ownership ${zig-wayland}/* source/deps/zig-wayland
cp -R --no-preserve=mode,ownership ${zig-pixman}/* source/deps/zig-pixman
cp -R --no-preserve=mode,ownership ${zig-xkbcommon}/* source/deps/zig-xkbcommon
cp -R --no-preserve=mode,ownership ${zig-wlroots}/* source/deps/zig-wlroots
patchShebangs source
'';
passthru.updateScript = ./update.sh;
})
18 changes: 18 additions & 0 deletions pkgs/river-git/src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"zig-wayland": {
"rev": "d507189f623507981f4f5b6a0f8b21b12b9c07e4",
"hash": "sha256-IAbZj4WwFE37f2kpnS4aMfpfN4OA34LCciF1MGPDZdk="
},
"zig-pixman": {
"rev": "4a49ba13eb9ebb0c0f991de924328e3d615bf283",
"hash": "sha256-2iuK2DVu5w29eDHnlVyWt4d6as6gjVqhg+1/TxRmkZ8="
},
"zig-xkbcommon": {
"rev": "bfd1f97c277c32fddb77dee45979d2f472595d19",
"hash": "sha256-2fEMbN86alYN6JLRVL/0dbgp/Qo5M3uXKc5RGIUGGC4="
},
"zig-wlroots": {
"rev": "d6c070a9efa600d313eacd784689faaeb1165422",
"hash": "sha256-IfS7m4PQBMobzvUNf1dJ6qu4qFDtrBi8C5tk0EP5CV8="
}
}
30 changes: 30 additions & 0 deletions pkgs/river-git/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p busybox curl jq moreutils nix-prefetch-git
set -eo pipefail

# Define the file path
json_file=./src.json

# Define the repository information
repositories=(
"ifreund/zig-wayland"
"ifreund/zig-pixman"
"ifreund/zig-xkbcommon"
"swaywm/zig-wlroots"
)

# Loop through repositories
for repo_info in "${repositories[@]}"; do
# Split repository information into name and URL
IFS='/' read -ra repo <<< "$repo_info"
repo_name=${repo[1]}

# Fetch repository information
repo_data=$(nix-prefetch-git https://github.com/$repo_info --quiet)
repo_rev=$(jq -r '.rev' <<< "$repo_data")
repo_hash=$(nix-hash --type sha256 --to-sri $(jq -r '.sha256' <<< "$repo_data"))

# Update JSON file using jq
jq --arg name "$repo_name" --arg rev "$repo_rev" --arg hash "$repo_hash" \
'.[$name] = { "rev": $rev, "hash": $hash }' "$json_file" | sponge "$json_file"
done

0 comments on commit b2d1d72

Please sign in to comment.