best practices: got rid of rec

This commit is contained in:
Danilo Reyes 2024-11-09 14:53:58 -06:00
parent 0bebf3e366
commit be0e4d7109
8 changed files with 283 additions and 243 deletions

View File

@ -124,12 +124,16 @@
wget wget
sops sops
]; ];
variables = rec { variables =
# PATH let
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share"; XDG_DATA_HOME = "\${HOME}/.local/share";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_CACHE_HOME = "\${HOME}/.cache";
in
{
# PATH
inherit XDG_DATA_HOME XDG_CONFIG_HOME XDG_CACHE_HOME;
XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_STATE_HOME = "\${HOME}/.local/state"; XDG_STATE_HOME = "\${HOME}/.local/state";
# DEV PATH # DEV PATH

View File

@ -44,14 +44,19 @@ in
nodejs nodejs
perl perl
(python311.withPackages (ps: with ps; [ tensorflow ])) (python311.withPackages (ps: with ps; [ tensorflow ]))
(perlPackages.buildPerlPackage rec { (perlPackages.buildPerlPackage (
pname = "Image-ExifTool"; let
version = "12.70"; version = "12.70";
in
{
pname = "Image-ExifTool";
inherit version;
src = fetchurl { src = fetchurl {
url = "https://exiftool.org/Image-ExifTool-${version}.tar.gz"; url = "https://exiftool.org/Image-ExifTool-${version}.tar.gz";
hash = "sha256-TLJSJEXMPj870TkExq6uraX8Wl4kmNerrSlX3LQsr/4="; hash = "sha256-TLJSJEXMPj870TkExq6uraX8Wl4kmNerrSlX3LQsr/4=";
}; };
}) }
))
]; ];
}; };
programs.msmtp = { programs.msmtp = {

View File

@ -15,9 +15,12 @@
imagemagick # photoshop what?? imagemagick # photoshop what??
]) ])
++ [ ++ [
(pkgs.python3Packages.buildPythonApplication rec { (pkgs.python3Packages.buildPythonApplication (
let
pname = "ffpb"; pname = "ffpb";
version = "0.4.1"; version = "0.4.1";
in
{
src = pkgs.python3Packages.fetchPypi { src = pkgs.python3Packages.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk=";
@ -25,7 +28,8 @@
doCheck = false; doCheck = false;
buildInputs = [ pkgs.python3Packages.setuptools ]; buildInputs = [ pkgs.python3Packages.setuptools ];
propagatedBuildInputs = [ pkgs.python3Packages.tqdm ]; propagatedBuildInputs = [ pkgs.python3Packages.tqdm ];
}) }
))
]; ];
}; };
} }

View File

@ -15,9 +15,17 @@ let
}; };
in in
{ {
nightly = qt6Packages.callPackage ./generic.nix rec { nightly = qt6Packages.callPackage ./generic.nix (
pname = "citra-nightly"; let
version = "2104"; version = "2104";
in
{
pname = "citra-nightly";
inherit
version
branch
compat-list
;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "CaptainJawZ"; owner = "CaptainJawZ";
@ -27,7 +35,7 @@ in
fetchSubmodules = true; fetchSubmodules = true;
}; };
inherit branch compat-list; }
}; );
} }
.${branch} .${branch}

View File

@ -37,7 +37,7 @@ assert lib.assertMsg (
!enableFfmpegAudioDecoder || !enableFdk !enableFfmpegAudioDecoder || !enableFdk
) "Can't enable both enableFfmpegAudioDecoder and enableFdk"; ) "Can't enable both enableFfmpegAudioDecoder and enableFdk";
stdenv.mkDerivation rec { stdenv.mkDerivation {
inherit pname version src; inherit pname version src;
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -58,9 +58,13 @@ let
gameLibraryPath = libpath + ":${addOpenGLRunpath.driverLink}/lib"; gameLibraryPath = libpath + ":${addOpenGLRunpath.driverLink}/lib";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation (
pname = "polymc" + (lib.optionalString ((lib.versions.major qt6.qtbase.version) == "5") "-qt5"); let
version = "6.1"; version = "6.1";
in
{
pname = "polymc" + (lib.optionalString ((lib.versions.major qt6.qtbase.version) == "5") "-qt5");
inherit version;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "PolyMC"; owner = "PolyMC";
@ -117,19 +121,23 @@ let
withMangohud ? true, withMangohud ? true,
withGamemode ? true, withGamemode ? true,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (
pname = "${polymc.pname}-wrapped"; let
inherit (polymc) version;
libsPath = libsPath =
(lib.makeLibraryPath (extraLibs ++ lib.optional withGamemode gamemode.lib)) (lib.makeLibraryPath (extraLibs ++ lib.optional withGamemode gamemode.lib))
+ lib.optionalString withMangohud "${mangohud + "/lib/mangohud"}"; + lib.optionalString withMangohud "${mangohud + "/lib/mangohud"}";
binsPath = lib.makeBinPath (extraPaths ++ lib.optional withMangohud mangohud); binsPath = lib.makeBinPath (extraPaths ++ lib.optional withMangohud mangohud);
waylandPreExec = writeShellScript "waylandGLFW" '' waylandPreExec = writeShellScript "waylandGLFW" ''
if [ -n "$WAYLAND_DISPLAY" ]; then if [ -n "$WAYLAND_DISPLAY" ]; then
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH" export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
fi fi
''; '';
in
{
pname = "${polymc.pname}-wrapped";
inherit (polymc) version;
inherit libsPath binsPath waylandPreExec;
src = polymc; src = polymc;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
phases = [ phases = [
@ -157,7 +165,8 @@ let
preferLocalBuild = true; preferLocalBuild = true;
inherit (polymc) meta; inherit (polymc) meta;
}; }
);
}; };
meta = with lib; { meta = with lib; {
homepage = "https://polymc.org/"; homepage = "https://polymc.org/";
@ -172,6 +181,7 @@ let
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" ];
license = licenses.gpl3Only; license = licenses.gpl3Only;
}; };
}; }
);
in in
polymc polymc

View File

@ -16,16 +16,19 @@ let
filepicker = callPackage ./filepicker.nix { }; filepicker = callPackage ./filepicker.nix { };
in in
buildNpmPackage rec { buildNpmPackage (
pname = "vdhcoapp"; let
version = "2.0.19"; version = "2.0.19";
pname = "vdhcoapp";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "aclap-dev"; owner = "aclap-dev";
repo = "vdhcoapp"; repo = "${pname}";
rev = "v${version}"; rev = "v${version}";
hash = "sha256-8xeZvqpRq71aShVogiwlVD3gQoPGseNOmz5E3KbsZxU="; hash = "sha256-8xeZvqpRq71aShVogiwlVD3gQoPGseNOmz5E3KbsZxU=";
}; };
in
{
inherit pname version src;
sourceRoot = "${src.name}/app"; sourceRoot = "${src.name}/app";
npmDepsHash = "sha256-E032U2XZdyTER6ROkBosOTn7bweDXHl8voC3BQEz8Wg="; npmDepsHash = "sha256-E032U2XZdyTER6ROkBosOTn7bweDXHl8voC3BQEz8Wg=";
@ -70,4 +73,5 @@ buildNpmPackage rec {
maintainers = with maintainers; [ wolfangaukang ]; maintainers = with maintainers; [ wolfangaukang ];
mainProgram = "vdhcoapp"; mainProgram = "vdhcoapp";
}; };
} }
)

View File

@ -8,9 +8,13 @@
glib, glib,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (
pname = "filepicker"; let
version = "1.0.1"; version = "1.0.1";
in
{
pname = "filepicker";
inherit version;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "paulrouget"; owner = "paulrouget";
@ -36,4 +40,5 @@ rustPlatform.buildRustPackage rec {
mainProgram = "filepicker"; mainProgram = "filepicker";
maintainers = with maintainers; [ hannesgith ]; maintainers = with maintainers; [ hannesgith ];
}; };
} }
)