Open Redhawk18 opened 1 month ago
The symlinkJoin is missing a version, try setting that
The symlinkJoin is missing a version, try setting that
What do you mean about that, That's something from nixos? I don't control that.
symlinkJoin {
name = "edopro-application-${edopro-version}";
...
i assume you'd likely need to set version
as well, for unsafeGetAttrPos
to locate
symlinkJoin { name = "edopro-application-${edopro-version}"; ...
hm I got the same error
nixpkgs on 3dopolololo [!] via ❄ impure (shell)
❯ nix-update edopro
$ nix eval --json --impure --expr
let
pkgs = import "/home/redhawk/code/nixpkgs";
args = builtins.functionArgs pkgs;
inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //
(if args ? overlays then { overlays = [ ]; } else {});
pkg = (pkgs inputs)."edopro";
sanitizePosition = x: x;
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
position = if pkg ? isRubyGem then
raw_version_position
else if pkg ? isPhpExtension then
raw_version_position
else
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
name = pkg.name;
old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
inherit raw_version_position;
filename = position.file;
line = position.line;
urls = pkg.src.urls or null;
url = pkg.src.url or null;
rev = pkg.src.rev or null;
hash = pkg.src.outputHash or null;
go_modules = pkg.goModules.outputHash or null;
go_modules_old = pkg.go-modules.outputHash or null;
cargo_deps = pkg.cargoDeps.outputHash or null;
raw_cargo_lock =
if pkg ? cargoDeps.lockFile then
let
inherit (pkg.cargoDeps) lockFile;
res = builtins.tryEval (sanitizePosition {
file = toString lockFile;
});
in
if res.success then res.value.file else false
else
null;
composer_deps = pkg.composerRepository.outputHash or null;
npm_deps = pkg.npmDeps.outputHash or null;
yarn_deps = pkg.offlineCache.outputHash or null;
maven_deps = pkg.fetchedMavenDeps.outputHash or null;
tests = builtins.attrNames (pkg.passthru.tests or {});
has_update_script = pkg.passthru.updateScript or null != null;
src_homepage = pkg.src.meta.homepage or null;
changelog = pkg.meta.changelog or null;
maintainers = pkg.meta.maintainers or null;
} --extra-experimental-features flakes nix-command
error:
… while evaluating attribute 'filename'
at «string»:23:3:
22| inherit raw_version_position;
23| filename = position.file;
| ^
24| line = position.line;
… while selecting an attribute
at «string»:23:14:
22| inherit raw_version_position;
23| filename = position.file;
| ^
24| line = position.line;
error: value is null while a set was expected
Traceback (most recent call last):
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/bin/.nix-update-wrapped", line 9, in <module>
sys.exit(main())
^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/__init__.py", line 291, in main
package = update(options)
^^^^^^^^^^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/update.py", line 339, in update
package = eval_attr(opts)
^^^^^^^^^^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/eval.py", line 205, in eval_attr
res = run(cmd)
^^^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/utils.py", line 37, in run
return subprocess.run(
^^^^^^^^^^^^^^^
File "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--expr', '\nlet\n \n pkgs = import "/home/redhawk/code/nixpkgs";\n args = builtins.functionArgs pkgs;\n inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //\n (if args ? overlays then { overlays = [ ]; } else {});\n pkg = (pkgs inputs)."edopro";\n sanitizePosition = x: x;\n\n raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);\n\n position = if pkg ? isRubyGem then\n raw_version_position\n else if pkg ? isPhpExtension then\n raw_version_position\n else\n sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);\nin {\n name = pkg.name;\n old_version = pkg.version or (builtins.parseDrvName pkg.name).version;\n inherit raw_version_position;\n filename = position.file;\n line = position.line;\n urls = pkg.src.urls or null;\n url = pkg.src.url or null;\n rev = pkg.src.rev or null;\n hash = pkg.src.outputHash or null;\n go_modules = pkg.goModules.outputHash or null;\n go_modules_old = pkg.go-modules.outputHash or null;\n cargo_deps = pkg.cargoDeps.outputHash or null;\n raw_cargo_lock =\n if pkg ? cargoDeps.lockFile then\n let\n inherit (pkg.cargoDeps) lockFile;\n res = builtins.tryEval (sanitizePosition {\n file = toString lockFile;\n });\n in\n if res.success then res.value.file else false\n else\n null;\n composer_deps = pkg.composerRepository.outputHash or null;\n npm_deps = pkg.npmDeps.outputHash or null;\n yarn_deps = pkg.offlineCache.outputHash or null;\n maven_deps = pkg.fetchedMavenDeps.outputHash or null;\n tests = builtins.attrNames (pkg.passthru.tests or {});\n has_update_script = pkg.passthru.updateScript or null != null;\n src_homepage = pkg.src.meta.homepage or null;\n changelog = pkg.meta.changelog or null;\n maintainers = pkg.meta.maintainers or null;\n}', '--extra-experimental-features', 'flakes nix-command']' returned non-zero exit status 1.
unsafeGetAttrPos
which version?
unsafeGetAttrPos
which version?
symlinkJoin {
name = "edopro-application-${edopro-version}";
version = edopro-version;
...
version = edopro-version;
❯ nix-update edopro
$ nix eval --json --impure --expr
let
pkgs = import "/home/redhawk/code/nixpkgs";
args = builtins.functionArgs pkgs;
inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //
(if args ? overlays then { overlays = [ ]; } else {});
pkg = (pkgs inputs)."edopro";
sanitizePosition = x: x;
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
position = if pkg ? isRubyGem then
raw_version_position
else if pkg ? isPhpExtension then
raw_version_position
else
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
name = pkg.name;
old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
inherit raw_version_position;
filename = position.file;
line = position.line;
urls = pkg.src.urls or null;
url = pkg.src.url or null;
rev = pkg.src.rev or null;
hash = pkg.src.outputHash or null;
go_modules = pkg.goModules.outputHash or null;
go_modules_old = pkg.go-modules.outputHash or null;
cargo_deps = pkg.cargoDeps.outputHash or null;
raw_cargo_lock =
if pkg ? cargoDeps.lockFile then
let
inherit (pkg.cargoDeps) lockFile;
res = builtins.tryEval (sanitizePosition {
file = toString lockFile;
});
in
if res.success then res.value.file else false
else
null;
composer_deps = pkg.composerRepository.outputHash or null;
npm_deps = pkg.npmDeps.outputHash or null;
yarn_deps = pkg.offlineCache.outputHash or null;
maven_deps = pkg.fetchedMavenDeps.outputHash or null;
tests = builtins.attrNames (pkg.passthru.tests or {});
has_update_script = pkg.passthru.updateScript or null != null;
src_homepage = pkg.src.meta.homepage or null;
changelog = pkg.meta.changelog or null;
maintainers = pkg.meta.maintainers or null;
} --extra-experimental-features flakes nix-command
error:
… while evaluating attribute 'filename'
at «string»:23:3:
22| inherit raw_version_position;
23| filename = position.file;
| ^
24| line = position.line;
… while selecting an attribute
at «string»:23:14:
22| inherit raw_version_position;
23| filename = position.file;
| ^
24| line = position.line;
error: value is null while a set was expected
Traceback (most recent call last):
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/bin/.nix-update-wrapped", line 9, in <module>
sys.exit(main())
^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/__init__.py", line 291, in main
package = update(options)
^^^^^^^^^^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/update.py", line 339, in update
package = eval_attr(opts)
^^^^^^^^^^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/eval.py", line 205, in eval_attr
res = run(cmd)
^^^^^^^^
File "/nix/store/17yljvqhcmbp7lzywfz70bxsnrdgayg5-nix-update-1.3.1/lib/python3.11/site-packages/nix_update/utils.py", line 37, in run
return subprocess.run(
^^^^^^^^^^^^^^^
File "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix', 'eval', '--json', '--impure', '--expr', '\nlet\n \n pkgs = import "/home/redhawk/code/nixpkgs";\n args = builtins.functionArgs pkgs;\n inputs = (if args ? system then { system = builtins.currentSystem; } else {}) //\n (if args ? overlays then { overlays = [ ]; } else {});\n pkg = (pkgs inputs)."edopro";\n sanitizePosition = x: x;\n\n raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);\n\n position = if pkg ? isRubyGem then\n raw_version_position\n else if pkg ? isPhpExtension then\n raw_version_position\n else\n sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);\nin {\n name = pkg.name;\n old_version = pkg.version or (builtins.parseDrvName pkg.name).version;\n inherit raw_version_position;\n filename = position.file;\n line = position.line;\n urls = pkg.src.urls or null;\n url = pkg.src.url or null;\n rev = pkg.src.rev or null;\n hash = pkg.src.outputHash or null;\n go_modules = pkg.goModules.outputHash or null;\n go_modules_old = pkg.go-modules.outputHash or null;\n cargo_deps = pkg.cargoDeps.outputHash or null;\n raw_cargo_lock =\n if pkg ? cargoDeps.lockFile then\n let\n inherit (pkg.cargoDeps) lockFile;\n res = builtins.tryEval (sanitizePosition {\n file = toString lockFile;\n });\n in\n if res.success then res.value.file else false\n else\n null;\n composer_deps = pkg.composerRepository.outputHash or null;\n npm_deps = pkg.npmDeps.outputHash or null;\n yarn_deps = pkg.offlineCache.outputHash or null;\n maven_deps = pkg.fetchedMavenDeps.outputHash or null;\n tests = builtins.attrNames (pkg.passthru.tests or {});\n has_update_script = pkg.passthru.updateScript or null != null;\n src_homepage = pkg.src.meta.homepage or null;\n changelog = pkg.meta.changelog or null;\n maintainers = pkg.meta.maintainers or null;\n}', '--extra-experimental-features', 'flakes nix-command']' returned non-zero exit status 1.
Let me send an updated package since I've made some of the suggested changes
{ lib
, stdenv
, fetchFromGitHub
, fetchzip
, premake5
, writeShellScriptBin
, runCommandLocal
, symlinkJoin
, imagemagick
, bzip2
, curl
, flac
, fmt_9
, freetype
, libevent
, libgit2
, libGL
, libGLU
, libjpeg
, libpng
, libvorbis
, libX11
, libxkbcommon
, libXxf86vm
, lua5_3
, mono
, nlohmann_json
, noto-fonts-cjk-sans
, openal
, SDL2
, sqlite
, wayland
, egl-wayland
, covers_url ? "https://pics.projectignis.org:2096/pics/cover/{}.jpg"
, fields_url ? "https://pics.projectignis.org:2096/pics/field/{}.png"
, font ? false
, # TODO
# While ygoprodeck has higher quality images, "spamming" of their api results in a ban.
# Thats why this link can change since it's compiled into the program, However it will
# download assets when needed so it is unlikely to get banned. Unless you search the
# card list with no filters of any kind. When testing use ProjectIgnis' website instead.
pics_url ? "https://images.ygoprodeck.com/images/cards/{}.jpg"
,
}:
let
edopro-version = "40.1.4";
assets = {
pname = "assets";
version = edopro-version;
src = fetchzip {
url = "https://github.com/ProjectIgnis/edopro-assets/releases/download/${edopro-version}/ProjectIgnis-EDOPro-${edopro-version}-linux.tar.gz";
sha256 = "sha256-vZhkWJ1ZoNEwdc5kM1S0hyXnWmupiTOanCi9DCuqw/k=";
};
};
irrlicht-edopro = stdenv.mkDerivation {
pname = "irrlicht-edopro";
version = "1.9-custom";
src = fetchFromGitHub {
owner = "edo9300";
repo = "irrlicht1-8-4";
# Found by getting the newest version before EDOPro's tagged release comes out.
rev = "7edde28d4f8c0c3589934c398a3a441286bb7c22";
hash = "sha256-Q2tNiYE/enZPqA5YhUe+Tkvmqtmmz2E0OqTRUDnt+UA=";
};
buildInputs = [
libGLU
libX11
libxkbcommon
libXxf86vm
wayland
];
enableParallelBuilding = true;
buildFlags = "NDEBUG=1";
makeFlags = "-C source/Irrlicht";
installPhase = ''
mkdir -p $out/{bin,include}
cp lib/Linux/libIrrlicht.a $out/bin
cp -r include/* $out/include
'';
};
ocgcore = stdenv.mkDerivation rec {
pname = "ygopro-core";
# Tied to the tagged version of EDOPro's git module.
version = "4a872ad7686e0d00ee4c1c051e90fc07c40613d4";
src = fetchFromGitHub {
owner = "edo9300";
repo = pname;
rev = version;
hash = "sha256-s3DOHrZilRUy6fbXObNiLRinxpdHY99vDOmS/ZfOI78=";
fetchSubmodules = true;
};
nativeBuildInputs = [ premake5 ];
buildInputs = [ lua5_3 ];
preBuild = ''
premake5 gmake2
'';
enableParallelBuilding = true;
buildFlags = "verbose=true config=release ocgcore";
makeFlags = "-C build";
installPhase = ''
mkdir -p $out/bin
cp bin/release/libocgcore.a $out/bin
'';
};
edopro = stdenv.mkDerivation rec {
pname = "edopro";
version = edopro-version;
src = fetchFromGitHub {
owner = "edo9300";
repo = pname;
rev = "c713e23491a1e55c9d8e91257e5f2b5873696b9b";
hash = "sha256-2E1cjG0FONu/fbr67/3qRCKQ1W/wPznClEWsMa1FAzo=";
fetchSubmodules = true;
};
nativeBuildInputs = [ premake5 ];
buildInputs = [
bzip2
curl
flac
fmt_9
freetype
irrlicht-edopro
libevent
libgit2
libjpeg
libpng
libvorbis
nlohmann_json
openal
SDL2
sqlite
];
# nixpkgs' gcc stack currently appears to not support LTO
postPatch = ''
sed -i '/LinkTimeOptimization/d' ./premake5.lua
'';
# ${lib.optionals font "--bundled-font=${font}"}
# ${lib.optionals font [ "--bundled-font=${noto-fonts-cjk-sans}/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc" ] }
preBuild = ''
premake5 gmake2 \
--covers=\"${covers_url}\" \
--fields=\"${fields_url}\" \
--no-core \
--pics=\"${pics_url}\" \
--prebuilt-core="${ocgcore}/bin" \
--sound=sfml
'';
enableParallelBuilding = true;
CXXFLAGS = "-include cstdint";
LDFLAGS = "-I ${irrlicht-edopro}/include -L ${irrlicht-edopro}/bin";
buildFlags = "verbose=true config=release_x64 ygoprodll";
makeFlags = "-C build";
installPhase = ''
mkdir -p $out/bin
cp bin/x64/release/ygoprodll $out/bin
'';
};
edopro-script =
let
assetsToCopy = lib.concatStringsSep "," [
# Needed if we download files from ProjectIgnis' website or any https only website.
"cacert.pem"
"config"
"deck"
"COPYING.txt"
"expansions"
"lflists"
"notices"
"puzzles"
"fonts"
"script"
"skin"
"sound"
"textures"
"WindBot"
];
in
writeShellScriptBin "EDOPro" ''
set -eu
EDOPRO_DIR="''${XDG_DATA_HOME:-$HOME/.local/share}/edopro"
if [ ! -d $EDOPRO_DIR ]; then
mkdir -p $EDOPRO_DIR
cp -r ${assets.src}/{${assetsToCopy}} $EDOPRO_DIR
find $EDOPRO_DIR -type d -exec chmod u=rwx,go-rwx {} +
find $EDOPRO_DIR -type f -exec chmod u=rw,go-rwx {} +
rm $EDOPRO_DIR/config/io.github.edo9300.EDOPro.desktop.in
fi
export PATH=PATH:'${lib.makeBinPath [ mono ]}';
export LD_LIBRARY_PATH='${
lib.makeLibraryPath [
libGL
libX11
libxkbcommon
libXxf86vm
sqlite
wayland
egl-wayland
]
}';
exec ${edopro}/bin/ygoprodll -C $EDOPRO_DIR $@
'';
edopro-desktop = runCommandLocal "io.github.edo9300.EDOPro.desktop" { } ''
cp ${assets.src}/config/io.github.edo9300.EDOPro.desktop.in desktop-template
sed '/Path=/d' -i desktop-template
sed 's/Exec=.*/Exec=EDOPro/' -i desktop-template
sed 's/Icon=.*/Icon=EDOPro/' -i desktop-template
install -D desktop-template $out/share/applications/io.github.edo9300.EDOPro.desktop
'';
in
symlinkJoin {
name = "edopro-application-${edopro-version}";
version = edopro-version;
paths = [
edopro
edopro-script
edopro-desktop
];
postBuild = ''
mkdir -p $out/share/icons/hicolor/256x256/apps/
${imagemagick}/bin/magick \
${assets.src}/textures/AppIcon.png \
-resize 256x256 \
$out/share/icons/hicolor/256x256/apps/EDOPro.png
'';
meta = with lib; {
description = "The bleeding-edge automatic duel simulator, a fork of the YGOPro client.";
homepage = "https://projectignis.github.io";
changelog = "https://github.com/edo9300/edopro/releases";
license = licenses.agpl3Plus;
maintainers = with maintainers; [
redhawk
tlater
];
mainprogram = "edopro";
platforms = [ "x86_64-linux" ];
};
}
Seems like unsafeGetAttrPos
is unable to locate the file where version
is set, and returns a null
instead. We need more information about your setup in order to debug this, like how do you evaluate this expression?
Once that error is fixed, the next error will be nix_update.errors.UpdateError: Could not find a url in the derivations src attribute
. To fix it either add the src
to passthru
, write a custom passthru.updateScript
, or reconsider the use of symlinkJoin
. edopro-script
and edopro-desktop
should be possible to inline into the edopro
derivation
Seems like
unsafeGetAttrPos
is unable to locate the file whereversion
is set, and returns anull
instead. We need more information about your setup in order to debug this, like how do you evaluate this expression?Once that error is fixed, the next error will be
nix_update.errors.UpdateError: Could not find a url in the derivations src attribute
. To fix it either add thesrc
topassthru
, write a custompassthru.updateScript
, or reconsider the use ofsymlinkJoin
.edopro-script
andedopro-desktop
should be possible to inline into theedopro
derivation
I'm not the best with nix but what I used to run nix update was nix-update edopro
in the directory of my local nixpkgs
@tlater was the person who wrote these scripts, I considered adding a custom script that was half finished but I learned about this project and rather use someone else's maintained project with backing than my own.
reconsider the use of symlinkJoin. edopro-script and edopro-desktop should be possible to inline into the edopro derivation
They definitely could be, they're largely separate because it was easier to try stuff out during development without rebuilding the entire application every time I made a mistake in a shell script.
Probably still preferable to keep them separate for maintenance/future improvements (that script will likely need them) if possible, though.
This is my package below
I believe my problem is likely the git module called ocgcore, but I'm unsure. If theres a way I can interop with nix update to help it I'd like to know to.