Recently, I wanted to build the C toolchain as a Nix flake for my NixOS install. Today, I got it to build and compile a C program.

When I went to package the toolchain, I encountered these problems:

1. When trying to download the toolchain with every git submodule, there was a reference to the GraphX template in .gitmodules, but there wasn't a reference to it in the directory tree itself. This caused issues when Nix tried to download the repo, only for it to give an error. I sent a PR to fix this.

2. In the convimg repo, there was also an unused reference in .gitmodules, but for fasmg-ez80. I also sent a PR to fix it, but I had to send another PR to the toolchain to update the referenced convimg repo.

3. In the Makefile of the toolchain, I had to stop it from building convimg, convfont, and convbin as they are already in the Nixpkgs software repo.

4. cedev-config tried to build a statically linked executable. In Nixpkgs, the standard glibc installation only contains static libraries. I had to patch it to build a dynamically linked executable.

5. The version of fasmg in the Nixpkgs repository is out-of-date. At build-time, fasmg complained about an invalid instruction inside a calminstruction. At runtime, fasmg wouldn't stop running in the link phase. I sent a PR to Nixpkgs to update it, but I had to give an updated version of fasmg in the meantime.

6. The references to convimg, ez80-link, fasmg, and everything else had been hard-coded to be relative to the location of the package. In Nix, every single package has a unique location within the Nix store. I didn't think about symlinking to said programs, so I had to patch that out to use the commands to use the packages relative to the PATH environment variable. As of writing, I realized it would be better to patch it to give the absolute paths of the programs instead of using PATH. It now uses absolute paths.

7. There appears to be a bug in the toolchain where omitting a description gives the flag '-b' containing the current timestamp to convbin, which isn't a valid option. I had to patch that out not only to remove the invalid option, but to remove the timestamp as that wouldn't result in a reproducible program. EDIT: This was due to the version of convbin, so I had to switch to the master branch of convbin instead.

If you have Nix installed, you can get a template by running:

Code:
nix flake init -t github:myclevorname/flake#ce-toolchain
nix flake lock
nix build


To build the CE libraries, run

Code:
nix build github:myclevorname/flake#ce-libs -o clibs.8xg

The '-o clibs.8xg' is required because TILP refused to send them without the `8xg` extension.

Link: https://github.com/myclevorname/flake
I have made a new Github repo relating to calculator programs, but this time it is meant to be a repository of programs themselves. Unlike the flake above, this is meant to be a collection of calculator programs, rather than a tool to package programs. Both repos will be maintained, but I would recommend only using flake unless you want to contribute to this repo or want to use a program already packaged in the new repo.

Link: https://github.com/myclevorname/nix-calculators
If you want, I'm fine with you adding CalcClicker to your repo -> https://github.com/CoolModder/CalcClicker/tree/main/src.
Let me know if you need anything, like an hash.
I don't use nix, but I'm fine with it being in a repo.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement