This is an automated archive made by the Lemmit Bot.

The original was posted on /r/nixos by /u/PlanktonDangerous700 on 2024-09-01 11:49:30+00:00.

Original Title: I couldn’t hold myself and fell for the dire mistake of compiling everything from source by specifying cpu architecture in config. It has been around 8 hours and it still compiles. Why does it compile firefox, gtk, Qt etc. as they are not installed on my server nix system? I didn’t install them


SSH connection - output of build commands filtered with cpu architecture name

In the image, you can see the SSH session screenshot of build commands optimized for alderlake. It compiled kernel and many other tools but is continuing with graphical tools too. Does NixOS install graphical interface even if I don’t explicitly specify it? I installed with minimal installation iso and I used the nix channel of

Config:

{ config, lib, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];

  nix.settings.system-features = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-alderlake" ];

  nixpkgs.buildPlatform.system = "x86_64-linux";
  nixpkgs.buildPlatform.gcc.arch = "alderlake";
  nixpkgs.buildPlatform.gcc.tune = "alderlake";
  nixpkgs.hostPlatform.system = "x86_64-linux";
  nixpkgs.hostPlatform.gcc.arch = "alderlake";
  nixpkgs.hostPlatform.gcc.tune = "alderlake";

  environment.variables = {
    TARGET_ARCH = "alderlake";
    CARGO_BUILD_RUSTFLAGS = "-C opt-level=3 -C target-cpu=alderlake -C codegen-units=1";
    NIX_CFLAGS_COMPILE = "-march=alderlake -mtune=alderlake -O3 -flto -fno-plt -pipe";
    NIX_CXXFLAGS_COMPILE = "-march=alderlake -mtune=alderlake -O3 -flto -fno-plt -pipe";
  };

  nixpkgs.config = {
    allowUnfree = true;
  };

  services.openssh.settings.PermitRootLogin = "yes";
  services.openssh.enable = true;
  services.avahi.enable = true;

  nixpkgs.overlays = [
    (self: super: {
      go = super.go.override {
        buildFlags = "-ldflags=-s -w";
      };

      blas = super.blas.override {
        blasProvider = self.mkl;
      };

      lapack = super.lapack.override {
        lapackProvider = self.mkl;
      };

      mpi = self.mvapich;
    })
  ];

  nix.settings = {
    binary-caches = [];
    binary-caches-parallel-connections = 0;
    require-sigs = true;
  };

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.kernelParams = [ "i915.force_probe=46a6" ];

  networking.hostName = "alpha";
  networking.networkmanager.enable = true;
  networking.defaultGateway = "10.0.1.1";
  networking.nameservers = [ "10.0.1.1" ];
  networking.interfaces.eth0.ipv4.addresses = [ {
    address = "10.0.1.27";
    prefixLength = 24;
  } ];
  networking.enableIPv6 = false;
  networking.search = [ "home.arpa" ];
  networking.domain = "home.arpa";

  time.timeZone = "Europe/Istanbul";

  i18n.defaultLocale = "en_US.UTF-8";
  # console = {
  #   font = "Lat2-Terminus16";
  #   keyMap = "us";
  #   useXkbConfig = true; # use xkb.options in tty.
  # };

  # services.xserver.enable = true;

  # services.xserver.xkb.layout = "us";
  # services.xserver.xkb.options = "eurosign:e,caps:escape";

  # hardware.opengl = {
  #   enable = true;
  #   extraPackages = with pkgs; [
  #     vpl-gpu-rt
  #   ];
  # };

  environment.systemPackages = with pkgs; [
    wget
  ];

  networking.firewall.allowedTCPPorts = [22];

  system.copySystemConfiguration = true;

  system.stateVersion = "24.05"; # Did you read the comment?
}

Update: I was able to successfully compile without errors after disabling network service (it causes wayland and other GUI dependencies - you don’t need it if you statically manage your network) and using minimal profile (minimal profile doesn’t have such graphical stuff, firefox etc.):

  imports = [
    
    ./hardware-configuration.nix
  ];

...

  services.xserver.enable = false;

...

  networking.networkmanager.enable = false;