I’m new to Python, however, I did spend 2 weeks getting NixOS installed, even having to go into windows powershell and clean up the boot record from making so many mistakes at the beginning with google searches and following Gemini/Claude instructions, and got it done lol.
Pretty proud of where I got my configs too at this point, I dropped them at the end so you can be in awe at the power
Just want you to know I actually can follow instructions and/or do it myself with a little help
Quick first question: Do I need flakes enabled to just run a shell because I am getting this:
[cosmic@nixos:~/projects/psychobio_project]$ nix shell
path '/home/cosmic/projects/psychobio_project' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file
[cosmic@nixos:~/projects/psychobio_project]$ nix develop -f shell.nix
error (ignored): error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it #at this point I enabled flakes in my configuration.nix
[cosmic@nixos:~/projects/psychobio_project]$ nix shell
path '/home/cosmic/projects/psychobio_project' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file
[cosmic@nixos:~/projects/psychobio_project]$ nix develop -f shell.nix #hope about to be crushed because I was all caught up and autopilot
[cosmic@nixos:~/projects/psychobio_project]$ nix shell
path '/home/cosmic/projects/psychobio_project' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file #and reality kicks in
All I want to do is run a script on already downloaded XML versions of PubMed papers, and the script I have is designed to operate on python3 with lxml & networkx.
In the docs for 24.11 I see that the python3 installed with the system includes python312, and since I am new, I just put all this in my configuration.nix:
environment.systemPackages = with pkgs; [
python3Full #available in nix-env, added in packages for accessability and stability
python312Packages.biopython #extensive libraries- https://biopython.org/docs/latest/Tutorial/chapter_quick_start.html
python312Packages.elementpath #https://github.com/sissaschool/elementpath
python312Packages.networkx #for CAG
python312Packages.pep8 #https://pep8.readthedocs.io/en/release-1.7.x/
python312Packages.scikit-bio #r&d/educator tool kit- https://scikit.bio/
python312Packages.types-lxml #https://github.com/abelcheung/types-lxml
but when I try to run my script, I get this error:
$ python generate_config_from_pubmed.py –input_dir input_pubmed_xml –output_dir config –output_config psychobiotics_config.json [--log generator.log]
Traceback (most recent call last):
File "/home/cosmic/projects/psychobio_project/generate_config_from_pubmed.py", line 6, in <module>
from lxml import etree as ET
ModuleNotFoundError: No module named 'lxml'
Now to be honest, I got pointed to this magical post Jack’s Full Solution, and would really love to do that to my system and just not worry about anything, and while that post makes more and more sense to me, I would love to see if anyone could help me understand it a little better?
And then this got shared in case I just wanted to brute force nix to do the thing: Heretic Packaging
I don’t even need to run the script in a shell, but I need to know how to do it anyway.
The feeling like I am missing something very obvious is getting familiar, but I’m enjoying it because a solution feels great when it shows up lol
thanks everyone
~Brian
Here’s where I’ve gotten my configs to:
#configuration.nix
{ 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
environment.systemPackages = with pkgs; [
brave # ### chromium based browser just in case
clinfo
driversi686Linux.libva-vdpau-driver
#flameshot # testing screenshot tool, may return, trying gscreenshot
geany # testing as IDE/text editor
gitFull
github-desktop
gnome-commander # ## twin-pannel file manager with usefullness
#gscreenshot
libreoffice
python3Full #available in nix-env, added in packages for accessability and stability
python312Packages.biopython #extensive libraries- https://biopython.org/docs/latest/Tutorial/chapter_quick_start.html
python312Packages.elementpath #https://github.com/sissaschool/elementpath
python312Packages.networkx #for CAG
python312Packages.pep8 #https://pep8.readthedocs.io/en/release-1.7.x/
python312Packages.scikit-bio #r&d/educator tool kit- https://scikit.bio/
python312Packages.types-lxml #https://github.com/abelcheung/types-lxml
qalculate-gtk # ### replacing gnome-calculator
usage # ### baobab replacement attempt
util-linux
vim
wget
#xdg-desktop-portal-gnome
zram-generator
];
# attempting easyPubMed Install
#install.packages = ("easyPubMed");
# 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-initial-setup #no issues so far with stability
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?
loupe #might be useful, attempting to use flameshot
nautilus #attempting gnome-Commander
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?
}
and
# 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;
}