'DeviceType' instance needs to have a primary key value before this relationship can be used. #11139
-
Hello, and thanks for this amazing piece of software! I'm having trouble with NetBox on NixOS 22.11: it doesn't allow me to create a new DeviceType, giving me an error as said in the title. To check, I started a straightforward installation from scratch, using the NixOS configuration options. The configuration is as below: {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
outputs = {
self,
nixpkgs,
}: {
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({
config,
pkgs,
...
}: {
boot.isContainer = true;
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [80];
services.netbox = {
enable = true;
secretKeyFile = pkgs.writeText "secret" "hello, world!";
extraConfig = ''
MEDIA_ROOT = '/var/lib/netbox/media'
REPORTS_ROOT = '/var/lib/netbox/reports'
SCRIPTS_ROOT = '/var/lib/netbox/scripts'
'';
};
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."netbox-3" = {
locations = {
"/".proxyPass = "http://${config.services.netbox.listenAddress}:${toString config.services.netbox.port}";
"/static/".alias = "/var/lib/netbox/static/";
};
};
};
environment.systemPackages = with pkgs; [htop];
users.users.nginx.extraGroups = ["netbox"];
users.users.root.initialHashedPassword = "";
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
})
];
};
};
} With this configuration, I get NetBox 3.3.5 and a nginx reverse proxy. After going to the web UI, adding a manufacturer, trying to add any device type gives me this error. The log shows:
Note that NixOS' netbox uses Django 4.1.4. Weird thing, if I create a new container with NetBox 3.2.1 (by switching to NixOS 22.05), Device Types can be added without issue. I can then upgrade the version of NetBox to have a more recent version. It seems that no-one else have encountered this issue? Hope someone from the community can give more insight on this error. I'm available if you need more details. Thanks again! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I think the correct place to ask would be here: https://github.com/NixOS/nixpkgs
Probably doesn't need to be said, but using other versions of packages is of course not supported. Netbox doesn't work with django 2.0 either. |
Beta Was this translation helpful? Give feedback.
-
@minijackson We have the same problem now, so what is the fix or workaround here? |
Beta Was this translation helpful? Give feedback.
I think the correct place to ask would be here:
https://github.com/NixOS/nixpkgs
Probably doesn't need to be said, but using other versions of packages is of course not supported. Netbox doesn't work with django 2.0 either.