commit a7d89a949913c4436688efcd7cb96d82d9a6f450 Author: NotAShelf Date: Fri Nov 3 10:25:58 2023 +0300 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bc2d76 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# ignore build symlinks +result* diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ccc5faf --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3c7a05c --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Description for the project"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = inputs @ {flake-parts, ...}: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux" "aarch64-linux"]; + imports = [./pkgs]; + + perSystem = _: {}; + + flake = {}; + }; +} diff --git a/patches/0001-foot-transparent.patch b/patches/0001-foot-transparent.patch new file mode 100644 index 0000000..da1c819 --- /dev/null +++ b/patches/0001-foot-transparent.patch @@ -0,0 +1,85 @@ +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 84a8aef4..9332efed 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -63,7 +63,7 @@ + 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 aeb2daa6..6a19db47 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', +@@ -388,6 +391,7 @@ summary( + 'Documentation': scdoc.found(), + 'Themes': get_option('themes'), + 'IME': get_option('ime'), ++ 'Fullscreen alpha': get_option('fullscreen_alpha'), + 'Grapheme clustering': utf8proc.found(), + 'Wayland: xdg-activation-v1': xdg_activation, + 'Wayland: fractional-scale-v1': fractional_scale, +diff --git a/meson_options.txt b/meson_options.txt +index d16e23ae..153c5453 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 48957a0a..21f335eb 100644 +--- a/render.c ++++ b/render.c +@@ -534,6 +534,13 @@ render_cell(struct terminal *term, pixman_image_t *pix, + } + + 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. +@@ -559,6 +566,7 @@ render_cell(struct terminal *term, pixman_image_t *pix, + } else { + alpha = term->colors.alpha; + } ++#endif + } + } + +@@ -2163,7 +2171,7 @@ render_csd_button_maximize_maximized( + { x_margin + shrink, y_margin + thick, thick, width - 2 * thick - shrink }, + { x_margin + width - thick - shrink, y_margin + thick, thick, width - 2 * thick - shrink }, + { x_margin + shrink, y_margin + width - thick - shrink, width - 2 * shrink, thick }}); +- ++ + pixman_image_unref(src); + + } + diff --git a/pkgs/ani-cli/default.nix b/pkgs/ani-cli/default.nix new file mode 100644 index 0000000..e76c1f1 --- /dev/null +++ b/pkgs/ani-cli/default.nix @@ -0,0 +1,41 @@ +{ + fetchFromGitHub, + makeWrapper, + stdenvNoCC, + lib, + gnugrep, + gnused, + wget, + fzf, + mpv, + aria2, +}: +stdenvNoCC.mkDerivation rec { + pname = "ani-cli"; + version = "4.6"; + + src = fetchFromGitHub { + owner = "pystardust"; + repo = "${pname}"; + rev = "v${version}"; + hash = "sha256-ahyCD4QsYyb3xtNK03HITeF0+hJFIHZ+PAjisuS/Kdo="; + }; + + 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; [skykanin]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/cloneit/default.nix b/pkgs/cloneit/default.nix new file mode 100644 index 0000000..4c04c82 --- /dev/null +++ b/pkgs/cloneit/default.nix @@ -0,0 +1,38 @@ +{ + 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]; + + meta2 = with lib; { + mainProgram = "cloneit"; + homepage = "https://github.com/alok8bb/cloneit"; + license = licenses.mit; + }; + + 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]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..e491bda --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,37 @@ +{ + inputs, + self, + ... +}: { + systems = ["x86_64-linux"]; + + imports = [inputs.flake-parts.flakeModules.easyOverlay]; + + perSystem = { + config, + system, + pkgs, + ... + }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }; + + packages = { + ani-cli = pkgs.callPackage ./ani-cli {}; + rat = pkgs.callPackage ./rat {}; + mov-cli = pkgs.callPackage ./mov-cli {}; + reposilite-bin = pkgs.callPackage ./reposilite-bin {}; + cloneit = pkgs.callPackage ./cloneit {}; + + foot-transparent = pkgs.foot.overrideAttrs (old: { + patches = + (old.patches or []) + ++ [ + ../patches/0001-foot-transparent.patch + ]; + }); + }; + }; +} diff --git a/pkgs/mov-cli/default.nix b/pkgs/mov-cli/default.nix new file mode 100644 index 0000000..e634c83 --- /dev/null +++ b/pkgs/mov-cli/default.nix @@ -0,0 +1,53 @@ +{ + lib, + pkgs, + python3Packages, + fetchFromGitHub, + fetchPypi, +}: +python3Packages.buildPythonPackage rec { + pname = "mov-cli"; + version = "1.5.1"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "mov-cli"; + repo = "mov-cli"; + rev = "${version}"; + hash = "sha256-ixv9guHfXy1kQbpAWAVwPtpxX5IwAQ8CQ2hvhM7sewg="; + }; + + propagatedBuildInputs = with python3Packages; [ + poetry-core + pycryptodome + lxml + six + beautifulsoup4 + tldextract + (python3Packages.httpx.overrideAttrs (_old: { + src = fetchFromGitHub { + owner = "encode"; + repo = "httpx"; + rev = "refs/tags/0.24.0"; + hash = "sha256-eLCqmYKfBZXCQvFFh5kGoO91rtsvjbydZhPNtjL3Zaw="; + }; + })) + ( + python3Packages.buildPythonPackage rec { + pname = "krfzf_py"; + version = "0.0.4"; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-W0wpR1/HRrtYC3vqEwh+Jwkgwnfa49LCFIArOXaSPCE="; + }; + } + ) + ]; + + meta = with lib; { + homepage = "https://github.com/mov-cli/mov-cli"; + description = "A cli tool to browse and watch movies"; + license = licenses.gpl3Only; + mainProgram = "mov-cli"; + }; +} diff --git a/pkgs/rat/default.nix b/pkgs/rat/default.nix new file mode 100644 index 0000000..8993e72 --- /dev/null +++ b/pkgs/rat/default.nix @@ -0,0 +1,36 @@ +{ + stdenv, + fetchurl, + gnused, + makeWrapper, + pkgs, + lib, +}: +stdenv.mkDerivation rec { + pname = "rat"; + version = "1.1"; + + src = fetchurl { + url = "https://github.com/Mcharlsto/rat/releases/download/${version}/rat"; + sha256 = "sha256-93sspjvXFPocGFPeCF1AWoWYx5hI7vMltx9SQ7x25z4="; + }; + + buildInputs = [gnused makeWrapper]; + + phases = ["installPhase" "postInstall"]; + + installPhase = '' + mkdir -p $out/bin + + cp $src $out/bin/rat + + chmod +x $out/bin/rat + + sed -i '1 s/^.*$/#\/usr\/bin\/env bash/' $out/bin/rat + ''; + + postInstall = '' + wrapProgram $out/bin/rat \ + --prefix PATH : ${lib.makeBinPath (with pkgs; [sharutils opusfile sox bash])} + ''; +} diff --git a/pkgs/reposilite-bin/default.nix b/pkgs/reposilite-bin/default.nix new file mode 100644 index 0000000..b439308 --- /dev/null +++ b/pkgs/reposilite-bin/default.nix @@ -0,0 +1,38 @@ +{ + pkgs, + lib, + javaJdk ? pkgs.openjdk17_headless, + ... +}: let + inherit (pkgs) stdenv; + + jdk = javaJdk; +in + stdenv.mkDerivation (finalAttrs: { + pname = "reposilite-bin"; + version = "3.4.10"; + + jar = builtins.fetchurl { + url = "https://maven.reposilite.com/releases/com/reposilite/reposilite/${finalAttrs.version}/reposilite-${finalAttrs.version}-all.jar"; + sha256 = "0ca6awmzsmap28l0f65h71i3kfl5jfqr4c19hadixlp5k0s8qppm"; + }; + + 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; + mainPackage = finalAttrs.pname; + maintainers = with lib.maintainers; [NotAShelf]; + }; + })