Recursive configuration.nix issues

Guys,

Happy easter to y’all. Today I am setting-up some updates on my configration.nix based on @jluttine model. But I have observed, that the specific file ./local-configuration.nix##wjjunyor was not loaded.

May can you appoint what I am missing:

The reference is made directly ans not as variable, as I am starting the settings.

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      # Enable the KDE Desktop Environment.
      ./kde-configuration.nix
      ./local-configuration.nix
      ./local-configuration.nix##user.wjjunyor
    ];

Hi! I would need to know a bit more about those local-configuration.nix and local-configuration.nix##user.wjjunyor files. Are they symbolic links, and if so, where do they point? Also, I guess the ##user.wjjuynyor suffix is treated as a comment, not as part of the filename because # is a commenting symbol in nix. Maybe you should put quotes over the filename? Not sure though. But anyway, how I have used my settings is such that I don’t need to import those ##suffix files, but only local-configuration.nix which is a symbolic link pointing to the correct file.

So, my guesses would be:

  • Remove ./local-configuration.nix##user.wjjunyor from the imports.
  • Make sure ./local-configuration.nix is a symbolic link pointing to ./local-configuration.nix##user.wjjunyor.

But of course, you might be using files differently. This was just based on how I’ve used files in my configuration.nix and as you referred to those, I thought I’d clarify that.

Does this help?

It Helps a lot, I didn’t knew the ##user.wjjunyor would be interpreted as a comment - The local-configuration.nix is suposed to be absolute and standard for all machines. But the ##user.USERNAME is to be used in a per user context as a dynamic reference to be set after it is working well.

For now, the local configuration and the user configuration are just loading packages and applications.

#./local-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
      # Enable the KDE Desktop Environment.
      ./kde-configuration.nix
      ./local-configuration.nix
      ./local-configuration.nix##user.wjjunyor
    ];

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;

  # Uses the most recent packages.
  boot.kernelPackages = pkgs.linuxPackages_latest;

  # Supposedly better for the SSD.
  fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.device = "nodev";
  boot.loader.grub.efiSupport = true;
  boot.loader.efi.canTouchEfiVariables = true;
  # Grub menu is painted really slowly on HiDPI, so we lower the
  # resolution. Unfortunately, scaling to 1280x720 (keeping aspect
  # ratio) doesn't seem to work, so we just pick another low one.
  boot.loader.grub.gfxmodeEfi = "1024x768";
  boot.loader.grub.enableCryptodisk = true;
  boot.initrd.luks.devices = {
    "root" = {
    device = "/dev/disk/by-uuid/d83054a8-ef44-4e19-99a9-d498ba6a6d62";
    preLVM = true;
    allowDiscards = true;
    };
  };

  # Networking set-up
  networking.hostName = "T101"; # Define your hostname.
  networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  networking.nameservers = [ "84.200.69.80" "84.200.70.40" ]; # CloudFlare / DNS Watch
  
  # Wi-fi corporate network set-up
  networking.wireless.networks = {
    "walCOR Seguros" = {         # SSID with spaces and/or special characters
    pskRaw = "#####";
    };
  };

  # The global useDHCP flag is deprecated, therefore explicitly set to false here.
  # Per-interface useDHCP will be mandatory in the future, so this generated config
  # replicates the default behaviour.
  networking.useDHCP = false;
  networking.interfaces.enp1s0.useDHCP = true;
  networking.interfaces.wlp2s0.useDHCP = true;

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

  # Select internationalisation properties.
  console.font = "Lat2-Terminus32";
  console.keyMap = "br-abnt2";
  i18n.defaultLocale = "pt_BR.UTF-8";
  
  # Set your time zone.
  time.timeZone = "America/Campo_Grande";

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  # environment.systemPackages = with pkgs; [
  #   wget vim
  # ];

  # 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; };

  # 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;

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

  # Team Viewer Listener
  services.teamviewer.enable = true;

  # Enable sound.
  sound.enable = true;
  hardware.pulseaudio.enable = true;

  # Loads GPU drivers on T-101 station.
  nixpkgs.config.allowUnfree = true;
  services.xserver.videoDrivers = [ "intel" "amdgpu" ];

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

  # Enable touchpad support.
  services.xserver.libinput.enable = true;

  # 32 bit Open GL support.
   hardware.opengl.driSupport32Bit = true;

  # Fonts Settings.
  fonts.enableFontDir = true;
  fonts.enableGhostscriptFonts = true;
  fonts.fonts = [ pkgs.inconsolata pkgs.unifont pkgs.font-awesome-ttf pkgs.source-code-pro  pkgs.freefont_ttf pkgs.opensans-ttf pkgs.liberation_ttf pkgs.liberationsansnarrow pkgs.ttf_bitstream_vera pkgs.libertine pkgs.ubuntu_font_family pkgs.gentium pkgs.symbola ];

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.wjjunyor = {
    isNormalUser = true;
    extraGroups = [ "wheel" "disk" "audio" "video" "networkmanager" "systemd-journal" "adbusers" ]; # Enable ‘sudo’ for the user.
    home = "/home/wjjunyor";
    description = "Walter Queiroz";
    uid = 1000;
  };
    users.users.caroles = {
    isNormalUser = true;
    extraGroups = [ "wheel" "disk" "audio" "video" "networkmanager" "systemd-journal" "adbusers" ]; # Enable ‘sudo’ for the user.
    home = "/home/caroles";
    description = "Carolina Queiroz";
    uid = 2000;
  };

 
  # 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 = "19.09"; # Did you read the comment?
  
  # Auto upgrade Always ON.
  system.autoUpgrade.enable = true;

  # Enable SmarCard Daemon.
  services.pcscd.enable = true;
  services.pcscd.plugins = [ pkgs.pcsclite pkgs.opensc pkgs.openssl pkgs.pcsctools pkgs.libusb pkgs.libusb1 pkgs.ccid pkgs.chrome-token-signing ]; #pkgs.pcsc-cyberjack ];
  
  # Fundamental core packages
  environment.systemPackages = with pkgs; [
    # Basic command line tools
    bash
    wget
    file
    gksu
    git
    hdf5
    zip
    unzip
    htop
    yle-dl
    youtube-dl
    nix-index
    dnsutils
    whois
    coreutils
    vbetool
    killall
    nethogs
    unrar
    # Gamin: a file and directory monitoring system
    fam
    # Basic image manipulation and handling stuff
    imagemagick
    ghostscript
    # Text editors
    vim
    xclip  # system clipboard support for vim
    # VPN
    pptp
    openvpn
    # File format conversions
    pandoc
    pdf2svg
    # Screen brightness and temperature
    redshift
    # SSH filesystem
    sshfsFuse
    # Encryption key management
    gnupg
    # Yet another dotfile manager
    yadm
    gnupg1orig
    # Password hash generator
    mkpasswd
    # Android
    jmtpfs
    gphoto2
    libmtp
    mtpfs
    nix-prefetch-git
    # Make NTFS filesystems (e.g., USB drives)
    ntfs3g
    # Encrypted USB sticks etc
    cryptsetup
    # GPG password entry from the terminal
    pinentry
    # GUI for sound control
    pavucontrol
    python3Packages.magic-wormhole
    # Bluetooth Support
    bluez
    bluezFull
    bluez-tools
    # Suporte SegFy e TI
    teamviewer
    ];
}

#./local-configuration.nix##user.wjjunyor
{ users, pkgs }:
{
  # hostName = "t101";
  nixpkgs = "/etc/nixpkgs";
  # grubDevice = "/dev/sda";
  users = with users; [
    (wjjunyor { groups = [ "wheel" "adbusers" ]; })
  ];
  # displayManager = "sddm";
  # desktopEnvironment = "plasm5";
  extraServices = {
    sshd = false;
    emacs = false;
    bluetooth = {
      enable = true;
    };
    mailserver = {
      enable = false;
    };
    # mythbackend = true;
    # mythfrontend = true;
    storj = true;
    # bluray = true;
    adb = true;
    # https://github.com/jluttine/CryptOS
    cryptos = {
      enable = false;
    };
    # https://syncthing.net/
    syncthing = {
      enable = false;
      user = "wjjunyor";
    };
  };
  extraPackages = with pkgs; [
    # LaTeX https://en.wikipedia.org/wiki/TeX
    # texlive.combined.scheme-full
    # OpenStreetMap editor
    josm
    # 3D modelling
    # blender
    # Zotero client
    #qnotero
    encfs
    # E-books
    fbreader
    calibre
    # RSS reader
    #feedreader
    rssguard
    # Disk usage analysis
    filelight
    qdirstat
    w_scan
    # Photo manager
    shotwell
    # Audio editor
    audacity
    # MPD client
    cantata
    # Panorama stitcher (with raw support)
    hugin
    #dcraw # marked as insecure
    # HDR photography
    luminanceHDR
    #  Photo/Image Editor
    gimp-with-plugins
    # Vector Editor 
    inkscape
    # Torrenting
    ktorrent
    # Browser
    tor-arm.x86_64-linux
    tor                            # PARA PRODUÇÃO DEIXAR O TOR E OS FIREFOX SOMENTE PARA OS USUÁRIOS wjjunyor e caroles.melo
    tor-browser-bundle-bin         # Erro Download
    # Instant messaging
    #cutegram
    tdesktop
   #qtox
    linphone
    #pybitmessage
    riot-web
    # For Whatsapp Bridging on Riot
    mautrix-whatsapp 
    # Twitter
    corebird
    # Torrenting
    ktorrent
    # Encryption
    openssl
    # Tool for searching files/binaries from Nix packages
    nix-index
    # FTP Client
    filezilla
    # Programming
    # emacs
    # gitAndTools.gitflow
    # pgadmin
    # gitAndTools.hub
    # direnv
    # Password manager
    pass
    # Separate tiling window manager
    #i3
    patchelf
    # JOGOS DA QUARENTENA
    libGL
    discord
    minecraft
    # Mobile SSH replacement
    mosh
    k3b
    dvdplusrwtools
    (python3.withPackages (ps: with ps; [
      numpy
      scipy
      # Python language server for Emacs
      #python-language-server
    ]))
  ];
}

There is a lot yet to do. And a lot of things to be cleaned. But thanks for the help.

The # signs in your file name are causing Nix to parse that part of the name as a comment.

$ nix repl
> /foo#bar
/foo