Linux veteran, NixOS noob. After referencing this previous topic - Python3 not importing modules - I figured that a complete rebuild of my system would fix this. But I was wrong. I’ve tested this from a console login, with no user accounts. The modules I’m adding are there, it’s just that the link created for python is not in the same store as the installed modules.
Here is my 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
];
# GRUB bootloader
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
efiSupport = true;
device = "nodev";
};
};
# Networking
networking = {
hostName = "nixos-kde";
networkmanager.enable = true;
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
};
};
fileSystems."/media/host" = {
device = "dss-endeavouros:/";
fsType = "nfs";
options = [ "nfsvers=4.2" "x-systemd.automount" "noauto" ];
};
# locale
time.timeZone = "America/Los_Angeles";
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";
};
# X11 with KDE
services.xserver = {
enable = true;
layout = "us";
xkbVariant = "";
displayManager.sddm.enable = true;
desktopManager.plasma5.enable = true;
videoDrivers = [ "virtio" ];
};
# 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;
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Global packages
environment.systemPackages = with pkgs; [
# system
# firewalld
conky
lsb-release
partition-manager
qemu_kvm
spice-vdagent
xdg-user-dirs
# development
git
man-pages
man-pages-posix
python311
(python311.withPackages (ps: with ps; [ ipython distro pyaml ]))
# utilities
bat
duf
fastfetch
fd
fish
inxi
lsd
lynis
ncdu
nmap
unison
vim
wget
];
programs = {
fish.enable = true;
less.enable = true;
nano.syntaxHighlight = true;
nano.nanorc = ''
set atblanks
set autoindent
set boldtext
set breaklonglines
set casesensitive
set constantshow
set historylog
set indicator
set linenumbers
set locking
set matchbrackets "(<[{)>]}"
set mouse
set nonewlines
set softwrap
set tabsize 4
set tabstospaces
set trimblanks
set titlecolor bold,white,magenta
set promptcolor black,yellow
set statuscolor bold,white,magenta
set errorcolor bold,white,red
set spotlightcolor black,orange
set selectedcolor lightwhite,cyan
set stripecolor ,yellow
set scrollercolor magenta
set numbercolor magenta
set keycolor lightmagenta
set functioncolor magenta
extendsyntax python tabgives " "
extendsyntax makefile tabgives " "
bind ^X cut main
bind ^C copy main
bind ^V paste all
bind ^Q exit all
bind ^S savefile main
bind ^F whereis all
bind ^G findnext all
bind ^R replace main
unbind ^U all
unbind ^N main
unbind ^Y all
unbind M-J main
unbind M-T main
bind ^Z undo main
'';
partition-manager.enable = true;
vim.package = pkgs.vim-full;
};
# List services that you want to enable:
services = {
fstrim.enable = true;
openssh.enable = true;
qemuGuest.enable = true;
printing.enable = true;
spice-vdagentd.enable = true;
};
# 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.05"; # Did you read the comment?
}
Everything else that I’ve tested seems to be working OK. As you can see, though, my python link points to the wrong store:
/run/current-system/sw/bin/python -> /nix/store/3k7is7nc2xbav8a48vx7arad522d8czx-python3-3.11.4/bin/python
installed pyaml
module
pyaml -> /nix/store/wmbcmrrhni2pv2x1zfvwmvpr7saycbv3-python3-3.11.4-env/lib/python3.11/site-packages/pyaml
I’ve tried python3
and python311Full
, both with the same results. I feel like I’m sooooo close to actually getting NixOS to work. What am I doing wrong?