The 'nixos-rebuild switch' doing nothing

Hello. I’ve followed the manual and tried “nixos-rebuild switch” in ‘configuration.nix’ with the apps I use, most in the user area and some in the environment, one per line, as advised. I also put a routine indicated in the manual to habilitate appimages. Nothing happened. Other than that, the command worked normally (after I corrected some mistakes I did). I thought I had to reboot to see the apps, but after that, no sign of them anywhere. I’m no technical at all, and only chose Nix for the promised stability of an immutable system. Also, I don’t read everything in the manual (and don’t intend to), just what I need to complete one simple task at a time. Did I miss something obvious? If so, do you think I’d better stick to a simpler, more conventional and uglier, distro, or it’s worth to try harder, asking about what I don’t understand? My goal is having the apps I use every day at hand to do my things and forget the OS exists, if it is stable enough. I’m tired to waste the limited time I have reinstalling broken systems (Arch-based user). Thanks.

Can you tell us the exact commands you ran and how? Is this with an already installed NixOS or in the installer?

Can you share the contents of your configuration.nix? You can share them in a comment here if you put them between ````` like so:

```nix
# configuration.nix
{ pkgs, config, ...}: {
  # Your code here
}
``delete this text`

Very hard to say. NixOS can get quite technical when you need to do something that isn’t completely straightforward. On the other hand, the module system makes lots of normally complex things easier than with other distros.

NixOS also lacks much presence on stackoverflow, though I think the guides and tutorials out there are getting much better and common.

IMO “not technical” probably doesn’t apply to the kind of person who isn’t scared away by a terminal, and certainly not someone who is capable of incrementally editing code and reading error messages to fix them.

Just not being afraid to try things will get you far, and not getting frustrated and instead asking around on the forums to resolve an issue probably is a good sign - just be aware that you might run into a lot of issues for a while, e.g. it being quite difficult to run anything not directly installed with nix (or flatpak, I suppose, and maybe appimages).

NixOS won’t necessarily fix that, depending on why your systems usually break. Applications can still leave state lying around (you want to be able to e.g. store pictures after all, and that is by definition state).

NixOS, when used correctly, does significantly reduce the amount of configuration that your system pretends to be state, though. E.g., very unlike arch, you will never directly edit a file in /etc, so you will never forget about some random setting that might break things down the line. The nixpkgs module system also allows upstream to warn you about things that would break your system if you update, or even fix problems for you before they happen.

This doesn’t help you if - for example - Firefox decides to create a broken graphics cache and isn’t able to delete that on restart, though. It also doesn’t help you if someone made a mistake upstream and you update (rare, but it happens).

If you wanted an almost completely unbreakable NixOS you’d need impermanence, but that gets quite a bit more technical.

With that out of the way, you might be interested in https://snowflakeos.org/. It’s basically NixOS, but with some GUI tools to help edit your configuration.

Hi.

I entered ‘/etc/nixos’, right-clicked, and chose ‘Open as Administrator’ in the file ‘configuration.nix’. I used Kate, then I applied the changes and run the command ‘nixos-rebuild switch’ from the terminal. It showed me some errors, that I fixed, and run the command again. Another message said the ‘electron-25.9.0’ is insecure and suggested I enabled it anyway. After that, it did the job, apparently, but the apps I put in the config didn’t show up. It was an already installed NixOS. The contents of my configuration.nix are as follows (everything, just in case):

#  configuration.nix
# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "America/Sao_Paulo";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "pt_BR.UTF-8";
    LC_IDENTIFICATION = "pt_BR.UTF-8";
    LC_MEASUREMENT = "pt_BR.UTF-8";
    LC_MONETARY = "pt_BR.UTF-8";
    LC_NAME = "pt_BR.UTF-8";
    LC_NUMERIC = "pt_BR.UTF-8";
    LC_PAPER = "pt_BR.UTF-8";
    LC_TELEPHONE = "pt_BR.UTF-8";
    LC_TIME = "pt_BR.UTF-8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the KDE Plasma Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "br";
    xkbVariant = "";
  };

  # Configure console keymap
  console.keyMap = "br-abnt2";

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # ! Showing error. Compiler sugestion applied by me !
    nixpkgs.config.permittedInsecurePackages = [
      "electron-25.9.0"
    ];

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.rmd = {
    isNormalUser = true;
    description = "rmd";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      firefox
      kate
      vivaldi
      vivaldi-ffmpeg-codecs
      clipgrab
      protonvpn-gui
      obsidian
      goldendict-ng
      freeoffice
      gargoyle
      qalculate-qt
    #  thunderbird
    ];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
     appimage-run
     gnome.gnome-boxes
     brave
  #  wget
  ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

# ! Routine applied by me, to habilitate appimages (as in Nixos Wiki) !
  boot.binfmt.registrations.appimage = {
  wrapInterpreterInShell = false;
  interpreter = "${pkgs.appimage-run}/bin/appimage-run";
  recognitionType = "magic";
  offset = 0;
  mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
  magicOrExtension = ''\x7fELF....AI\x02'';
  };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.11"; # Did you read the comment?

}

I see. But maybe using the simple apps I listed above, and some others alike, shouldn’t be so difficult. I really don’t do anything too fancy in my computer, other than translating English text into some Romance languages and vice versa, a trivial task nowadays.

That is great, for those who has the time and propensity to learn more than the basic installation of some apps to do their stuff easily. Not my case. Your opinion about “non-technical” persons is fair enough.

As for trying things and not getting frustrated, but asking around instead, it depends on the answers. If they solve the issues practically, or if they lead to other questions, more complicated than the first one.

Being so, Nixos is not for me at all. I saw that the system worked smoothly when I installed it, and didn’t try to install anything else. But, for that, I could just use it in a live USB without persistence, the same thing. I don’t use ‘flatpaks’, but the use of ‘appimages’ are not straightforward either. I’m used to clicking and play them immediately.

AUR is generally the culprit. The last arch-based distro I used broke itself all the time just because standard updating it recommended or do in the background when I download anything. I was going crazy, so I decided to use an immutable distro. Preferably based in Arch, since I know the commands I need. But they are all too young and unstable as yet.

When and if this unbreakable NixOS is available to download, I may try it again (same to the snowflake version). For now, I have to be more practical and stick to something less complex, and more archaic, philosophically, like a Debian-based distro (MX, perhaps).

Thank you very much for your time and your answer. It was excellent, and helped me a lot to make an informed decision. Best regards!

PS. I’m still interested to know about the reason for the unresponsiveness of the system regarding the command in question.

I agree, normally that’s what I’d call straightforward, and usually what you’ve done just works.

I don’t see anything off at a glance; which apps specifically are missing?

Fair enough! For the record, your current experience is very unusual. It’s quite possible you would have never run into issues if all you need is a browser and a few things already packaged in nixpkgs, I’m not sure what went wrong in this case.

NixOS certainly is among the distros that need some up-front investment though. If you do ever decide to give it another shot, I’ll happily support :wink:

All of them. It was very strange. The system simply ignored me completely.

Probably, but the system is super lean, without even a calculator. That is good, when the user can choose what to install. Otherwise, it’s not usable enough.

Thanks. I’ll certainly do. See you!