[PATCH] Prefer definition-before-use in Nix
Nix does not require this, but it is easier to read. No functional change intended. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- img/app/default.nix | 74 ++++++++++++++++++++++++-------------------------- vm/sys/net/default.nix | 72 ++++++++++++++++++++++++------------------------ 2 files changed, 72 insertions(+), 74 deletions(-) diff --git a/img/app/default.nix b/img/app/default.nix index d3eed1f0accdc8968d1ba5bdec74ab597789082f..71a939c1c053ebd37fc02fa4eed49b883d50ef49 100644 --- a/img/app/default.nix +++ b/img/app/default.nix @@ -12,6 +12,42 @@ pkgsStatic.callPackage ( }: let + kernelTarget = + if stdenvNoCC.hostPlatform.isx86 then + # vmlinux.bin is the stripped version of vmlinux. + # Confusingly, compressed/vmlinux.bin is the stripped version of + # the top-level vmlinux target, while the top-level vmlinux.bin + # is the stripped version of compressed/vmlinux. So we use + # compressed/vmlinux.bin, since we want a stripped version of + # the kernel that *hasn't* been built to be compressed. Weird! + "compressed/vmlinux.bin" + else + stdenvNoCC.hostPlatform.linux-kernel.target; + + kernel = (linux_latest.override { + structuredExtraConfig = with lib.kernel; { + DRM_FBDEV_EMULATION = lib.mkForce no; + EROFS_FS = yes; + FONTS = lib.mkForce unset; + FONT_8x8 = lib.mkForce unset; + FONT_TER16x32 = lib.mkForce unset; + FRAMEBUFFER_CONSOLE = lib.mkForce unset; + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce unset; + FRAMEBUFFER_CONSOLE_DETECT_PRIMARY = lib.mkForce unset; + FRAMEBUFFER_CONSOLE_ROTATION = lib.mkForce unset; + RC_CORE = lib.mkForce unset; + VIRTIO = yes; + VIRTIO_BLK = yes; + VIRTIO_CONSOLE = yes; + VIRTIO_PCI = yes; + VT = no; + }; + }).overrideAttrs ({ installFlags ? [], ... }: { + installFlags = installFlags ++ [ + "KBUILD_IMAGE=$(boot)/${kernelTarget}" + ]; + }); + appimageFhsenv = (buildFHSEnv (appimageTools.defaultFhsEnvArgs // { name = "vm-fhs-env"; targetPkgs = pkgs: appimageTools.defaultFhsEnvArgs.targetPkgs pkgs ++ [ @@ -53,50 +89,12 @@ let pkgs.wireplumber ]; })).fhsenv; -in -let packagesSysroot = runCommand "packages-sysroot" {} '' mkdir -p $out/etc/ssl/certs ln -s ${appimageFhsenv}/{lib64,usr} ${kernel}/lib $out ln -s ${cacert}/etc/ssl/certs/* $out/etc/ssl/certs ''; - - kernelTarget = - if stdenvNoCC.hostPlatform.isx86 then - # vmlinux.bin is the stripped version of vmlinux. - # Confusingly, compressed/vmlinux.bin is the stripped version of - # the top-level vmlinux target, while the top-level vmlinux.bin - # is the stripped version of compressed/vmlinux. So we use - # compressed/vmlinux.bin, since we want a stripped version of - # the kernel that *hasn't* been built to be compressed. Weird! - "compressed/vmlinux.bin" - else - stdenvNoCC.hostPlatform.linux-kernel.target; - - kernel = (linux_latest.override { - structuredExtraConfig = with lib.kernel; { - DRM_FBDEV_EMULATION = lib.mkForce no; - EROFS_FS = yes; - FONTS = lib.mkForce unset; - FONT_8x8 = lib.mkForce unset; - FONT_TER16x32 = lib.mkForce unset; - FRAMEBUFFER_CONSOLE = lib.mkForce unset; - FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce unset; - FRAMEBUFFER_CONSOLE_DETECT_PRIMARY = lib.mkForce unset; - FRAMEBUFFER_CONSOLE_ROTATION = lib.mkForce unset; - RC_CORE = lib.mkForce unset; - VIRTIO = yes; - VIRTIO_BLK = yes; - VIRTIO_CONSOLE = yes; - VIRTIO_PCI = yes; - VT = no; - }; - }).overrideAttrs ({ installFlags ? [], ... }: { - installFlags = installFlags ++ [ - "KBUILD_IMAGE=$(boot)/${kernelTarget}" - ]; - }); in stdenvNoCC.mkDerivation { diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix index b5873ebe1e80dd88c1ba997f7ebd3ee7369bb40f..7b2b8b1fbb9b9027781812307bed0551b80f5a78 100644 --- a/vm/sys/net/default.nix +++ b/vm/sys/net/default.nix @@ -14,6 +14,42 @@ let inherit (lib) concatMapStringsSep; inherit (nixosAllHardware.config.hardware) firmware; + kernelTarget = + if stdenvNoCC.hostPlatform.isx86 then + # vmlinux.bin is the stripped version of vmlinux. + # Confusingly, compressed/vmlinux.bin is the stripped version of + # the top-level vmlinux target, while the top-level vmlinux.bin + # is the stripped version of compressed/vmlinux. So we use + # compressed/vmlinux.bin, since we want a stripped version of + # the kernel that *hasn't* been built to be compressed. Weird! + "compressed/vmlinux.bin" + else + stdenvNoCC.hostPlatform.linux-kernel.target; + + kernel = (linux_latest.override { + structuredExtraConfig = with lib.kernel; { + DRM_FBDEV_EMULATION = lib.mkForce no; + EROFS_FS = yes; + FONTS = lib.mkForce unset; + FONT_8x8 = lib.mkForce unset; + FONT_TER16x32 = lib.mkForce unset; + FRAMEBUFFER_CONSOLE = lib.mkForce unset; + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce unset; + FRAMEBUFFER_CONSOLE_DETECT_PRIMARY = lib.mkForce unset; + FRAMEBUFFER_CONSOLE_ROTATION = lib.mkForce unset; + RC_CORE = lib.mkForce unset; + VIRTIO = yes; + VIRTIO_BLK = yes; + VIRTIO_CONSOLE = yes; + VIRTIO_PCI = yes; + VT = no; + }; + }).overrideAttrs ({ installFlags ? [], ... }: { + installFlags = installFlags ++ [ + "KBUILD_IMAGE=$(boot)/${kernelTarget}" + ]; + }); + connman = connmanMinimal; packages = [ @@ -58,42 +94,6 @@ let system.stateVersion = lib.trivial.release; }); - - kernelTarget = - if stdenvNoCC.hostPlatform.isx86 then - # vmlinux.bin is the stripped version of vmlinux. - # Confusingly, compressed/vmlinux.bin is the stripped version of - # the top-level vmlinux target, while the top-level vmlinux.bin - # is the stripped version of compressed/vmlinux. So we use - # compressed/vmlinux.bin, since we want a stripped version of - # the kernel that *hasn't* been built to be compressed. Weird! - "compressed/vmlinux.bin" - else - stdenvNoCC.hostPlatform.linux-kernel.target; - - kernel = (linux_latest.override { - structuredExtraConfig = with lib.kernel; { - DRM_FBDEV_EMULATION = lib.mkForce no; - EROFS_FS = yes; - FONTS = lib.mkForce unset; - FONT_8x8 = lib.mkForce unset; - FONT_TER16x32 = lib.mkForce unset; - FRAMEBUFFER_CONSOLE = lib.mkForce unset; - FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce unset; - FRAMEBUFFER_CONSOLE_DETECT_PRIMARY = lib.mkForce unset; - FRAMEBUFFER_CONSOLE_ROTATION = lib.mkForce unset; - RC_CORE = lib.mkForce unset; - VIRTIO = yes; - VIRTIO_BLK = yes; - VIRTIO_CONSOLE = yes; - VIRTIO_PCI = yes; - VT = no; - }; - }).overrideAttrs ({ installFlags ? [], ... }: { - installFlags = installFlags ++ [ - "KBUILD_IMAGE=$(boot)/${kernelTarget}" - ]; - }); in stdenvNoCC.mkDerivation { --- base-commit: 8ce6039b6dde7fda98ceea018addecb8bee0e7b3 change-id: 20250908-nix-cleanup-8496862dfee9 -- Sincerely, Demi Marie Obenour (she/her/hers)
This patch has been committed as cbb10b15f36a7ac35400e226b284b1cb091cb3c9, which can be viewed online at https://spectrum-os.org/git/spectrum/commit/?id=cbb10b15f36a7ac35400e226b284.... This is an automated message. Send comments/questions/requests to: Alyssa Ross <hi@alyssa.is>
participants (2)
-
Alyssa Ross -
Demi Marie Obenour