NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.16k stars 14.19k forks source link

system.stateVersion set in configuration.nix is not respected #99168

Closed vandr0iy closed 4 years ago

vandr0iy commented 4 years ago

Describe the bug my /etc/nixos/configuration.nix has its system.stateVersion set to "20.03", but nix just now updated me to the latest unstable one.

To Reproduce Steps to reproduce the behavior: no idea. It just... installed the new OS version last time I ran the upgrade as root.

Expected behavior To stay on the 20.03 'til the end of the time

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.67, NixOS, 21.03pre244669.5aba0fe9766 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.7`
 - channels(root): `"nixos-21.03pre244669.5aba0fe9766"`
 - channels(vandr0iy): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information: my nix config:

# 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 =
    [
      ./hardware-configuration.nix
    ];

  boot = { 
    initrd.luks.devices = {
      root = {
        device = "/dev/sda2";
        preLVM = true;
      };
    };
    loader.grub = {
      efiSupport = true;
      device = "nodev";
    };
  };

  virtualisation.docker.enable = true;
  programs.gnupg.agent.pinentryFlavor = "qt";
  programs.gnupg.agent.enable = true;

  networking = {
    hostName = "feanor";
    usePredictableInterfaceNames = false; 
    networkmanager.enable = true;
  };

  # Select internationalisation properties.
  console = {
    font = "Lat2-Terminus16";
    keyMap = "us";
  };
  i18n = {
    defaultLocale = "en_US.UTF-8";
  };

  time.timeZone = "Europe/Zurich";

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    # basics 
    autorandr
    bash_5
    btrfsProgs
    exfat
    exfat-utils
    file
    git
    htop
    killall
    lshw
    mssys
    ntfs3g
    ncdu
    pciutils
    telnet
    traceroute
    unzip
    vim
    wget 
    which
    zsh

    # devopsing
    docker
    docker-compose
    unifi
    nvidia-docker

    # programming
    python3
    mysql57

    # multimedia
    mpv
    python37Packages.youtube-dl
    mplayer
    ffmpeg_4

    # network
    networkmanager

    # security
    oathToolkit

    # nix utils
    nix-prefetch-scripts

    # graphical applications
    compton
    evince
    firefox
    gparted
    i3-gaps
    i3status-rust
    kate
    libreoffice
    lxqt.pavucontrol-qt
    plasma-nm
    plasma-pa
    tdesktop
    teamviewer
    thunderbird
    x11docker
    xscreensaver
    xorg.xkill

    steam
    steam-run-native

  ];

  nixpkgs.config = {
    allowUnfree = true;
     allowBroken = true;
  };

  nixpkgs.config.packageOverrides = pkgs: {
    steam = pkgs.steam.override {
      nativeOnly = true;
    };
  };

  sound.enable = true;
  hardware.pulseaudio = {
    enable = true;
    support32Bit = true;
    package = pkgs.pulseaudioFull;
  };
  hardware.bluetooth.enable = true;

  # steam settings
  hardware.opengl.driSupport32Bit = true;

  services = {
    # bluetooth
    blueman.enable = true;
    # Enable the X11 windowing system.
    xserver = {
      enable = true;
      layout = "us";
      # services.xserver.xkbOptions = "eurosign:e";

      # Enable touchpad support.
      libinput.enable = true;

      # Enable the KDE Desktop Environment.
      displayManager = {
        sddm.enable = true;
        sessionCommands = ''
          export LC_CTYPE=en_US.UTF-8
          export LC_NUMERIC=de_CH.UTF-8
          export LC_TIME=en_GB.UTF-8
          export LC_COLLATE=en_US.UTF-8
          export LC_MONETARY=de_DE.UTF-8
          export LC_MESSAGES=de_DE.UTF-8
          export LC_PAPER=en_US.UTF-8
          export LC_NAME=en_US.UTF-8
          export LC_ADDRESS=de_DE.UTF-8
          export LC_TELEPHONE=en_US.UTF-8
          export LC_MEASUREMENT=de_DE.UTF-8
          export LC_IDENTIFICATION=en_US.UTF-8
          export LC_ALL=en_US.UTF-8
        '';
      };
      desktopManager.plasma5.enable = true;
    };

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

    mysql = {
      package = pkgs.mysql57;
      enable = true;
    };
  };

  # Define a user account. Don't forget to set a password with `passwd`.
  # Enable `sudo` for the user "vandr0iy", let him use docker and play with networks
  users.users.vandr0iy = {
    isNormalUser = true;
    shell = pkgs.zsh;
    group = "users";
    createHome = true;
    extraGroups = [ "wheel" "video" "audio" "disk" "docker" "networkmanager" ]; 
  };

  # This value determines the NixOS release with which your system is to be
  # compatible, in order to avoid breaking some software such as database
  # servers. You should change this only after NixOS release notes say you
  # should.
  system.stateVersion = "20.03"; # Did you read the comment?

}

Please, tell me if there's anything wrong with my config that might have caused this behavior

OPNA2608 commented 4 years ago

system.stateVersion does not pin your system to a specific version of NixOS, it's to ensure that stateful parts of your system keep working when otherwise backwards-incompatible changes to e.g. options might happen in the future. See the option description for a more thorough explanation.

  • channels(root): "nixos-21.03pre244669.5aba0fe9766"

Your system got upgraded to 21.03 because that's seemingly what your root channel is pointing at. You can run nix-channel --list as root to confirm that; To keep running with 20.03, it should point at https://nixos.org/channels/nixos-20.03.

vandr0iy commented 4 years ago

oh - I have my nix-channels mismanaged. Noticed only now. Thank you for the help!