<matthewcroughan[>
Indeed, a restart does not change this.
<matthewcroughan[>
I rebooted, logged in via tty, then executed `sway`
<matthewcroughan[>
no vars are set.
<matthewcroughan[>
I mean, this is expected, right? How is this unexpected?
<matthewcroughan[>
home.sessionVariables is not set.
<matthewcroughan[>
Launching `sway` via tty doesn't launch SystemD.
<piegames1>
matthewcroughan[: Wait, you don't have a systemd session for sway? o.O
<matthewcroughan[>
Whatdya mean?
<matthewcroughan[>
gdm is the session manager
<matthewcroughan[>
if I launch sway like `sway`, by typing it in a tty, then yeah, no systemd.
<matthewcroughan[>
gdm uses systemd to launch user sessions, which is I guess why `systemd.user.sessionVariables` is needed.
<piegames1>
The other thing that's weird to me is that I *know* my GDM sources `/etc/profile.d/hm-session-vars.sh`, so it *should* be working.
<piegames1>
So for me on Arch Linux, I added `source /nix/var/nix/profiles/default/etc/profile.d/hm-session-vars.sh` into my `/etc/profile.d` and this works. The source graph is like [GDM ??] -> `/etc/profile` -> `/etc/profile.d/nix.sh` -> `/nix/var/nix/profiles/default/etc/profile.d/hm-session-vars.sh`
<rogerr>
why doesn't `home.sessionPath = ["~/.local/share/foo/"];` work (echo $PATH doesn't show it in list) when i rdp into the system but it does when i ssh in? my rdp startwm.sh https://termbin.com/i1gq and .xprofile https://termbin.com/mcxp how can i debug this pls? i so desperate
<simpson>
But not desparate enough to just hardcode it into your two hardcoded startup scripts?
<rogerr>
no because i wanna know why home manager isn't working
<simpson>
But if that file exists, then it's not home-manager that has the problem.
cole-h has joined #home-manager
<rogerr>
how can i debug that?
<rogerr>
in the startwm.sh and .xprofile does it look like it should work?
<simpson>
TBH no, this isn't the sort of setup I endorse.
<rogerr>
simpson what stands out that's wrong?
<simpson>
rogerr: It seems like this is a headful machine which you're configuring to run in a headless mode? Or do you want the GPU engaged?
<simpson>
The HM_XPROFILE_SOURCED variable is a little curious. It seems like the goal is to facilitate code reuse, but without respect to the system shell's desires, particularly /etc/profile.
<rogerr>
it's a vm that i rdp (sometimes ssh) into that has no display manager, just i3 in the home manager config
<rogerr>
real basic
<rogerr>
what i wanna do is add a dir to my path that has the binaries in it added to path for auto completion n stuff
<rogerr>
that dir is showing up in env when i ssh in but not rdp
<rogerr>
on another OS i had to do something extra to fix this exact thing so i think the problem is in how xrdp works AND how package managers miss it
<rogerr>
iirc the problem was rdp in didn't source the full user context
<simpson>
I'm sure that we could use improvements to our RDP support.
<rogerr>
maybe i can test if startwm.sh sets something, then if the xprofile sets another thing to make sure both are running?
<rogerr>
like maybe xprofile isn't being run or smth?
<rogerr>
well i'll test anything and everything to get this upgraded then tell you what did it
<simpson>
Good luck.
<rogerr>
no can help me? :(
<simpson>
You're doing everything right, according to documentation; the functionality mostly works, except for one particular case; you've worked with this case before and know that it is unreliable.
<rogerr>
ya is aroslavas Pocepko on irc? seems like the maintainer for the pkg
<rogerr>
lemme find fix for other OS
<rogerr>
ok
<rogerr>
exec env -U "$USER" i3 on freebsd startwm.sh
<rogerr>
had to do that instead of just exec i3 because otherwise it didn't have all my env
<rogerr>
that's what made me think maybe it's not using xprofile
<rogerr>
from the 2 files i linked can you tell which sources hm vars?
<simpson>
No, sorry, I'd have to read bash manual or bash wiki for that, and I don't have the energy.
<rogerr>
is set -x to set an env var in the file like FOO = "bar" to see if it makes it into env?
<simpson>
No, it causes bash to become much more verbose. This might show interesting things in the logs. (I'm assuming that you took rycee's advice and have been looking in the journald/systemd logs for anything interesting.)
<simpson>
`help set` at a bash prompt to learn more, if you don't have the stomach for bash manual either.
<simpson>
(In particular, `set +x` undoes `set -x`, if you type it at the wrong shell~)
<rogerr>
ok ill try that
<rogerr>
btw i rewrite my question with nix first not config files, prolly better
<rogerr>
i want to rdp into my full env. what do i need to add to configuration.nix: services.xrdp.enable=true; home.nix: programs.xsession.scriptPath="startwm.sh"; home.sessionPath=["~/.foo"];? right now i can rdp into i3wm but ~/.foo isn't in $PATH, but it is if i ssh in. (startwm.sh https://termbin.com/i1gq .xprofile https://termbin.com/mcxp)
<rogerr>
how can i set env vars to startsm.sh, .xprofile, hm-session-vars.sh to see what is and isn't being run? what i'm stuck on is how to edit these files to debug when nixos and home manager manage them all and make them RO?
stephank has quit [Quit: stephank]
andi- has quit [Remote host closed the connection]
stephank has joined #home-manager
andi- has joined #home-manager
cole-h has quit [Ping timeout: 246 seconds]
johnw has joined #home-manager
niacdoial has joined #home-manager
woffs has joined #home-manager
niacdoial has quit [Ping timeout: 240 seconds]
<Reventlov>
Hey
<Reventlov>
i'm trying to set up the mode of files deployed by home-manager / home.file.
<Reventlov>
I use the ".mode" attribute, but this is what I get: error: The option `home-manager.users.root.home.file..ssh/id_rsa_remote_build.mode' does not exist. Definition values: […]
<Reventlov>
How to proceed ? Thanks.
<patagonicus>
Reventlov: I'm definitely not an expert, but the Appendix of the manual doesn't list a mode option. Also, I'm pretty confident all files you put in there will end up in /nix/store and thus be world readable anyway.
<Reventlov>
patagonicus: being world readable is not a problem to me.
<Reventlov>
it's a problem to ssh, though.
<Reventlov>
( Permissions 0444 for '/root/.ssh/id_rsa_remote_build' are too open. )
<patagonicus>
I think you can't use home.file then, but you could use home.activation to copy the file (even from the store, if you use pkgs.writeText). Something like home.activation = { remoteBuild = let keyFile = writeText "id_rsa_remote_build" "<key-here>"; in lib.hm.dag.entryAfter ["writeBoundary"] "install -m 400 -t ~/.ssh ${keyFile}"; }; I think. Didn't
<patagonicus>
test that.
<patagonicus>
If you have it lying around as a file you can use ${builtins.toPath ./id_rsa_remote_build} instead of ${keyFile} and drop the let … in I think.
<Reventlov>
yeah, ok
niacdoial has joined #home-manager
niacdoial has quit [Ping timeout: 272 seconds]
niacdoial has joined #home-manager
__monty__ has joined #home-manager
niacdoial has quit [Ping timeout: 260 seconds]
niacdoial has joined #home-manager
niacdoial has quit [Ping timeout: 260 seconds]
niacdoial has joined #home-manager
<rogerr>
i want to rdp into my full env. what do i need to add to configuration.nix: services.xrdp.enable=true; home.nix: programs.xsession.scriptPath="startwm.sh"; home.sessionPath=["~/.foo"]; so ~/.foo is added to $PATH like it is if i ssh in? (startwm.sh https://termbin.com/i1gq .xprofile https://termbin.com/mcxp)
<piegames1>
rogerr: First step is to find out what you need to configure for this in the first place. You may need to learn about the environment bootstrapping your system does, and which files source what.
<rogerr>
piegames1 ya. first off, startwm.sh is definitely run. it says on first line if -z $HM_XPROFILE_SOURCED and if so it sources .xprofile. obviously i need to know if xprofile is sourced. what sets the "-z $HM_XPROFILE_SOURCED"?
<rogerr>
ok i read it, what am i supposed to get from it piegames1?
<rogerr>
i asked what -z $HM_XPROFILE_SOURCED is
<rogerr>
like it's hard to do this if i say something but you just ignore it
<piegames1>
rogerr: The script in `.xprofile` exports `HM_XPROFILE_SOURCED` so it won't get sourced by `.xsession` twice. Not sure if I understand your question correctly.
<piegames1>
`-z HM_XPROFILE_SOURCED` simply checks if `HM_XPROFILE_SOURCED` is *not* set.
niacdoial has quit [Ping timeout: 264 seconds]
<rogerr>
piegames1 im lost, can you help me plsg?
<piegames1>
* replace `.xsession` with `startvm.sh`
<rogerr>
startwm.sh runs, then it sources .xprofile 1 time, so hm vars should be sourced too no?
<piegames1>
Yes. Because the first line in your `.xprofile` is `. /home/me/.nix-profile/etc/profile.d/hm-session-vars.sh`
<rogerr>
right, but it's not
<piegames1>
That file should contain all the environment variables (including PATH) configured by home-manager? If it's not sourced, `$__HM_SESS_VARS_SOURCED` should not exist in your environment. Is that correct?
<rogerr>
https://termbin.com/zjp1 is my hm-session-vars.sh. you can see it has a PATH addition. that addition is in $PATH when i ssh in, but not when i rdp in
<piegames1>
rogerr: What's the value of `__HM_SESS_VARS_SOURCED` when you ssh in and when you rdp in? This is the only correct way to determine if your file got sourced, since the variable is set exactly once whereas `PATH` is modified from a lot of places.
<rogerr>
sec
<rogerr>
it's 1 on both! wtf
<rogerr>
what's that mean piegames1?
<piegames1>
rogerr: Congratulations! Welcome to the magic of environment variables!
<piegames1>
It means that your `PATH` probably somehow gets overwritten by some script that is sourced later on. Or that the software sourcing it `rdp` does custom magic when setting the environment, special casing `PATH`.
<rogerr>
what home manager config should i use to set an env var? i wanna set something totally new to see if that ends up in env
<piegames1>
rogerr: `home.sessionVariables` should add it to your `hm-session-vars.sh`.
<rogerr>
to find something that would overwrite path can i search the whole FS using find for something? like "PATH="?
<rogerr>
ill test
cole-h has joined #home-manager
<rogerr>
piegames1 ok i put a simple FOO="bar" in there. in rdp and ssh it shows
<rogerr>
so all the files are sourcing right
<rogerr>
something specifically with PATH is broken
<rogerr>
is "export PATH="$PATH${PATH:+:}~/foo"" working syntax?
<rogerr>
i mean it works for ssh but *shrug* im outa ideas
<piegames1>
rogerr: The syntax depends on the shell used, but at least for `sh` and `bash` it should be okay.
<piegames1>
I suggest you to create a minimal reproducible example that does not involve home-manager and then look for help upstream (or report a bug to them)
<rogerr>
but im using home manager
<piegames1>
rogerr: You should be able to overwrite home-manager generated files with manual ones by using `home.files` (not sure though).
sorki has joined #home-manager
sorki has quit [Remote host closed the connection]
sorki has joined #home-manager
lukebfox[m] has quit [Quit: Idle for 30+ days]
alexarice[m] has quit [Quit: Idle for 30+ days]
<rogerr>
piegames1 what good would that do? i alraedy isolated the problem that PATH is being corrupted by something no?
<rogerr>
s/i/we
<piegames1>
rogerr: My gut feeling says that this "something" might be `rdp` itself.
<rogerr>
piegames1 why?
<piegames1>
rogerr: Because I had similar fun things with Gnome/GDM.
<piegames1>
rogerr: Okay, one moving part you want to check for errors as well might be your shell. It does a lot of initialization magic too. Try to either disable as much configuration of your shell as possible, or to login into `/bin/sh` as your shell as it's considerably simpler
sorki has quit [Remote host closed the connection]
<matthewcroughan[>
the amount of times I've just *not* imported the correct thing, or just not closed brackets and have had to spend 30 mins figuring out how many `};`'s I'm missing is crazy :D
<matthewcroughan[>
I'd really like it if there was a nix linter that tells me that a `nix` file *is not* included anywhere in a project, similar to how sphinx, the documentation framework will say:
<matthewcroughan[>
If the `.rst` file is not imported in any file.
<matthewcroughan[>
`/home/matthew/git/project/docs/source/index2.rst: WARNING: document isn't included in any toctree``
<matthewcroughan[>
Or maybe I'll just get used to it.
<matthewcroughan[>
* I'd really like it if there was a nix linter that tells me that a `nix` file _is not_ included anywhere in a project, similar to how sphinx, the documentation framework will say:
<matthewcroughan[>
If the `.rst` file is not imported in any file.
<matthewcroughan[>
`/home/matthew/git/project/docs/source/index2.rst: WARNING: document isn't included in any toctree`