Setting up Purpose build Nixos + Gnome for Python scripts and research - NO HOME MANAGER

Now that I’ve gotten my feet wet I can acknowledge that all that is awesome and a really good learning project… after I get used to working with nixos-shell and python since I’ve never done anything in python but I have a specific use to build out first.

I will say, I thoroughly enjoyed my trying to go to far to fast too soon lol
it’s my favorite learning style as long as I know I’m doing it hahahaha

As long as you are having fun and are motivated then head-first is the way to go :slight_smile:

1 Like

uv2nix?

Got my system dialed in so far and getting ready to do some python practice. I know idle3 is installed by default with python3 in 24.11, but I added python3Full & python312Packages.biopython to my systemPackages.

I know idle3 is installed, but I grabbed Geany last night and just starting to work with it.

My goal is to get everything setup cleanly in my config.nix. This is my first time trying an import with github. I thought I was supposed to add this script to my config:

let
  pkgs = import <nixpkgs> { };
  inherit (pkgs) lib;

  pyproject-nix = import (builtins.fetchGit {
    url = "https://github.com/pyproject-nix/pyproject.nix.git";
  }) {
    inherit lib;
  };

  uv2nix = import (builtins.fetchGit {
    url = "https://github.com/pyproject-nix/uv2nix.git";
  }) {
    inherit pyproject-nix lib;
  };

  pyproject-build-systems = import (builtins.fetchGit {
    url = "https://github.com/pyproject-nix/build-system-pkgs.git";
  }) {
    inherit pyproject-nix uv2nix lib;
  };

in
  ...

but when I use it as is, nix doesn’t like the “let” term:

error:
       … while evaluating the attribute 'config.system.build.toplevel'
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:12288:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:12297:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: syntax error, unexpected LET
       at /etc/nixos/configuration.nix:89:3:
           88|   # ### Attempt to add uv2nix
           89|   let
             |   ^
           90|     pkgs = import <nixpkgs> { };

I know I’m missing something really simple, so if anyone could point me to the obvious answer with a good laugh I would be grateful! Guessing its an enlightening syntax error at a minimum lol

dropping both my full configs for myself, and for reference if needed:

configuration.nix

# 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"; # Your hostname
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Enable networking
  networking.networkmanager.enable = true;

  # Zram & other memory stuff
  zramSwap.enable = true;
  zramSwap.memoryPercent = 50;

  # Network Proxy Settings
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

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

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

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

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.videoDrivers = [ "amdgpu" ];

  # Enable the GNOME Desktop Environment.
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;

  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

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

  # Enable sound with pipewire.
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

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

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.cosmic = {
    isNormalUser = true;
    description = "cosmic";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  thunderbird
    ];
  };

  # Install firefox.
  programs.firefox.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true; 
  # List packages installed in system profile. to search, run: 
  # $ nix search wget
  
  # EXPERIMENTAL package features
  nix.settings.experimental-features = [ "nix-command" ];

  # HP Model 14-dk0028wm Laptop Research Workstation
  environment.systemPackages = with pkgs; [
    brave # ### chromium based browser just in case
    clinfo
    driversi686Linux.libva-vdpau-driver
    flameshot # testing screenshot tool
    geany # testing as IDE/text editor
    gitFull
    github-desktop
    libreoffice
    python3Full
    python312Packages.biopython #specific area of research uses this library frequently, might be useful in the future
    usage # ### baobab replacement attempt
    util-linux
    vim
    wget
    zram-generator
  ];

  #  For 24.11, pretty big list of packages options to setup your GNOME environment
  #  with an adjustable amount of bloat :) 
  #  #blahblah = an active package that gets installed, delete (#) to remove package
  #  #??? = Probably/Maybe remove carefully
  #  #XXX = please don't deactvate without reason 
  
  environment.gnome.excludePackages = with pkgs; [
  # ### all packages active here are being removed
    cheese #webcam not welcome as a default
    evince #document viewer, no need with LibreOffice
    geary #email client, develop if wanted
    gnome-backgrounds #no need
    gnome-bluetooth #no need
    gnome-calendar #no need
    gnome-characters # ### special character map, testing removal unless needed
    gnome-clocks #no need
    gnome-connections # ### testing removal of Remote Client
    gnome-contacts #basic contacts app, no need
    gnome-font-viewer #no need
    gnome-logs #?
    gnome-maps #no need
    gnome-music #no need
    gnome-online-accounts #I don't want this as a default
    gnome-photos #no need
    gnome-tour # GNOME Shell detects the .desktop file on startup, no need 
    gnome-user-docs #useful reference to start with
    gnome-weather #weather app, no need
    snapshot # ### removal shouldn't effect DE stability
    totem #video player
    yelp #help viewer

    # ### These are useful, pending replacement, or possibly sensitive
    #glib #helps gsettings program and others I believe
    gnome-calculator # ### testing Qalculate-gtk
    #gnome-console #nice to start with ### Possibly replace with Geany
    gnome-text-editor # ### testing Geany as replacement
    #gnome-themes-extra #for the rizz

    # ??? These are probably ok, alright, or oopsie things to remove
    baobab # ### attempting to replace with Usage
    #???gnome-control-center #for desktop functionality?
    gnome-initial-setup #fafo one time
    #???gnome-loupe #might be useful
    #???gnome-nautilus #file manager, functional to start
    simple-scan # ### testing removal
    #???gnome-system-monitor #XXX Might support DE, test carefully

    #XXX Most likely or absolutely need to be here to function
    #XXXadwaita-icon-theme ### don't delete, replace
    #XXXgnome-color-manager #default screen correction, good to start with, upgrade later
    #XXXgnome-menus #makes desktop work
    #XXXgnome-epiphany #??? probably has DE stabilizing benefits
    #XXXgnome-orca #screen reader that keeps the desktop functional
    #XXXgtk3.out #gtk-launch program, keep for desktop
    #XXXxdg-user-dirs #update user directories, don't disable unless you know what you're doing

  ];

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

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

  # ### Default Release Value ###
  # 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 = "24.11"; # Did you read the comment?

}

hardware-configuration.nix

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ "amdgpu" ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/a64bb1dc-cf69-4d41-89db-98a22ea3cabe";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/1284-4374";
      fsType = "vfat";
      options = [ "fmask=0077" "dmask=0077" ];
    };

  fileSystems."/efi" =
    { device = "/dev/disk/by-uuid/ACD2-C2B7";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/c4a01f3b-299c-4871-a728-6d19f8106e7b"; }
    ];


  # General AMD GPU/OpenGL support settings, for the 24.11 instructions:  
  hardware.graphics = 
    { enable = true;
      enable32Bit = true;
      extraPackages = with pkgs; [
        libvdpau-va-gl
        libva-vdpau-driver
        amdvlk
        rocmPackages.clr 
        rocmPackages.clr.icd
        libva 
        
      ];
      extraPackages32 = with pkgs; [
        driversi686Linux.amdvlk
      ];
    };


  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.eno1.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

Thank you, I’m going to check out that discourse now, def helps me learn seeing it applied.

thank you for those packaging tips!

This isn’t just my first time in NixOS, it’s my first distro ever :grinning: