The issue with nuShell is that each time I launch it, it gives this error:
[rudra@nixos:~/nixos-config]$ nu
Error: × I/O error: Read-only file system (os error 30)
And the issue with zsh is that it can’t find any programs I have installed:
nixos-config ❯ kubectl master
zsh: command not found: kubectl
Or even very basic UNIX utilities such as ls:
nixos-config ❯ ls master
zsh: command not found: ls
This means I can’t use my favourite shell (nushell) or second favourite shell (zsh) on nixOS
I’m trapped on using fish (my third favourite) and bash (my fourth favourite)
Here is my complete nixos and home-manager configuration my user in home-manager is “rudra” and “rudratwo” is a backup user in case something goes wrong with “rudra”: GitHub - rudra-code-creator/nixos-flake: My nixos-flake
in addition, from a quick look at the home manager config and nu,
you are not using home-manager programs.x.enable for x including nushell, carapace, and some others
you’re dropping in some dotfiles instead
those dotfiles look like largely default (which is unnecessary because they’ll be the default if left unset) plus some manual integration of carapace etc.
At least for nu, and probably also for many of the others, it’s probably better to get h-m to generate those dotfiles for you, and it will include the integrations and shell hooks and so on for each thing into the config for the others.
i suspect the PATH issue above (or something else similar related to PATH) is your first problem, but the rest is a worthwhile migration to go through afterwards.
home.sessionPath = [
# no need for a bare $PATH item; these are all appended to any base
# PATH you already have
# and /usr/bin isn't a thing on NixOS (all it should ever contain is
# `env`, as a concession to shell scripts that haven't been fixup-ed
# by a Nix derivation)
"$HOME/.local/bin"
"$HOME/rudra-app-repo"
];
when you start nu using this config, what does $env.PATH output?
By the way, the read-only filesystem error is because your .config/nushell/ is a symlink into the store due to the way you’re deploying the dotfiles and linking the directory, and it will be trying to create the history file there. You could link the individual files into a writeable version of this directory in your home, as a first step, or do as above.
Oh, on re-reading: is this the only issue with nu, and the path issue is something else zsh specific?
I can’t check $env.PATH output because after I launch nu it shows the read-only filesysem error and then exits back to bash immediately, so I’m not sure if the path issue is only for zsh. I will now try adding a history.txt file into dotfiles-rudra so that it can also go in .config and potentially nu can actually launch so i can run $env.PATH
How do I do that? I use ln -s ~/nixos-config/modules/users/rudra/dotfiles-rudra/nushell ~/.config/nushell right? but doesn’t that defeat the whole purpose of home-manager
The recursive option is creating a directory, and symlinking each file. But the directory is being created with permissions matching the source, which is probably not writable by you.
I don’t actually see an option to override the permissions (which is a little surprising, I may be missing it), so I suggest just making 2 entries, one for each of the .nu files, and having a regular directory there.
[rudra@nixos:~/nixos-config/modules/users]$ bash /home/rudra/nixos-config/modules/scripts/flake-build.sh
Building and updating NixOS flake configuration...
Checking for changes...
No changes detected in git.
Rebuilding NixOS configuration...
building the system configuration...
error:
… while calling the 'head' builtin
at /nix/store/rs4fjbnw4qx7ns2hzzrz2iz52va7vs5z-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/rs4fjbnw4qx7ns2hzzrz2iz52va7vs5z-source/lib/modules.nix:816:9:
815| in warnDeprecation opt //
816| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
817| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error:
Failed assertions:
- rudra profile: Conflicting managed target files: .config/nushell/config.nu, .config/nushell/env.nu
This may happen, for example, if you have a configuration similar to
home.file = {
conflict1 = { source = ./foo.nix; target = "baz"; };
conflict2 = { source = ./bar.nix; target = "baz"; };
}
[rudra@nixos:~/nixos-config/modules/users]$
I beleive this is because the older copies of config.nu and env.nu are still in the nix store how do I get rid of them?
Nah, that’s definitely not it. More likely it’s something like Home Manager generating config.nu and env.nu files itself from other settings, and those are conflicting with your hand-written files. Did you turn on programs.nushell.enable?