| Title | Author | Date | Tags | Reading Time | |||
|---|---|---|---|---|---|---|---|
Fixing NetworkManager-wait-online Issue and Incorporating Nix Flakes |
Rob Alicea |
2024-07-04 |
|
3 min |
I encountered an issue where the NetworkManager-wait-online.service was causing delays and failures during the system boot process. The goal was to disable this service to improve the boot time and overall system performance.
To resolve the issue, I needed to disable the NetworkManager-wait-online service in our NixOS configuration.
I modified the configuration.nix file to explicitly disable the NetworkManager-wait-online service using the systemd.services option.
{ config, pkgs, lib, ... }:
let
secrets = import ./secrets.nix;
in
{
imports = [ ./hardware-configuration.nix ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.networkmanager.enable = true;
networking.nameservers = [ "127.0.0.1" ];
systemd.services."NetworkManager-wait-online".enable = false;
time.timeZone = "America/Chicago";
i18n.defaultLocale = "en_US.UTF-8";
boot.kernelParams = [
"intel_iommu=on"
"iommu=pt"
];
services.timesyncd.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.tlp.enable = true;
services.power-profiles-daemon.enable = false;
powerManagement.powertop.enable = true;
services.flatpak.enable = true;
users.mutableUsers = false;
users.users = {
root = {
password = secrets.passdw;
};
rob = {
isNormalUser = true;
description = "Rob Alicea";
extraGroups = [ "wheel" "networkmanager" "docker" ];
password = secrets.passd;
home = "/home/rob";
};
};
environment.systemPackages = with pkgs; [
wget git emacs ripgrep fd shellcheck discount cmake gnumake python310
python310Packages.isort python310Packages.nose python310Packages.pytest
python310Packages.pip python310Packages.setuptools python310Packages.pip
pipenv cabextract podman podman-compose distrobox floorp docker-compose
flatpak hugo ffmpeg tlp gnome3.gnome-tweaks dconf gnome3.gnome-shell
gnomeExtensions.pop-shell
];
boot.kernelModules = [ "binder_linux" "ashmem_linux" "v4l2loopback" ];
fonts.enableDefaultPackages = true;
fonts.packages = with pkgs; [
fira-code
(pkgs.fetchurl {
url = "https://downloads.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe";
sha256 = secrets.sha256Hash;
})
];
nix.gc.automatic = true;
nix.gc.dates = "weekly";
nix.gc.options = "--delete-older-than 30d";
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.72.1.2/24" ];
listenPort = 51820;
privateKey = secrets.wireguardPrivateKey;
dns = [ "10.72.1.1" ];
peers = [{
publicKey = "HYrJHiCFn5+dzDzr1RSHWHsbc0Cv8RhRaABNDl5Xd0A=";
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "${secrets.endpoint}:51820";
persistentKeepalive = 25;
}];
};
};
virtualisation.podman.enable = true;
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 ];
allowedUDPPorts = [ 123 ];
interfaces = {
"eth0" = { allowedTCPPorts = [ 8080 ]; };
};
};
services.resolved.enable = true;
environment.etc."NetworkManager/NetworkManager.conf".text = lib.mkForce ''
[main]
dns=systemd-resolved
'';
system.stateVersion = "24.05";
}After modifying the configuration, we rebuilt the system to apply the changes.
sudo nixos-rebuild switch --flake .#rob-nixos --show-traceTo take advantage of the benefits provided by Nix flakes, we incorporated flakes into our NixOS configuration.
We created a flake.nix file to define our flake, specifying the inputs and outputs for our NixOS configuration.
{
description = "NixOS configuration for Rob's system";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }: {
nixosConfigurations = {
rob-nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
};
};
};
}To update and rebuild the system using flakes, we followed these steps:
- Update the flake:
sudo nix flake update - Rebuild the system:
sudo nixos-rebuild switch --flake .#rob-nixos --show-trace - Upgrade the system:
sudo nixos-rebuild switch --flake .#rob-nixos --upgrade
By following these steps, I successfully incorporated Nix flakes into our NixOS configuration, enabling us to manage and update our system more efficiently.