NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.58k stars 13.74k forks source link

Build failure: klipper-firmware #343512

Closed Dyf-Tfh closed 1 week ago

Dyf-Tfh commented 1 week ago

Steps To Reproduce

Steps to reproduce the behavior: after adding this snippet to configuration.nix and sudo nixos-rebuild switch, the rebuild fail.

    services.klipper = {
        configFile = "/home/nicolas/printer_conf/printer.cfg";
        enable = true;
        firmwares = {
            mcu = {
                enable = true;
                serial = "/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0";
                configFile = "/home/nicolas/printer_conf/avr.cfg";
            };
        };
    };

Build log

[nicolas@nixos:/etc/nixos]$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
these 13 derivations will be built:
  /nix/store/gcqrimf7ghyj7wnv2q6r1rvm1mwwx89f-klipper-firmware-mcu-0.12.0-unstable-2024-05-16.drv
  /nix/store/y1grz9bx7h40qcaffl7gpx5fl2hiz1ld-system-path.drv
  /nix/store/zphaaf9sd037myc9hc5kr5xxppkj6y0d-dbus-1.drv
  /nix/store/9y270zj2yspdpzrjikdr8z5wpdk7b1vz-X-Restart-Triggers-dbus.drv
  /nix/store/c3wnn9xi3iv3cn8apiiqm9h0vy5rfb5g-unit-dbus.service.drv
  /nix/store/drwby49gdgfd8s19km6lb9k5033ynv9h-user-units.drv
  /nix/store/q1x03hahqbk7w81cjaz8j8445nv8g29f-X-Restart-Triggers-polkit.drv
  /nix/store/2d1x7rlj37bsh2mxi5hfx83ii64kp090-unit-polkit.service.drv
  /nix/store/84r0a7cm9wbs9709llzdx2x667hw2fj4-unit-accounts-daemon.service.drv
  /nix/store/vbcyvqmh57cg6r3hxk3hqnynbqzp7bcb-unit-dbus.service.drv
  /nix/store/qw8jn5mdqjp478m4017487p1z3rzwk0k-system-units.drv
  /nix/store/1wgzdfnhmgl2s06fax06srm0ljs627f3-etc.drv
  /nix/store/44d5dqx24a7nd6xflvaynxs3dpz2lvga-nixos-system-nixos-24.05.5197.944b2aea7f0a.drv
building '/nix/store/gcqrimf7ghyj7wnv2q6r1rvm1mwwx89f-klipper-firmware-mcu-0.12.0-unstable-2024-05-16.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/i094ii8dfh46ck1agq23p0gk9sn474qs-source
source root is source
Running phase: patchPhase
patching script interpreter paths in .
./klippy/parsedump.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/install-centos.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/install-beaglebone.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/graph_motion.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/flash-pru.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/check_whitespace.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/graphstats.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/install-arch.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/klipper-pru-start.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/sh"
./scripts/update_mks_robin.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/ci-build.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/ci-install.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/install-ubuntu-22.04.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/flash-ar100.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/update_chitu.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/klipper-start.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/sh"
./scripts/install-ubuntu-18.04.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/motan/data_logger.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/motan/motan_graph.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/avrsim.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/check_whitespace.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/graph_shaper.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/logextract.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/install-octopi.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/dump_mcu.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/flash_usb.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/flash-linux.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/flash-sdcard.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/install-debian.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/parsecandump.py: interpreter directive changed from "#!/usr/bin/python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/klipper-uninstall.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./scripts/graph_extruder.py: interpreter directive changed from "#!/usr/bin/env python" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python"
./scripts/graph_accelerometer.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/calibrate_shaper.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./scripts/check-gcc.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/sh"
./docs/_klipper3d/build-translations.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
./lib/rp2040/boot_stage2/pad_checksum: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./lib/kconfiglib/olddefconfig.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./lib/kconfiglib/genconfig.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./lib/kconfiglib/menuconfig.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
./lib/canboot/flash_can.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
cp: cannot stat '/home/nicolas/printer_conf/avr.cfg': No such file or directory
error: builder for '/nix/store/gcqrimf7ghyj7wnv2q6r1rvm1mwwx89f-klipper-firmware-mcu-0.12.0-unstable-2024-05-16.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/y1grz9bx7h40qcaffl7gpx5fl2hiz1ld-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/44d5dqx24a7nd6xflvaynxs3dpz2lvga-nixos-system-nixos-24.05.5197.944b2aea7f0a.drv' failed to build

Additional context

Changing the permission of the avr.cfg build file to rw for all users/ group doesn’t change anything if it help here is the file :

CONFIG_LOW_LEVEL_OPTIONS=y
CONFIG_MACH_AVR=y
# CONFIG_MACH_ATSAM is not set
# CONFIG_MACH_ATSAMD is not set
# CONFIG_MACH_LPC176X is not set
# CONFIG_MACH_STM32 is not set
# CONFIG_MACH_HC32F460 is not set
# CONFIG_MACH_RP2040 is not set
# CONFIG_MACH_PRU is not set
# CONFIG_MACH_AR100 is not set
# CONFIG_MACH_LINUX is not set
# CONFIG_MACH_SIMU is not set
CONFIG_AVR_SELECT=y
CONFIG_BOARD_DIRECTORY="avr"
CONFIG_MACH_atmega2560=y
# CONFIG_MACH_atmega1280 is not set
# CONFIG_MACH_at90usb1286 is not set
# CONFIG_MACH_at90usb646 is not set
# CONFIG_MACH_atmega32u4 is not set
# CONFIG_MACH_atmega1284p is not set
# CONFIG_MACH_atmega644p is not set
# CONFIG_MACH_atmega328p is not set
# CONFIG_MACH_atmega328 is not set
# CONFIG_MACH_atmega168 is not set
CONFIG_MCU="atmega2560"
CONFIG_AVRDUDE_PROTOCOL="wiring"
CONFIG_AVR_FREQ_16000000=y
# CONFIG_AVR_FREQ_8000000 is not set
CONFIG_CLOCK_FREQ=16000000
CONFIG_AVR_CLKPR=-1
CONFIG_AVR_STACK_SIZE=256
CONFIG_AVR_WATCHDOG=y
CONFIG_SERIAL=y
CONFIG_AVR_SERIAL_UART0=y
# CONFIG_AVR_SERIAL_UART1 is not set
# CONFIG_AVR_SERIAL_UART2 is not set
# CONFIG_AVR_SERIAL_UART3 is not set
CONFIG_SERIAL_BAUD_U2X=y
CONFIG_SERIAL_PORT=0
CONFIG_SERIAL_BAUD=115200
CONFIG_USB_VENDOR_ID=0x1d50
CONFIG_USB_DEVICE_ID=0x614e
CONFIG_USB_SERIAL_NUMBER="12345"
CONFIG_WANT_GPIO_BITBANGING=y
CONFIG_WANT_DISPLAYS=y
CONFIG_WANT_SENSORS=y
CONFIG_WANT_LIS2DW=y
CONFIG_WANT_LDC1612=y
CONFIG_WANT_SOFTWARE_I2C=y
CONFIG_WANT_SOFTWARE_SPI=y
CONFIG_NEED_SENSOR_BULK=y
CONFIG_CANBUS_FREQUENCY=1000000
CONFIG_INITIAL_PINS=""
CONFIG_HAVE_GPIO=y
CONFIG_HAVE_GPIO_ADC=y
CONFIG_HAVE_GPIO_SPI=y
CONFIG_HAVE_GPIO_I2C=y
CONFIG_HAVE_GPIO_HARD_PWM=y
CONFIG_HAVE_STRICT_TIMING=y
CONFIG_INLINE_STEPPER_HACK=y

Notify maintainers

@lovesegfault @zhaofengli @cab404

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.51, NixOS, 24.05 (Uakari), 24.05.5197.944b2aea7f0a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos-24.05, nixos-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

cab404 commented 1 week ago

I guess that's a config issue again.

cab404 commented 1 week ago
cp: cannot stat '/home/nicolas/printer_conf/avr.cfg': No such file or directory

Ohh... You probably use flakes and git, right?

Then stage the config.

Dyf-Tfh commented 1 week ago

No i only recently started nixos and i haven’t delved into flakes yet.

Sorry for the inconveniance but i don’t really understand what do you mean by staging the config.

Is this about the firmware config file ?

cab404 commented 1 week ago

Sorry for the inconveniance but i don’t really understand what do you mean by staging the config.

Is this about the firmware config file ?

Oh, nvm, just remove " from paths to configs.

Dyf-Tfh commented 1 week ago

Ok, removing quotes fix the problem, but is this a normal thing in nix ?

Like why is there a difference between quoted and unquoted paths, and how does it manages paths with spaces ?

I’m really sorry if this sound dumb, but i don’t understand a thing at this point.

cab404 commented 6 days ago

Ok, removing quotes fix the problem, but is this a normal thing in nix ?

Like why is there a difference between quoted and unquoted paths, and how does it manages paths with spaces ?

I’m really sorry if this sound dumb, but i don’t understand a thing at this point.

If you give it as a string, you are basically asking to access "/home/blablabla" at build time. At build time, your home is not accessible as build happens in a pretty isolated sandbox.

By giving it as path instead /home/blabla you are "pretty much" asking nix to copy that particular path into store before starting a build, and replaces the requested path with a store path.

Dyf-Tfh commented 6 days ago

Oh, i see thank for the explanation. Definitely though nix would copy that path into the store in both cases.

Beginner mistake i guess.