My overlay.nix file is pretty simple. It is just:
[ (self: super:
let
pkgs = self;
inherit (pkgs) lib;
callPackage = lib.callPackageWith (pkgs // builtins.removeAttrs pkgs.xorg [ "callPackage" "newScope" "overrideScope" "packages" ]);
forkNixpkgsPath = /home/fusion809/nixpkgs;
in with pkgs; {
fork = import forkNixpkgsPath {
config = {
allowUnfree = true;
};
overlays = [ ];
};
openra-git = callPackage (forkNixpkgsPath + /openra) {engines.git};
}) ]
Problem is that last command doesn’t work, it causes this error when built:
error: syntax error, unexpected '}', expecting '.' or '='
at /home/fusion809/overlays.nix:17:68:
16|
17| openra-git = callPackage (forkNixpkgsPath + /openra) {engines.git};
| ^
18|
When I am in the openra directory, however, running nix-build -iA engines.git
builds the openra-git package I want. How am I meant to specify that I want openra-git in overlays.nix to be the engines.git subpackage within the openra directory?
I have since changed my overlays.nix file to:
[ (self super:
let
pkgs = self;
inherit (pkgs) lib;
forkNixpkgsPath = /home/fusion809/nixpkgs;
in with pkgs; {
fork = import forkNixpkgsPath {
config = {
allowUnfree = true;
};
overlays = [ ];
};
openraPackages = import (forkNixpkgsPath + /openra/default.nix); # Import as a set
openra-git = openraPackages.engines.git; # Access the git engine directly
}) ]
The above error is now gone, but now I get this error when I include openra-git as a package in my system configuration:
error: Package ‘dotnet-sdk-6.0.428’ in /nix/store/ggn93wd5qpvnjrvz7kd0kzx9mxmyqdhp-nixos-24.11/nixos/pkgs/development/compilers/dotnet/build-dotnet.nix:222 is marked as insecure, refusing to evaluate.
Known issues:
- Dotnet SDK 6.0.428 is EOL, please use 8.0 (LTS) or 9.0 (Current)
You can install it anyway by allowing this package, using the
following methods:
a) To temporarily allow all insecure packages, you can use an environment
variable for a single invocation of the nix tools:
$ export NIXPKGS_ALLOW_INSECURE=1
Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
then pass `--impure` in order to allow use of environment variables.
b) for `nixos-rebuild` you can add ‘dotnet-sdk-6.0.428’ to
`nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
like so:
{
nixpkgs.config.permittedInsecurePackages = [
"dotnet-sdk-6.0.428"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
‘dotnet-sdk-6.0.428’ to `permittedInsecurePackages` in
~/.config/nixpkgs/config.nix, like so:
{
permittedInsecurePackages = [
"dotnet-sdk-6.0.428"
];
}
Naturally, you’ll probably be telling me to read the error and do what it says. I tried that though. I tried adding:
{
nixpkgs.config.permittedInsecurePackages = [
"dotnet-sdk-6.0.428"
];
}
to my configuration.nix file and I still get this error. I’ve also tried running:
export NIXPKGS_ALLOW_INSECURE=1
sudo nixos-rebuild switch --impure
and still I get this error.
I also tried updating the version of dotnet sdk and dotnet runtime defined in build-engine.nix to 8_0 instead of 6_0. This causes the package to build successfully, but fails to launch with the error:
You must install or update .NET to run this application.
App: /nix/store/00lhbqbrzczcfr7fhclxs0pif5m79l2j-openra-git-2126f3c5a205654ee0230b4b048369378c7f4471/lib/openra-git/OpenRA.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
.NET location: /nix/store/y66v9lxv9gn7jwm6hzdg7kv2szyihn15-dotnet-runtime-8.0.12/share/dotnet/
The following frameworks were found:
8.0.12 at [/nix/store/y66v9lxv9gn7jwm6hzdg7kv2szyihn15-dotnet-runtime-8.0.12/share/dotnet/shared/Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=linux-x64&os=nixos.24.11
Red Alert has encountered a fatal error.
Please refer to the crash logs and FAQ for more information.
Log files are located in /home/fusion809/.config/openra/Logs
The FAQ is available at https://wiki.openra.net/FAQ
maybe try
config = {
allowUnfree = true;
permittedInsecurePackages = [
"dotnet-sdk-6.0.428"
];
};
Thank you for your suggestion. I tried adding that to overlays.nix, and also configuration.nix (I know, I may have gone overboard) and still I get that error of error: Package ‘dotnet-sdk-6.0.428’ in /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/development/compilers/dotnet/build-dotnet.nix:1 is marked as insecure, refusing to evaluate.
.
Let’s discuss on your nixos configs repo
Sure, go ahead. I am happy to resolve this wherever I can.
solved in openra overlay · Issue #1 · fusion809/NixOS-configs · GitHub
solution was
nixpkgs.config = {
allowUnfree = true;
permittedInsecurePackages = [
"dotnet-runtime-6.0.36"
"dotnet-sdk-6.0.428"
];
};