treewide: start transitioning to nixpkgs package structure

This commit is contained in:
raf 2024-03-18 16:33:41 +03:00
commit d52fa53348
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
16 changed files with 190 additions and 63 deletions

View file

@ -0,0 +1,6 @@
# ani-cli
ani-cli is already in nixpkgs. The sole reason it's been put in this overlay is so that
I can receive the updates _as they happen_ and not wait until a maintainer bumps it up.
The source for ani-cli is updated periodically.

View file

@ -0,0 +1,43 @@
{
fetchFromGitHub,
makeWrapper,
stdenvNoCC,
lib,
gnugrep,
gnused,
wget,
fzf,
mpv,
aria2,
pins,
}: let
pin = pins.ani-cli;
in
stdenvNoCC.mkDerivation {
pname = "ani-cli";
inherit (pin) version;
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
};
nativeBuildInputs = [makeWrapper];
installPhase = ''
runHook preInstall
install -Dm755 ani-cli $out/bin/ani-cli
wrapProgram $out/bin/ani-cli \
--prefix PATH : ${lib.makeBinPath [gnugrep gnused wget fzf mpv aria2]}
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/pystardust/ani-cli";
description = "A cli tool to browse and play anime";
license = licenses.gpl3Plus;
maintainers = with maintainers; [NotAShelf];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,32 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
openssl,
...
}:
rustPlatform.buildRustPackage rec {
pname = "cloneit";
version = "0.1.0";
src = fetchFromGitHub {
owner = "alok8bb";
repo = "cloneit";
rev = version;
sha256 = "CyR/vdg6xqlxmv8jOXka3JIBhi8zafHiBOL67XLf5KM=";
};
cargoSha256 = "zhsFIU7gmP4gR5NhrFslFSvYIXH1fxJLZU8nV67PluQ=";
nativeBuildInputs = [pkg-config];
buildInputs = [openssl];
meta = {
description = "CLI tool to download specific GitHub directories or files";
homepage = "https://github.com/alok8bb/cloneit";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [NotAShelf];
};
}

View file

@ -0,0 +1,69 @@
{
lib,
fetchFromGitHub,
# python
python3,
# runtime dependencies
ffmpeg,
fzf,
mpv,
}:
python3.pkgs.buildPythonPackage {
pname = "mov-cli";
version = "2024-03-14-unstable";
pyproject = true;
src = fetchFromGitHub {
owner = "mov-cli";
repo = "mov-cli";
rev = "620c46a4426cedda1b8cd4739c8ab3faeccae187";
hash = "sha256-l2CwHbvtRZ+tktwF3+zJj4KM4tCN0sRf/o654FWs0C4=";
};
makeWrapperArgs = let
binPath = lib.makeBinPath [
ffmpeg
fzf
mpv
];
in [
"--prefix PATH : ${binPath}"
];
propagatedBuildInputs = with python3.pkgs; [
beautifulsoup4
click
colorama
httpx
krfzf-py
lxml
poetry-core
pycrypto
setuptools
six
tldextract
toml
inquirer
unidecode
];
build-system = [
python3.pkgs.setuptools-scm
];
nativeBuildInputs = [
python3.pkgs.pythonRelaxDepsHook
];
pythonRelaxDeps = [
"httpx"
"tldextract"
];
meta = {
homepage = "https://github.com/mov-cli/mov-cli";
description = "A cli tool to browse and watch movies";
license = lib.licenses.gpl3Only;
mainProgram = "mov-cli";
};
}

View file

@ -0,0 +1,47 @@
{
pins,
lib,
disableHardening ? true,
fetchFromGitHub,
stdenv,
unixtools,
}:
assert disableHardening -> lib.warn "nyxpkgs/rat disables hardening to avoid segfaults. You may want to consider overriding the package if this is undesirable" true; let
pin = pins.rat;
pname = "rat";
version = "2.0.1";
in
stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
};
# the code is so unsafe, it doesn't work with even one of hardening flags
# lol
hardeningDisable = lib.optionals disableHardening ["all"];
buildInputs = [unixtools.xxd];
buildPhase = ''
runHook preBuild
make linux_audio
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -Dm755 ./bin/rat -t "$out/bin/"
runHook postInstall
'';
meta = {
description = "rat";
homepage = "https://github.com/thinkingsand/rat";
maintainers = with lib.maintainers; [NotAShelf];
};
}

View file

@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
rofi-wayland-unwrapped,
libqalculate,
glib,
cairo,
gobject-introspection,
wrapGAppsHook,
pins,
...
}: let
pin = pins.rofi-calc;
in
stdenv.mkDerivation {
pname = "rofi-calc-wayland";
inherit (pin) version;
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
};
nativeBuildInputs = [
autoreconfHook
pkg-config
gobject-introspection
wrapGAppsHook
];
buildInputs = [
rofi-wayland-unwrapped
libqalculate
glib
cairo
];
patches = [
../../patches/0002-patch-plugin-dir.patch
];
postPatch = ''
sed "s|qalc_binary = \"qalc\"|qalc_binary = \"${libqalculate}/bin/qalc\"|" -i src/calc.c
'';
meta = with lib; {
description = "Do live calculations in rofi!";
homepage = "https://github.com/svenstaro/rofi-calc";
license = licenses.mit;
platforms = with platforms; linux;
};
}

View file

@ -0,0 +1,65 @@
{
stdenv,
lib,
fetchFromGitHub,
makeWrapper,
autoreconfHook,
pkg-config,
cairo,
glib,
libnotify,
rofi-wayland-unwrapped,
wl-clipboard,
wtype,
pins,
...
}: let
pin = pins.rofi-emoji;
in
stdenv.mkDerivation {
pname = "rofi-emoji-wayland";
inherit (pin) version;
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
};
nativeBuildInputs = [
autoreconfHook
pkg-config
makeWrapper
];
buildInputs = [
cairo
glib
libnotify
rofi-wayland-unwrapped
wl-clipboard
wtype
];
patches = [
../../patches/0002-patch-plugin-dir.patch
];
postPatch = ''
patchShebangs clipboard-adapter.sh
'';
postFixup = ''
chmod +x $out/share/rofi-emoji/clipboard-adapter.sh
wrapProgram $out/share/rofi-emoji/clipboard-adapter.sh \
--prefix PATH ":" ${lib.makeBinPath [libnotify wl-clipboard wtype]}
'';
meta = {
description = "An emoji selector plugin for Rofi";
homepage = "https://github.com/Mange/rofi-emoji";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [NotAShelf];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,36 @@
{
stdenv,
fetchurl,
unzip,
lib,
}:
stdenv.mkDerivation rec {
pname = "headscale-ui";
version = "2023.01.30-beta-1";
src = fetchurl {
url = "https://github.com/gurucomputing/${pname}/releases/download/${version}/headscale-ui.zip";
sha256 = "sha256-6SUgtSTFvJWNdsWz6AiOfUM9p33+8EhDwyqHX7O2+NQ=";
};
buildInputs = [unzip];
dontStrip = true;
unpackPhase = ''
runHook preUnpack
unzip $src
runHook postUnpack
'';
installPhase = ''
mkdir -p $out/share/
cp -r web/ $out/share/
'';
meta = {
description = "A web frontend for the headscale Tailscale-compatible coordination server";
homepage = "https://github.com/gurucomputing/headscale-ui";
license = [lib.licenses.bsd3];
};
}

View file

@ -0,0 +1,38 @@
{
pkgs,
lib,
javaJdk,
...
}: let
inherit (pkgs) stdenv;
jdk = javaJdk;
in
stdenv.mkDerivation (finalAttrs: {
pname = "reposilite-bin";
version = "3.5.8";
jar = builtins.fetchurl {
url = "https://maven.reposilite.com/releases/com/reposilite/reposilite/${finalAttrs.version}/reposilite-${finalAttrs.version}-all.jar";
sha256 = "sha256:1skbbdfcbdhlhyrg1y1fimm87kq1ws6g5xy0sxaglgky9j218c0p";
};
dontUnpack = true;
nativeBuildInputs = [pkgs.makeWrapper];
installPhase = ''
runHook preInstall
makeWrapper ${jdk}/bin/java $out/bin/reposilite \
--add-flags "-Xmx40m -jar $jar" \
--set JAVA_HOME ${jdk}
runHook postInstall
'';
meta = {
description = "A lightweight repository manager for Maven artifacts";
homepage = "https://reposilite.com";
license = lib.licenses.asl20;
mainProgram = "reposilite"; # we don't inherit pname here because it contains the -bin suffix, which the resulting binary won't have
maintainers = with lib.maintainers; [NotAShelf];
};
})

View file

@ -0,0 +1,64 @@
{
mastodon,
yq-go,
fetchurl,
...
}:
mastodon.overrideAttrs (_: {
mastodonModules = mastodon.mastodonModules.overrideAttrs (oldMods: let
# https://github.com/ronilaukkarinen/mastodon-bird-ui
birdui-version = "1.8.2";
birdui-single-column = fetchurl {
url = "https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/${birdui-version}/layout-single-column.css";
sha256 = "sha256-hzBWRRx9TjE8PdjL7WsNq46+W68kVG/4zPhUHOn0lnY=";
};
birdui-multi-column = fetchurl {
url = "https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/${birdui-version}/layout-multiple-columns.css";
sha256 = "sha256-MakviIcmIQxqQUCDtKbLXxBq4UDUSAyAo0fpcIec4HM=";
};
in {
pname = "${oldMods.pname}+themes";
postPatch = ''
# Import theme
styleDir=$PWD/app/javascript/styles
birduiDir=$styleDir/mastodon-bird-ui
mkdir -p $birduiDir
cat ${birdui-single-column} >$birduiDir/layout-single-column.scss
cat ${birdui-multi-column} >$birduiDir/layout-multiple-columns.scss
sed -i 's/theme-contrast/theme-mastodon-bird-ui-contrast/g' $birduiDir/layout-single-column.scss
sed -i 's/theme-mastodon-light/theme-mastodon-bird-ui-light/g' $birduiDir/layout-single-column.scss
sed -i 's/theme-contrast/theme-mastodon-bird-ui-contrast/g' $birduiDir/layout-multiple-columns.scss
sed -i 's/theme-mastodon-light/theme-mastodon-bird-ui-light/g' $birduiDir/layout-multiple-columns.scss
echo -e "@import 'contrast/variables';\n@import 'application';\n@import 'contrast/diff';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" >$styleDir/mastodon-bird-ui-contrast.scss
echo -e "@import 'mastodon-light/variables';\n@import 'application';\n@import 'mastodon-light/diff';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" >$styleDir/mastodon-bird-ui-light.scss
echo -e "@import 'application';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" >$styleDir/mastodon-bird-ui-dark.scss
# Build theme
echo "mastodon-bird-ui-dark: styles/mastodon-bird-ui-dark.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-light: styles/mastodon-bird-ui-light.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-contrast: styles/mastodon-bird-ui-contrast.scss" >>$PWD/config/themes.yml
'';
});
nativeBuildInputs = [yq-go];
postBuild = ''
# Make theme available
echo "mastodon-bird-ui-dark: styles/mastodon-bird-ui-dark.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-light: styles/mastodon-bird-ui-light.scss" >>$PWD/config/themes.yml
echo "mastodon-bird-ui-contrast: styles/mastodon-bird-ui-contrast.scss" >>$PWD/config/themes.yml
yq -i '.en.themes.mastodon-bird-ui-dark = "Mastodon Bird UI (Dark)"' $PWD/config/locales/en.yml
yq -i '.en.themes.mastodon-bird-ui-light = "Mastodon Bird UI (Light)"' $PWD/config/locales/en.yml
yq -i '.en.themes.mastodon-bird-ui-contrast = "Mastodon Bird UI (High contrast)"' $PWD/config/locales/en.yml
'';
})

View file

@ -0,0 +1,111 @@
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ceab4d5..146e7992 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -334,7 +334,8 @@
instead of the one least recently.
* Starlight theme (the default theme) updated to [V4][starlight-v4]
* Background transparency (alpha) is now disabled in fullscreened
- windows ([#1416][1416]).
+ windows ([#1416][1416]) by default but can be enabled with
+ `fullscreen_alpha`.
* Foot server systemd units now use the standard
graphical-session.target ([#1281][1281]).
* If `$XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock` does not exist,
diff --git a/meson.build b/meson.build
index 719352bc..eb38c0f8 100644
--- a/meson.build
+++ b/meson.build
@@ -73,6 +73,9 @@ add_project_arguments(
(get_option('b_pgo') == 'use'
? ['-DFOOT_PGO_ENABLED=1']
: []) +
+ (get_option('fullscreen_alpha')
+ ? ['-DFOOT_FULLSCREEN_ALPHA_ENABLED=1']
+ : []) +
cc.get_supported_arguments(
['-pedantic',
'-fstrict-aliasing',
@@ -374,6 +377,7 @@ summary(
'Documentation': scdoc.found(),
'Themes': get_option('themes'),
'IME': get_option('ime'),
+ 'Fullscreen alpha': get_option('fullscreen_alpha'),
'Grapheme clustering': utf8proc.found(),
'utmp backend': utmp_backend,
'utmp helper default path': utmp_default_helper_path,
diff --git a/meson_options.txt b/meson_options.txt
index ab7a07be..7919431e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,6 +7,9 @@ option('themes', type: 'boolean', value: true,
option('ime', type: 'boolean', value: true,
description: 'IME (Input Method Editor) support')
+option('fullscreen_alpha', type: 'boolean', value: false,
+ description: 'Enables transparency on fullscreen windows')
+
option('grapheme-clustering', type: 'feature',
description: 'Enables grapheme clustering using libutf8proc. Requires fcft with harfbuzz support to be useful.')
diff --git a/render.c b/render.c
index 91472027..847984a9 100644
--- a/render.c
+++ b/render.c
@@ -525,6 +525,13 @@ render_cell(struct terminal *term, pixman_image_t *pix, pixman_region32_t *damag
}
else if (cell->attrs.bg_src == COLOR_DEFAULT) {
+#if defined(FOOT_FULLSCREEN_ALPHA_ENABLED) && FOOT_FULLSCREEN_ALPHA_ENABLED
+ /*
+ * Note: I don't care about the stupid ass Wayland
+ * protocol I want transparent fullscreen windows.
+ */
+ alpha = term->colors.alpha;
+#else
if (term->window->is_fullscreen) {
/*
* Note: disable transparency when fullscreened.
@@ -562,6 +569,7 @@ render_cell(struct terminal *term, pixman_image_t *pix, pixman_region32_t *damag
} else {
alpha = term->colors.alpha;
}
+#endif
}
}
@@ -900,6 +908,10 @@ render_margin(struct terminal *term, struct buffer *buf,
const int bmargin = term->height - term->margins.bottom;
const int line_count = end_line - start_line;
+#if defined(FOOT_FULLSCREEN_ALPHA_ENABLED) && FOOT_FULLSCREEN_ALPHA_ENABLED
+ uint32_t _bg = !term->reverse ? term->colors.bg : term->colors.fg;
+ pixman_color_t bg = color_hex_to_pixman_with_alpha(_bg, term->colors.alpha);
+#else
const uint32_t _bg = !term->reverse ? term->colors.bg : term->colors.fg;
uint16_t alpha = term->colors.alpha;
@@ -909,6 +921,7 @@ render_margin(struct terminal *term, struct buffer *buf,
}
pixman_color_t bg = color_hex_to_pixman_with_alpha(_bg, alpha);
+#endif
pixman_image_fill_rectangles(
PIXMAN_OP_SRC, buf->pix[0], &bg, 4,
@@ -2817,8 +2830,14 @@ grid_render(struct terminal *term)
xassert(term->height > 0);
struct buffer_chain *chain = term->render.chains.grid;
+
+#if defined(FOOT_FULLSCREEN_ALPHA_ENABLED) && FOOT_FULLSCREEN_ALPHA_ENABLED
+ bool use_alpha = term->colors.alpha != 0xffff;
+#else
bool use_alpha = !term->window->is_fullscreen &&
term->colors.alpha != 0xffff;
+#endif
+
struct buffer *buf = shm_get_buffer(
chain, term->width, term->height, use_alpha);

View file

@ -0,0 +1,26 @@
{
lib,
fetchFromGitea,
foot,
...
}:
foot.overrideAttrs (prev: let
version = "2024-03-14-unstable";
in {
inherit version;
src = fetchFromGitea {
domain = "codeberg.org";
owner = "dnkl";
repo = "foot";
rev = "dd3bb13d97b405495465357f7b7b17c9f2bba3c2";
hash = "sha256-Pp3/cNELRYmTOQrJgHX6c+t0QkxEjoly0TLMKVj3H0E=";
};
patches = (prev.patches or []) ++ [./0001-fullscreen-transparency.patch];
mesonFlags = (prev.mesonFlags or []) ++ ["-Dfullscreen_alpha=true"];
meta = {
mainProgram = "foot";
maintainers = with lib.maintainers; [NotAShelf];
};
})