Skip to content

Commit

Permalink
feat(nix): add zellij-autolock as a package
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenEast committed Nov 13, 2024
1 parent 3a98274 commit f9175fb
Show file tree
Hide file tree
Showing 7 changed files with 3,575 additions and 1 deletion.
23 changes: 22 additions & 1 deletion flake.lock

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

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
nushell-src.url = "github:nushell/nushell";
nushell-src.flake = false;

rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";

ghostty-module.url = "github:clo4/ghostty-hm-module";

# eww.url = "github:elkowar/eww";
Expand Down Expand Up @@ -73,6 +76,7 @@
[
(self.overlay."${system}")
(nur.overlay)
(import rust-overlay)
# (_:_: { inherit (eww.packages."${system}") eww; })
] ++ ovs
);
Expand Down
104 changes: 104 additions & 0 deletions nix/pkgs/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,107 @@ function prefetch_from_github() {

nix-prefetch-url --print-path --type sha256 --unpack "$gh_api/$user/$repo/tarball/$tag"
}

function fetch_cargo_lock_from_store() {
echo "Fetching Cargo.lock"
local store
store=$1

cp -f "$store/Cargo.lock" ./Cargo.lock
}

function update_latest_version_from_crates_io() {
local crate name version prefetch sha store

crate="$1"
name="${2:-$crate}"

version="$(get_latest_version_from_crates_io "$crate")"
prefetch="$(prefetch_from_crates_io "$crate" "$version")"
sha="$(printf '%s' "$prefetch" | head -n1)"
store="$(printf '%s' "$prefetch" | tail -n1)"

echo "sha: $sha"
echo "store: $store"

cat >metadata.nix <<EOF
{
pname = "$name";
version = "$version";
fetch = {
pname = "$crate";
version = "$version";
sha256 = "$sha";
};
}
EOF

fetch_cargo_lock_from_store "$store"
}

function update_latest_version_from_github() {
local user repo name version prefetch sha store

user="$1"
repo="$2"
name="${3:-$repo}"

version="$(get_latest_version_from_github "$user" "$repo")"
prefetch="$(prefetch_from_github "$user" "$repo" "$version")"
sha="$(printf '%s' "$prefetch" | head -n1)"
store="$(printf '%s' "$prefetch" | tail -n1)"

echo "sha: $sha"
echo "store: $store"

cat >metadata.nix <<EOF
{
pname = "$name";
version = "$version";
fetch = {
owner = "$user";
repo = "$repo";
rev = "$version";
sha256 = "$sha";
};
}
EOF

if [ "$RUST_APPLICATION" ]; then
fetch_cargo_lock_from_store "$store"
fi
}

function update_head_from_github() {
local user repo name rev prefetch sha store

user="$1"
repo="$2"
postfix="${3:-git}"
name="${4:-$repo}"

rev="$(get_head_from_github "$user" "$repo")"
prefetch="$(prefetch_from_github "$user" "$repo" "$rev")"
sha="$(printf '%s' "$prefetch" | head -n1)"
store="$(printf '%s' "$prefetch" | tail -n1)"

echo "sha: $sha"
echo "store: $store"

cat >metadata.nix <<EOF
{
pname = "$name";
version = "$version-$postfix";
fetch = {
owner = "$user";
repo = "$repo";
rev = "$rev";
sha256 = "$sha";
};
}
EOF

if [ "$RUST_APPLICATION" ]; then
fetch_cargo_lock_from_store "$store"
fi
}
Loading

0 comments on commit f9175fb

Please sign in to comment.