From 22267e6c2e7507d9ab2d0cd7e008440a5ff12f0b Mon Sep 17 00:00:00 2001 From: matt1432 Date: Mon, 24 Jun 2024 11:38:30 -0400 Subject: [PATCH] refactor: remove precise inputs from lib.nix --- common/home/neovim/langs/markdown.nix | 6 +----- common/home/neovim/langs/web.nix | 6 +----- home/firefox/default.nix | 3 ++- home/firefox/firefox-gx/default.nix | 10 ++++----- home/mpv/default.nix | 7 +++++-- home/mpv/scripts/kdialog-open-files.nix | 2 +- home/mpv/scripts/modernx.nix | 8 +++++--- home/mpv/scripts/persist-properties.nix | 5 +++-- home/mpv/scripts/pointer-event.nix | 5 +++-- home/mpv/scripts/touch-gestures.nix | 5 +++-- home/mpv/scripts/undo-redo.nix | 5 +++-- lib.nix | 27 ++++++++++++------------- modules/ratbag-mice.nix | 4 ++-- 13 files changed, 47 insertions(+), 46 deletions(-) diff --git a/common/home/neovim/langs/markdown.nix b/common/home/neovim/langs/markdown.nix index 0e1b2054..168fafe4 100644 --- a/common/home/neovim/langs/markdown.nix +++ b/common/home/neovim/langs/markdown.nix @@ -8,11 +8,7 @@ inherit (config.vars) neovimIde; inherit (pkgs) vimPlugins; - buildPlugin = pname: src: - pkgs.vimUtils.buildVimPlugin { - inherit pname src; - version = src.shortRev; - }; + inherit (import ../../../../lib.nix {inherit pkgs;}) buildPlugin; in lib.mkIf neovimIde { programs = { diff --git a/common/home/neovim/langs/web.nix b/common/home/neovim/langs/web.nix index d04a0050..fb05d495 100644 --- a/common/home/neovim/langs/web.nix +++ b/common/home/neovim/langs/web.nix @@ -9,11 +9,7 @@ inherit (config.vars) neovimIde; inherit (pkgs) vimPlugins; - buildPlugin = pname: src: - pkgs.vimUtils.buildVimPlugin { - inherit pname src; - version = src.shortRev; - }; + inherit (import ../../../../lib.nix {inherit pkgs;}) buildPlugin; in lib.mkIf neovimIde { programs = { diff --git a/home/firefox/default.nix b/home/firefox/default.nix index 9387697e..f971fb3e 100644 --- a/home/firefox/default.nix +++ b/home/firefox/default.nix @@ -5,11 +5,12 @@ ... }: let inherit (config.vars) hostName; + inherit (import ../../lib.nix {}) mkVersion; firefox-addons = pkgs.recurseIntoAttrs (pkgs.callPackage ./addons {}); firefox-gx = pkgs.callPackage ./firefox-gx { - inherit firefox-gx-src; + inherit firefox-gx-src mkVersion; }; in { home.file = { diff --git a/home/firefox/firefox-gx/default.nix b/home/firefox/firefox-gx/default.nix index d3e3e008..caa9b863 100644 --- a/home/firefox/firefox-gx/default.nix +++ b/home/firefox/firefox-gx/default.nix @@ -1,11 +1,12 @@ { lib, - stdenvNoCC, firefox-gx-src, + mkVersion, + stdenvNoCC, }: stdenvNoCC.mkDerivation { pname = "firefox-gx"; - version = firefox-gx-src.shortRev; + version = mkVersion firefox-gx-src; src = firefox-gx-src; @@ -13,15 +14,14 @@ stdenvNoCC.mkDerivation { # 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 = with lib; { + meta = { description = "Firefox Theme CSS to Opera GX Lovers"; homepage = "https://github.com/Godiesc/firefox-gx"; - license = licenses.mspl; + license = lib.licenses.mspl; }; } diff --git a/home/mpv/default.nix b/home/mpv/default.nix index 3bfa6295..df8b314c 100644 --- a/home/mpv/default.nix +++ b/home/mpv/default.nix @@ -1,4 +1,7 @@ -{pkgs, ...} @ inputs: { +{pkgs, ...} @ inputs: let + inherit (import ../../lib.nix {}) mkVersion; + mpvScripts = import ./scripts (inputs // {inherit mkVersion;}); +in { # For kdialog-open-files home.packages = with pkgs; [ kdialog @@ -8,7 +11,7 @@ enable = true; # https://github.com/mpv-player/mpv/wiki/User-Scripts - scripts = with (import ./scripts inputs); [ + scripts = with mpvScripts; [ modernx # Dep of touch-gestures pointer-event diff --git a/home/mpv/scripts/kdialog-open-files.nix b/home/mpv/scripts/kdialog-open-files.nix index 6706613b..386ca331 100644 --- a/home/mpv/scripts/kdialog-open-files.nix +++ b/home/mpv/scripts/kdialog-open-files.nix @@ -5,7 +5,7 @@ }: buildLua rec { pname = "zenity-open-files"; - version = "unstable"; + version = "0.0.0"; unpackPhase = ":"; src = fetchurl { diff --git a/home/mpv/scripts/modernx.nix b/home/mpv/scripts/modernx.nix index 7e37462e..cf41746d 100644 --- a/home/mpv/scripts/modernx.nix +++ b/home/mpv/scripts/modernx.nix @@ -1,12 +1,13 @@ { - modernx-src, - makeFontsConf, buildLua, + makeFontsConf, + mkVersion, + modernx-src, ... }: buildLua (finalAttrs: { pname = "modernx"; - version = modernx-src.shortRev; + version = mkVersion modernx-src; src = modernx-src; @@ -15,6 +16,7 @@ buildLua (finalAttrs: { mkdir -p $out/share/fonts cp -r ./Material-Design-Iconic-Font.ttf $out/share/fonts ''; + passthru.extraWrapperArgs = [ "--set" "FONTCONFIG_FILE" diff --git a/home/mpv/scripts/persist-properties.nix b/home/mpv/scripts/persist-properties.nix index 53cf11d7..79fe435c 100644 --- a/home/mpv/scripts/persist-properties.nix +++ b/home/mpv/scripts/persist-properties.nix @@ -1,11 +1,12 @@ { - mpv-persist-properties-src, buildLua, + mkVersion, + mpv-persist-properties-src, ... }: buildLua { pname = "persist-properties"; - version = mpv-persist-properties-src.shortRev; + version = mkVersion mpv-persist-properties-src; src = mpv-persist-properties-src; } diff --git a/home/mpv/scripts/pointer-event.nix b/home/mpv/scripts/pointer-event.nix index dff19ae5..40554843 100644 --- a/home/mpv/scripts/pointer-event.nix +++ b/home/mpv/scripts/pointer-event.nix @@ -1,11 +1,12 @@ { - mpv-pointer-event-src, buildLua, + mkVersion, + mpv-pointer-event-src, ... }: buildLua { pname = "pointer-event"; - version = mpv-pointer-event-src.shortRev; + version = mkVersion mpv-pointer-event-src; src = mpv-pointer-event-src; } diff --git a/home/mpv/scripts/touch-gestures.nix b/home/mpv/scripts/touch-gestures.nix index 449216ec..9b437457 100644 --- a/home/mpv/scripts/touch-gestures.nix +++ b/home/mpv/scripts/touch-gestures.nix @@ -1,11 +1,12 @@ { - mpv-touch-gestures-src, buildLua, + mkVersion, + mpv-touch-gestures-src, ... }: buildLua { pname = "touch-gestures"; - version = mpv-touch-gestures-src.shortRev; + version = mkVersion mpv-touch-gestures-src; src = mpv-touch-gestures-src; } diff --git a/home/mpv/scripts/undo-redo.nix b/home/mpv/scripts/undo-redo.nix index fd4b3af7..7c4fcc62 100644 --- a/home/mpv/scripts/undo-redo.nix +++ b/home/mpv/scripts/undo-redo.nix @@ -1,11 +1,12 @@ { - eisa-scripts-src, buildLua, + eisa-scripts-src, + mkVersion, ... }: buildLua rec { pname = "undo-redo"; - version = eisa-scripts-src.shortRev; + version = mkVersion eisa-scripts-src; src = eisa-scripts-src; scriptPath = "${src}/scripts/UndoRedo.lua"; diff --git a/lib.nix b/lib.nix index 3c8f5c41..c5e55926 100644 --- a/lib.nix +++ b/lib.nix @@ -1,21 +1,20 @@ -{ - grim-hyprland, - home-manager, - nix-on-droid, - nixpkgs, - nixpkgs-wayland, - ... -} @ inputs: rec { +{...} @ inputs: rec { mkVersion = src: "0pre+" + src.shortRev; + buildPlugin = pname: src: + inputs.pkgs.vimUtils.buildVimPlugin { + inherit pname src; + version = mkVersion src; + }; + # Import pkgs from a nixpkgs mkPkgs = system: input: import input { inherit system; config.allowUnfree = true; overlays = [ - grim-hyprland.overlays.default - nixpkgs-wayland.overlays.default + inputs.grim-hyprland.overlays.default + inputs.nixpkgs-wayland.overlays.default ]; }; @@ -23,12 +22,12 @@ mkArgs = system: inputs // { - pkgs = mkPkgs system nixpkgs; + pkgs = mkPkgs system inputs.nixpkgs; }; # Default system mkNixOS = mods: - nixpkgs.lib.nixosSystem rec { + inputs.nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; specialArgs = mkArgs system; modules = @@ -40,9 +39,9 @@ }; mkNixOnDroid = mods: - nix-on-droid.lib.nixOnDroidConfiguration rec { + inputs.nix-on-droid.lib.nixOnDroidConfiguration rec { extraSpecialArgs = mkArgs "aarch64-linux"; - home-manager-path = home-manager.outPath; + home-manager-path = inputs.home-manager.outPath; pkgs = extraSpecialArgs.pkgs; modules = diff --git a/modules/ratbag-mice.nix b/modules/ratbag-mice.nix index 2b0289b0..1499c156 100644 --- a/modules/ratbag-mice.nix +++ b/modules/ratbag-mice.nix @@ -3,8 +3,8 @@ pkgs, piper-src, ... -} @ inputs: let - inherit (import ../lib.nix inputs) mkVersion; +}: let + inherit (import ../lib.nix {}) mkVersion; in { services.ratbagd = { enable = true;