<kenshinCH>
hey all. I'm trying to use home-manager as a module. After creating the `profile` folder manually, because the service was not starting, it worked, but since I put `programs.feh.enable = true` I was expecting to be able to lauch feh
<kenshinCH>
I do see the config file in `.config`, but the executable is not in path. Is that expected?
<immae>
kenshinCH: it should be in ~/.nix-profile/bin/feh, do you have that in your PATH ?
<immae>
(sorry: by "that" I mean ~/.nix-profile/bin, is this directory in your PATH ?)
<kenshinCH>
it's in the path, but that directory only has `hello`
<kenshinCH>
(which I installed with the command I found in a ticket for the missing directory)
<kenshinCH>
but something must be screwed up, because I see stuff from my main user in the PATH
<kenshinCH>
(I'm working on a test user, to be safe, ATM)
<kenshinCH>
trying with a fresh user
<immae>
when you switch user, you should do `su -`, otherwise you may keep some variables from the old user
<immae>
(However I don’t expect that it explains your initial issue)
<kenshinCH>
so, `/nix/var/nix/profiles/per-user/test1` nop such file or directory. I can just create it manually?
<immae>
kenshinCH: if you truly login into test1 user it should be created automatically
<immae>
(via su - or ssh or graphical)
<immae>
In this case, I think the /etc/profile didn’t run an thus the "nix initialisation" was skipped for user1
<kenshinCH>
hmm I did `su -` on the fresh, new `test1` account, after `switch` failed because of missing directory
<kenshinCH>
and PATH is just `/bin /usr/bin`
<kenshinCH>
if the module fails, why should `/etc/profile` be created?
<{^_^}>
#1050 (by NicolasGuilloux, 1 week ago, open): User folder in /nix/var/nix/profiles/per-user not created
<{^_^}>
#948 (by deliciouslytyped, 12 weeks ago, open): home-manager-$USER service failing to start
<immae>
/etc/profile is not disableable, every bash shell will run it no matter what
<immae>
It may happen that it doesn’t contain proper nix initialisation though
<kenshinCH>
ah sorry I thought you meant the specific one for the user
<kenshinCH>
checking
<kenshinCH>
you mean `/nix/store/...set-environment`?
<immae>
kenshinCH: in my case, ...set-environment contains "export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"", and then /etc/profile does mkdir -m 0755 -p "$NIX_USER_PROFILE_DIR"
<immae>
So if you start a login shell as test1, it should either create the directory or fail with an error message
<kenshinCH>
:/ I have no `mkdir` in /etc/profile
<immae>
ok
<immae>
Let me look
<immae>
are you on nixos ?
<kenshinCH>
yep
<kenshinCH>
19.09
<immae>
Did you happen to modify environment.shellInit ?
<kenshinCH>
hmm not that I can see.
<kenshinCH>
maybe it's because I set `fish` as default shell?
<immae>
Ah, possibly
<immae>
Can you look in /etc/fish/config.fish then?
<kenshinCH>
doesn't exist
<immae>
(also, it could be worth enabling bash for test1, just to figure out where we are)
<immae>
Ok
<immae>
Do you have programs.fish.enable (in system nixos configuration) then?
<kenshinCH>
trying that
<kenshinCH>
still lauches fish
<kenshinCH>
let me change the global shell
<immae>
If you add programs.fish.enable = true to your configuration it should set the equivalent of /etc/profile in /etc/fish/config.fish
<immae>
(As far as I see from the code)
<immae>
And then it should work (at least, create the missing directory)
<kenshinCH>
that was already set from the start (if you mean in the user's home-manager)
<immae>
no, I meant in the system nixos configuration
<kenshinCH>
ah no i never added that. I thought setting `defaultshell` would be enough. Let me try
<immae>
`programs.fish.enable = true` in /etc/nix/configuration.nix => /etc/fish/config.fish should then exist => /nix/var/nix/profiles/per-user/ should eb created
<immae>
(note that I didn’t test it, I’m only reading code, so bear with me if I’m wrong)
<kenshinCH>
wow that's rebuilding a lot of stuff
<immae>
mainly /etc files
<kenshinCH>
and completions :)
<immae>
right :p
<kenshinCH>
still not created :/
<immae>
did you re-logged in after that?
<kenshinCH>
yep
<immae>
(and is the /etc/fish/config.fish there now?)
<kenshinCH>
❯ grep mkdir /etc/fish/config.fish
<kenshinCH>
nothing
<immae>
Can you post the content of this file somewhere? (there should be no sensitive values, but check just in case)
<immae>
Right, so I indeed misread the code... /etc/fish/foreign-env/shellInit should contain the mkdir
<kenshinCH>
empty
<immae>
totallyempty?
<kenshinCH>
yep
<kenshinCH>
who should fill it? normal nix, or home-manager?
<immae>
no, there is nothing from home-manager yet
<kenshinCH>
(I only set `promptInit`)
<immae>
I guess there is some change somewhere but I cannot see what, sorry...
<kenshinCH>
no problem. Anyway, this can just be fixed by creating that by hand, right?
<immae>
it should probably yes, but in my system it does many other things along this mkidr
<kenshinCH>
that's wierd :/ are you on unstable?
<kenshinCH>
I'll have a look in another couple of machine I have around
<immae>
No, 19.03
<immae>
If you give me a bit of time before doing it by hand, I‘ll try to find out what changed in that regards
<kenshinCH>
only one question then: is this module option not very mature yet? I kinda want to use that, and I'm in no rush, so I can wait no problem for it to stabilize, if that's the case
<kenshinCH>
sure, thanks! But let me try those other machines first. They should all be 19.09, one freshly installed, so now I'm curious
<immae>
I think home-manager is quite stable, but it is very dependent on having a correctly initialized nix configuration
<immae>
In particular (I think) this /nix/var/nix/profiles/per-user/ folder
<kenshinCH>
oh I'm sure it's stable wrt the usual `home-manager` executable. I was wondering about the module, because I saw a few tickets on it
<kenshinCH>
and it's not mentioned in the README.md on github
<immae>
In all cases it’s important that you use the same home-manager branch as your system
<immae>
(Maybe I should have started there)
<kenshinCH>
I am :)
<immae>
ok
hmpffff has quit [Quit: nchrrrr…]
<kenshinCH>
anyway, thank you for going through this. I'll pop back in if I can't solve anything :)
<kenshinCH>
actually, another question.
<kenshinCH>
Suppose you have all this in a repo somewhere
<kenshinCH>
what is the best practice to include it in `configuration.nix`?
<immae>
So you have your home configuration, and you want to load it in configuration.nix?
<kenshinCH>
clone it... where? In your home? in /etc?
<kenshinCH>
yes, that's what I meant by module. Is that not the right term?
<immae>
Right, I would clone it in /home/my_user/home-manager and then in /etc/nix/configuration I would load /home/my_user/home-manager, but I don’t use it as a module so I don’t know how feasible / dangerous it is
<kenshinCH>
makes sense. Thanks :)
<immae>
(in particular, if it is possible to have distinct home configuration per user)
<immae>
Other people may be of better adivce than me there
<kenshinCH>
can I ask why you are still on 19.03? I thought most people were actually on unstable :)
<immae>
Because it ’s a huge machine and I’m lazy
<immae>
(it’s single user though so I’m only theoretically concerned with this issue)
<kenshinCH>
perfectly good reason
<__monty__>
For NixOS I'm pretty sure latest is far more popular than unstable.
<immae>
And I made a bad choice the first time I installed nix (It was still brand new to me), that I’m paying now until I switch to unstable and break every program on my machine :p
<kenshinCH>
ok now I created manually that directory and the GC root, then deleted everything in those two, and now seems to work
<immae>
Oh, so you have feh in your path?
<immae>
__monty__: well, having a huge gap when you switch version is a little hard for me
<immae>
(that’s why I had a rolling release before, I prefer small breaking at each step rather than everything breaking at once)
<__monty__>
Not a value judgement about tracking master. I just don't agree with the assessment that most people are tracking unstable.