refactor: move mpv scripts and firefox addons to scopes in lgcyPkgs
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-06-26 14:47:14 -04:00
parent c928cc2a86
commit fc712b5223
21 changed files with 114 additions and 75 deletions

View file

@ -44,12 +44,15 @@ sudo ln -sf /home/matt/.nix /etc/nixos
| ---------------------------------- | ----------- |
| `nixosConfigurations` | [devices](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices)' + ISO's configurations |
| `nixOnDroidConfigurations.default` | [Nix-On-Droid](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/devices/android)'s configuration |
| `formatter` | I have yet to know if this has any uses but I format with [alejandra](https://github.com/kamadorueda/alejandra) |
| `packages` | Some custom [packages](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/pkgs) not available in nixpkgs or modified from it |
| `legacyPackages` | Some custom [package scopes](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/pkgs) not available in nixpkgs or modified from it |
| `formatter` | I format nix code with [alejandra](https://github.com/kamadorueda/alejandra) |
| `devShells.default` | A dev shell to build an ISO from the live-image nixosConfiguration |
| `devShells.ags` | A dev shell to have a NodeJS env when I enter my AGS's config directory |
### Flake Inputs
To allow use of the nix language for my inputs, I use [genflake](https://github.com/jorsn/flakegen).
To allow use of the full nix language for my inputs, I use [genflake](https://github.com/jorsn/flakegen).
Therefore, the flake I edit is located at `./flake.in.nix`.
I also prefer using a more descriptive format for my inputs like so:

View file

@ -95,10 +95,14 @@
nixOnDroidConfigurations.default = mkNixOnDroid [./devices/android];
legacyPackages = perSystem (system: pkgs: {
dracula =
legacyPackages = perSystem (system: pkgs: let
mkScope = file:
pkgs.lib.recurseIntoAttrs
(pkgs.callPackage ./pkgs/dracula ({inherit mkVersion;} // inputs));
(pkgs.callPackage file ({inherit mkVersion;} // inputs));
in {
dracula = mkScope ./pkgs/dracula;
firefoxAddons = mkScope ./pkgs/firefox-addons;
mpvScripts = mkScope ./pkgs/mpv-scripts;
});
packages =

View file

@ -1,16 +1,16 @@
{
config,
pkgs,
firefox-gx-src,
pkgs,
self,
...
}: let
inherit (config.vars) hostName;
inherit (import ../../lib.nix {}) mkVersion;
firefox-addons = pkgs.recurseIntoAttrs (pkgs.callPackage ./addons {});
inherit (self.legacyPackages.${pkgs.system}) firefoxAddons;
firefox-gx = pkgs.callPackage ./firefox-gx {
inherit firefox-gx-src mkVersion;
firefox-gx = pkgs.callPackage ./gx-theme.nix {
inherit firefox-gx-src;
};
in {
home.file = {
@ -195,7 +195,7 @@ in {
];
};
extensions = with firefox-addons; [
extensions = with firefoxAddons; [
bitwarden
checkmarks-web-ext
darkreader

View file

@ -1,27 +0,0 @@
{
lib,
firefox-gx-src,
mkVersion,
stdenvNoCC,
}:
stdenvNoCC.mkDerivation {
pname = "firefox-gx";
version = mkVersion firefox-gx-src;
src = firefox-gx-src;
installPhase = ''
# Personal changes
sed -i 's/var(--fuchsia))/var(--purple))/' ./chrome/components/ogx_root-personal.css
sed -i 's#../newtab/wallpaper-dark1.png#../newtab/wallpaper-dark2.png#' ./chrome/components/ogx_root-personal.css
mkdir -p $out
cp -r ./* $out
'';
meta = {
description = "Firefox Theme CSS to Opera GX Lovers";
homepage = "https://github.com/Godiesc/firefox-gx";
license = lib.licenses.mspl;
};
}

28
home/firefox/gx-theme.nix Normal file
View file

@ -0,0 +1,28 @@
{
lib,
firefox-gx-src,
stdenvNoCC,
}: let
inherit (import ../../lib.nix {}) mkVersion;
in
stdenvNoCC.mkDerivation {
pname = "firefox-gx";
version = mkVersion firefox-gx-src;
src = firefox-gx-src;
installPhase = ''
# Personal changes
sed -i 's/var(--fuchsia))/var(--purple))/' ./chrome/components/ogx_root-personal.css
sed -i 's#../newtab/wallpaper-dark1.png#../newtab/wallpaper-dark2.png#' ./chrome/components/ogx_root-personal.css
mkdir -p $out
cp -r ./* $out
'';
meta = {
description = "Firefox Theme CSS to Opera GX Lovers";
homepage = "https://github.com/Godiesc/firefox-gx";
license = lib.licenses.mspl;
};
}

View file

@ -1,6 +1,9 @@
{pkgs, ...} @ inputs: let
inherit (import ../../lib.nix {}) mkVersion;
mpvScripts = import ./scripts (inputs // {inherit mkVersion;});
{
pkgs,
self,
...
}: let
inherit (self.legacyPackages.${pkgs.system}) mpvScripts;
in {
# For kdialog-open-files
home.packages = with pkgs; [

View file

@ -1,16 +0,0 @@
{pkgs, ...} @ inputs: let
buildLua =
pkgs.callPackage
"${pkgs.path}/pkgs/applications/video/mpv/scripts/buildLua.nix" {};
buildLuaScript = file:
pkgs.callPackage file (inputs // {inherit buildLua;});
in
pkgs.recurseIntoAttrs {
modernx = buildLuaScript ./modernx.nix;
pointer-event = buildLuaScript ./pointer-event.nix;
touch-gestures = buildLuaScript ./touch-gestures.nix;
kdialog-open-files = buildLuaScript ./kdialog-open-files.nix;
persist-properties = buildLuaScript ./persist-properties.nix;
undo-redo = buildLuaScript ./undo-redo.nix;
}

View file

@ -19,7 +19,7 @@ in {
home-manager.users.${mainUser} = {
imports = [
../../home/foot.nix
../../home/mpv
../../home/mpv.nix
../../home/obs.nix
({config, ...}: let

24
pkgs/README.md Normal file
View file

@ -0,0 +1,24 @@
# Packages
This directory encompasses every derivations for packages exposed by my flake.
## List of my packages found in `self.packages`
| Name | Source / Description |
| ------------------------------ | -------------------- |
| `coloryou` | A custom package to get the main colors from a picture I forked from [here](https://github.com/dharmx/vile/blob/7d486c128c7e553912673755f97b118aaab0193d/src/shell/playerctl.py#L2) |
| `curseforge-server-downloader` | [Github](https://github.com/Malpiszonekx4/curseforge-server-downloader) |
| `gpu-screen-recorder` | [Git](https://git.dec05eba.com/gpu-screen-recorder/about) |
| `pam-fprint-grosshack` | [GitLab](https://gitlab.com/mishakmak/pam-fprint-grosshack) |
| `pokemon-colorscripts` | [GitLab](https://gitlab.com/phoneybadger/pokemon-colorscripts) |
| `repl` | nix repl forked from [here](https://github.com/fufexan/dotfiles/blob/main/pkgs/repl/default.nix)noint are |
| `trash-d` | [Github](https://github.com/rushsteve1/trash-d) |
## List of package scopes found in `self.legacyPackages`
| Name | Description |
| --------------- | ----------- |
| `dracula` | Themes for many apps from the [Dracula GitHub Org](https://github.com/dracula) |
| `firefoxAddons` | Firefox extensions updated with [mozilla-addons-to-nix](https://git.sr.ht/~rycee/mozilla-addons-to-nix) |
| `mpvScripts` | MPV scripts that I use that are not in nixpkgs |

View file

@ -1,7 +1,9 @@
{
fetchurl,
lib,
pkgs,
stdenv,
...
} @ args: let
buildFirefoxXpiAddon = lib.makeOverridable ({
stdenv ? args.stdenv,
@ -37,21 +39,23 @@
inherit buildFirefoxXpiAddon fetchurl lib stdenv;
};
in
packages
// {
inherit buildFirefoxXpiAddon;
lib.makeScope pkgs.newScope (_:
packages
// {
inherit buildFirefoxXpiAddon;
seventv = buildFirefoxXpiAddon {
pname = "frankerfacez";
version = "4.0";
addonId = "frankerfacez@frankerfacez.com";
url = "https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi";
sha256 = "sha256-U/yAra2c+RlGSaQtHfBz9XYsoDaJ67gmPJBsFrpqoE8=";
meta = with lib; {
homepage = "https://www.frankerfacez.com/";
description = "The Twitch Enhancement Suite. Get custom emotes and tons of new features you'll never want to go without.";
license = licenses.asl20;
platforms = platforms.all;
seventv = buildFirefoxXpiAddon {
pname = "frankerfacez";
version = "4.0";
addonId = "frankerfacez@frankerfacez.com";
url = "https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi";
sha256 = "sha256-U/yAra2c+RlGSaQtHfBz9XYsoDaJ67gmPJBsFrpqoE8=";
meta = with lib; {
homepage = "https://www.frankerfacez.com/";
description = "The Twitch Enhancement Suite. Get custom emotes and tons of new features you'll never want to go without.";
license = licenses.asl20;
platforms = platforms.all;
};
};
};
}
}
)

View file

@ -0,0 +1,16 @@
{pkgs, ...} @ inputs:
pkgs.lib.makeScope pkgs.newScope (mpv: let
buildLua =
mpv.callPackage
"${pkgs.path}/pkgs/applications/video/mpv/scripts/buildLua.nix" {};
buildLuaScript = file:
mpv.callPackage file (inputs // {inherit buildLua;});
in {
modernx = buildLuaScript ./modernx.nix;
pointer-event = buildLuaScript ./pointer-event.nix;
touch-gestures = buildLuaScript ./touch-gestures.nix;
kdialog-open-files = buildLuaScript ./kdialog-open-files.nix;
persist-properties = buildLuaScript ./persist-properties.nix;
undo-redo = buildLuaScript ./undo-redo.nix;
})

View file

@ -1,4 +1,4 @@
# modified from https://github.com/gytis-ivaskevicius/flake-utils/plus
# modified from https://github.com/fufexan/dotfiles/blob/main/pkgs/repl/default.nix
{
coreutils,
gnused,