Hello, I’m relatively new to nixos but am looking to get it set up with an older piece of software. I’m hoping to be able to replicate these setup across 3 computers.
The sticking point has been to get stm32cubemx set up, using an older version of it.
nixpkgs contains a more recent version, which is great and will get used, also we need the ‘legacy’ version for old project files.
the typical command to start the installer is
$ java -jar SetupSTM32CubeMX-4.27.0.exe
(I know, strange enough already)
I hit an error when it’s attempting to install, error executing chmod?? pretty basic stuff…
Running with sudo makes no difference.
I’ve tried different versions fo Java, the latest attempt being a 32-bit version - that had many more errors cropping up in the terminal.
since the older cubemx installers are behind a login wall I’ll include this here in case someone want to try reproduce the error.
The former looks like it could be a useful way to put a working solution in parallel with configuration.nix, correct?
Or I could modify the Nix package and keep that version on a personal repo… this option seems easier possibly… assuming the older files are available from ST. I’m unsure if that is the case.
How would I be able to get the details of the Nix package so that I can have a look inside it?
If you want to know, this error seem to be caused due to the non-existence of the /bin/chmod file (software should use the PATH environment to determine it’s location).
Also, somethings usefull to determine how to use an older version is git history: just click the history icon on github, and you will have a list of revision for this file (were we can see the first version in nixpkgs is 5.3.0). Also, keep in mind that you need to replace/remove the hash, as if the hash doesn’t change, it’ll use the older version that is in the cache.
stm32cubemx installed and running, just need to push my change to my forked repo of the pkgs and point configuration.nix to my repo for stm32cubemx… gotta figure that one out…
I have an override at the top of my configuration.nix
Seems a bit messy. Also, desktopItem doesn’t override either. I’d like to change desktopName but I’m stuck with the default.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
let
stm32cubemx427 = pkgs.stm32cubemx.overrideAttrs(oldAttrs: rec {
name = "stm32cubemx";
version = "4.27.0";
desktopItem = pkgs.makeDesktopItem {
name = "stm32CubeMX";
exec = "stm32cubemx";
desktopName = "STM32CubeMX427";
categories = "Development;";
icon = "stm32cubemx";
};
src = pkgs.fetchzip {
url = "https://sw-center.st.com/packs/resource/library/stm32cube_mx_v${builtins.replaceStrings ["."] [""] version}.zip";
sha256 = "3c383ec23f07c2a5a6f0b0e40c853bae9e11475719598bff96fa5b74b410badc";
stripRoot= false;
};
});
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Boot
boot.loader.systemd-boot.enable = true;
networking.hostName = "nixoshpprobook"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "Europe/London";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp0s25.useDHCP = true;
networking.interfaces.wlo1.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the GNOME 3 Desktop Environment.
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome3.enable = true;
# Configure keymap in X11
services.xserver.layout = "gb";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.d4 = {
isNormalUser = true;
extraGroups = [ "wheel" "dialout" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
nixpkgs.config.allowUnfree = true;
# $ nix search wget
environment.systemPackages = with pkgs; [
wget nano
firefox tor-browser-bundle-bin
vscode platformio git
gparted ntfs3g exfat apfs-fuse
stm32flash gcc-arm-embedded gnumake
nmap-graphical
python3 gcc_latest
adoptopenjdk-jre-openj9-bin-8
eagle kicad
inkscape gimp
stm32cubemx427
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.avahi.enable = true;
services.avahi.nssmdns = true;
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "20.09"; # Did you read the comment?
}
replace ./pkgs/stm32cubemx with the location of your .nix file.
I wouldn’t suggest using overrideAttrs in this case but it is up to you. If you are installing multiple versions of the same project then it may be needed. I just discovered this with the jdk today.