Closed nikp123 closed 4 months ago
I just noticed this PR. Sorry about that.
I'll take a look at this.
OK, this looks good but some changes are needed. The version is actually 12.2.0.5, and there are some additional files which should be mapped. Here's a patch:
diff --git a/pkgs/microcap.nix b/pkgs/microcap.nix
index be8a5e1..fd155d8 100644
--- a/pkgs/microcap.nix
+++ b/pkgs/microcap.nix
@@ -11,7 +11,7 @@
, copyDesktopIcons
, ... }: let
pname = "microcap";
- version = "12.2.0.2"; # The final version, I suppose
+ version = "12.2.0.5"; # The final version, I suppose
# Press 'F' for Spectrum Software
src = fetchzip {
@@ -34,8 +34,17 @@ in mkWindowsApp rec {
name = pname;
fileMap = {
- # This file is changed on runtime, so we'll have to link it
- "$HOME/.config/Micro-Cap/mcap.dat" = "drive_c/MC12/MCAP.dat";
+ # These files are changed on runtime, so we'll have to link them.
+ "$HOME/.config/Micro-Cap/mcap.dat" = "drive_c/MC12/mcap.dat";
+ "$HOME/.config/Micro-Cap/tool.dat" = "drive_c/MC12/tool.dat";
+ "$HOME/.config/Micro-Cap/MDL.dat" = "drive_c/MC12/MDL.dat";
+ "$HOME/.config/Micro-Cap/default.san" = "drive_c/MC12/default.san";
+ "$HOME/.config/Micro-Cap/WFB.BIN" = "drive_c/MC12/WFB.BIN";
+ "$HOME/.config/Micro-Cap/standard.shp" = "drive_c/MC12/standard.shp";
+ "$HOME/.config/Micro-Cap/Standard.cmp" = "drive_c/MC12/Standard.cmp";
+ "$HOME/.config/Micro-Cap/standard.tbk" = "drive_c/MC12/standard.tbk";
+ "$HOME/.config/Micro-Cap/standard.pkg" = "drive_c/MC12/standard.pkg";
+ "$HOME/.config/Micro-Cap/DATA" = "drive_c/MC12/DATA";
};
winAppInstall = ''
I made several attempts to save a .cir file, and it would not save. I didn't get any errors, I just couldn't save anything within nor outside of the DATA directory. But that could be because I don't know how to use the software.
OK, this looks good but some changes are needed. The version is actually 12.2.0.5, and there are some additional files which should be mapped. Here's a patch:
diff --git a/pkgs/microcap.nix b/pkgs/microcap.nix index be8a5e1..fd155d8 100644 --- a/pkgs/microcap.nix +++ b/pkgs/microcap.nix @@ -11,7 +11,7 @@ , copyDesktopIcons , ... }: let pname = "microcap"; - version = "12.2.0.2"; # The final version, I suppose + version = "12.2.0.5"; # The final version, I suppose # Press 'F' for Spectrum Software src = fetchzip { @@ -34,8 +34,17 @@ in mkWindowsApp rec { name = pname; fileMap = { - # This file is changed on runtime, so we'll have to link it - "$HOME/.config/Micro-Cap/mcap.dat" = "drive_c/MC12/MCAP.dat"; + # These files are changed on runtime, so we'll have to link them. + "$HOME/.config/Micro-Cap/mcap.dat" = "drive_c/MC12/mcap.dat"; + "$HOME/.config/Micro-Cap/tool.dat" = "drive_c/MC12/tool.dat"; + "$HOME/.config/Micro-Cap/MDL.dat" = "drive_c/MC12/MDL.dat"; + "$HOME/.config/Micro-Cap/default.san" = "drive_c/MC12/default.san"; + "$HOME/.config/Micro-Cap/WFB.BIN" = "drive_c/MC12/WFB.BIN"; + "$HOME/.config/Micro-Cap/standard.shp" = "drive_c/MC12/standard.shp"; + "$HOME/.config/Micro-Cap/Standard.cmp" = "drive_c/MC12/Standard.cmp"; + "$HOME/.config/Micro-Cap/standard.tbk" = "drive_c/MC12/standard.tbk"; + "$HOME/.config/Micro-Cap/standard.pkg" = "drive_c/MC12/standard.pkg"; + "$HOME/.config/Micro-Cap/DATA" = "drive_c/MC12/DATA"; }; winAppInstall = ''
I made several attempts to save a .cir file, and it would not save. I didn't get any errors, I just couldn't save anything within nor outside of the DATA directory. But that could be because I don't know how to use the software.
Thats because you have to launch it AFTER the installation script has finished. Found that bug myself, kinda wished I could prevent the installer from launching the executable. Sorry for not posting that here, I forgot.
Yes, that's a related issue. When I allowed the installer to launch the application, the app presented a warning saying that I should exit the application and run it again to finalize the installation. I did that, which allowed the installer to finish.
It's easier to simply disable launching the application to avoid that quirk, but that's not the default setting in the installer.
However, I attempted to save a file after the app had already been installed. I even had the data directory mapped and the files were there. But for some reason my file didn't save.-------- Original Message --------On 3/31/24 6:46 AM, nikp123 wrote:
OK, this looks good but some changes are needed. The version is actually 12.2.0.5, and there are some additional files which should be mapped. Here's a patch: diff --git a/pkgs/microcap.nix b/pkgs/microcap.nix index be8a5e1..fd155d8 100644 --- a/pkgs/microcap.nix +++ b/pkgs/microcap.nix @@ -11,7 +11,7 @@ , copyDesktopIcons , ... }: let pname = "microcap";
version = "12.2.0.5"; # The final version, I suppose
src = fetchzip { @@ -34,8 +34,17 @@ in mkWindowsApp rec { name = pname;
fileMap = {
"$HOME/.config/Micro-Cap/DATA" = "drive_c/MC12/DATA"; };
winAppInstall = ''
I made several attempts to save a .cir file, and it would not save. I didn't get any errors, I just couldn't save anything within nor outside of the DATA directory. But that could be because I don't know how to use the software.
Thats because you have to launch it AFTER the installation script has finished. Found that bug myself, kinda wished I could prevent the installer from launching the executable.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/emmanuelrosa/erosanix/pull/12#issuecomment-2028637606", "url": "https://github.com/emmanuelrosa/erosanix/pull/12#issuecomment-2028637606", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Also might giving me some guidance, if you know, on how to tame InstallShield installers?
Reason being: I want to have an another go at it.
I haven't done much with InstallShield installers. I've been lucky thus far.
Something that might help you with the troubleshooting is to run the installer under "wineshell":
$ nix run github:emmanuelrosa/erosanix#wineshell-wineWow64
$ # Now you're in a BASH shell with wine available and a temporary WINEPREFIX.
$ wine setup.exe /r
After installation, see if there's a setup.iss at $WINEPREFIX/drive_c/windows/ If there is, grab a copy of it before you exit.
$ exit
You can then use the setup.iss file to automate the installation, but it has to be in the same directory as setup.exe:
issFile = ./setup.iss;
winAppInstall = ''
cp "${issFile}" "$WINEPREFIX/drive_c/"
cp "${src}/setup.exe" "$WINEPREFIX/drive_c/"
$WINE "$WINEPREFIX/drive_c/setup.exe" /s /sms
wineserver -w
'';
$ wine setup.exe /r
Thank you, this is EXACTLY what I needed. It does record a setup.iss exactly where you said it will. Will update this package shortly
For some reason I am running into a bug where a directory is missing. Has something changed in the meantime?
nikp123@Wall /e/nixos> microcap
mktemp: Unknown option 'suffix=.mkwindowsApp' (see "mktemp --help")
/nix/store/qry797lqxf8bq33154jrq6l3chs1l6al-libwindowsapp.bash: line 39: : No such file or directory
/nix/store/qry797lqxf8bq33154jrq6l3chs1l6al-libwindowsapp.bash: line 40: : No such file or directory
cat: : No such file or directory
mktemp: Unknown option 'suffix=.mkwindowsApp' (see "mktemp --help")
/nix/store/qry797lqxf8bq33154jrq6l3chs1l6al-libwindowsapp.bash: line 39: : No such file or directory
/nix/store/qry797lqxf8bq33154jrq6l3chs1l6al-libwindowsapp.bash: line 40: : No such file or directory
cat: : No such file or directory
That's weird. No I haven't changed anything. mktemp
is a part of coreutils. I don't see how you would end up with a different implementation, such as busybox or tinycore.
That's weird. No I haven't changed anything.
mktemp
is a part of coreutils. I don't see how you would end up with a different implementation, such as busybox or tinycore.
You're right, toybox
seems to break it.
This should be a seperate issue. Installing it in the global environment breaks that script.
Update: it DOES break it, when i remove it from the global environment, it works just fine
Also how may i test changes locally so that i don't have to go through a whole git push, nix flake update and then nixOS-rebuild cycle?
EDIT: NVM, figured it out (for those following along: nix run thing#microcap
)
Yes, nix run
is a way to do that. To test adding it to your NixOS configuration you can use --override-input
:
nixos-rebuild test --override-input erosanix PATH_TO_LOCAL_EROSANIX_REPO
That would allow you to skip the git push and flake update.
Yep, I can't get away from that save bug. Not sure whats going on.
I got saving to work. I was able to save a circuit file, exit the software, run the software again and open the saved circuit file.
The fix is to configure the WINEPREFIX to act like winxp. The patch below:
commit c99ad780f518326e2b3124dda35f32abc9138470
Author: Emmanuel Rosa
Date: Mon Apr 1 16:40:39 2024 -0400
microcap: file save fix
diff --git a/pkgs/microcap/default.nix b/pkgs/microcap/default.nix
index 112a0a8..1473fd1 100644
--- a/pkgs/microcap/default.nix
+++ b/pkgs/microcap/default.nix
@@ -35,7 +35,9 @@ in mkWindowsApp rec {
fileMap = {
# This file is changed on runtime, so we'll have to link it
- "$HOME/.config/Micro-Cap/mcap.dat" = "drive_c/MC12/MCAP.dat";
+ "$HOME/.config/Micro-Cap/mcap.dat" = "drive_c/MC12/mcap.dat";
+ "$HOME/.config/Micro-Cap/DATA" = "drive_c/MC12/DATA"; # User files.
+ "$HOME/.cache/Micro-Cap/LIBRARY" = "drive_c/MC12/LIBRARY"; # Cached files.
};
issFile = ./setup.iss;
@@ -44,7 +46,7 @@ in mkWindowsApp rec {
mkdir "$WINEPREFIX/drive_c/microcap"
cp "${issFile}" "$WINEPREFIX/drive_c/microcap/setup.iss"
cp -rf "${src}/." "$WINEPREFIX/drive_c/microcap"
- ls "$WINEPREFIX/drive_c/microcap"
+ winetricks winxp
$WINE "$WINEPREFIX/drive_c/microcap/setup.exe" /s /sms
wineserver -w # Wait for the above wine process to finish
chmod -R 777 "$WINEPREFIX/drive_c/microcap"
The patch below:
How do I merge this, do I give you push access or do I merge those differences myself?
You can just apply the patch yourself. Or reproduce the changes yourself.-------- Original Message --------On 4/1/24 5:05 PM, nikp123 wrote:
The patch below:
How do I merge this, do I give you push access or do I merge those differences myself?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/emmanuelrosa/erosanix/pull/12#issuecomment-2030552791", "url": "https://github.com/emmanuelrosa/erosanix/pull/12#issuecomment-2030552791", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
I couldn't reproduce the results, unfortunately. It still fails to save.
Hmm...
Use nix shell
instead of nix run
so that you can set a special environment variable:
$ nix shell ...
$ WA_RUN_APP=0 microcap
$ # Now you're in a nested BASH shell in the same environment that microcap runs in.
$ winecfg
You'll now see the Wine configuration window. Select the "Applications" tab and check if the Windows version is "Windows XP" or "Windows XP 64"
You'll have to run exit
twice to get out of both shells.
The launcher script looks for the environment variable WA_RUN_APP, and if it's set to 0 it will perform all of the usual steps except that it will not run the application. Instead it drops you into a shell. I put that in for troubleshooting.
Great, seems to work now. I didn't even have to change it in winecfg. Maybe it was a cache issue? Who knows?
Awesome!
If you don't mind, I'd like to squash the commits.
No problem, do as you please.
Ths squashed commit is now on my master branch, see 0ea1247
Thanks a lot for your help
Since you're the only one (on GitHub IIRC) who has packaged windows apps under nix, I think its appropriate to put it here.
Micro-Cap is a electronics simulation suite that is useful for any electronics student, engineer or hobbyist. It was made by a now defunct company "Spectrum Software" (you can read about it more on wikipedia).
But long story short: It's a really neat tool.
The package itself is NOT free software (FOSS) by any definition but its freely available to download,
at least it was until the website shut down in early 2023.The install is not automated so you'll still have to go over InstallShield dialogs, but honestly i feel that's way safer than trying to nixify it and potentially breaking something. And I've tried the common InstallShield flags and arguments and they unfortunately don't do the job. But as long as the user doesn't change any of the directories in the installation path everything should work as intended.