rycee changed the topic of #home-manager to: Support and discussion around the Home Manager project (https://github.com/rycee/home-manager) | Logs: https://logs.nix.samueldr.com/home-manager
<hpfr[m]> does anyone use `useGlobalPkgs` on github referencing a system `config.` option within their `home-manager` NixOS module? I'm still stymied by this unfortunately
klntsky has quit [Ping timeout: 240 seconds]
klntsky has joined #home-manager
<energizer> hpfr[m]: you're asking how to get the nixos config from within hm?
Emantor has quit [Quit: ZNC - http://znc.in]
<hpfr[m]> energizer: yes I think so, I want to define hm options conditionally on the NixOS option `config.services.xserver.dpi`
Emantor has joined #home-manager
<colemickens> I don't do it for useGlobalPkgs but I do reference config. for something else
<energizer> hpfr[m]: rycee knows the answer to that, i can't remember it though
<energizer> it would probably be could to start an faq somewhere
<hpfr[m]> that's encouraging. I also asked here https://github.com/rycee/home-manager/issues/616\
<{^_^}> #616 (by arcnmx, 1 year ago, open): nixos module imports separate <nixpkgs>
<hpfr[m]> <energizer "it would probably be could to st"> there is a github wiki, but it could probably just go in the manual somewhere
<hpfr[m]> @colemickens:matrix.org: you switched cause and effect, I thought useGlobalPkgs would allow me to reference config. do you have a link to the relevant portion of your config?
<colemickens> I'm adding packages to home.packages conditionally based on (config.system == "x86_64-linux") whihc seems like it should be the same case?
<hpfr[m]> I got some info in the github issue, but it wasn't really the solution I was looking for
<colemickens> (HM is a nixos module, and I do useGlobalPkgs)
<colemickens> I haven't cleaned up my latest rearrangements, let me find it on master or push to a branch.
<colemickens> I'm worried I'm misunderstanding, btu this is it: https://github.com/colemickens/nixcfg/blob/master/home/users/cole/gui.nix#L169
<colemickens> I just piped `config` over with `pkgs` down from configuration.nix to where I actually configure hm, etc
<colemickens> (I do feel like maybe I'm missing something though?)
<hpfr[m]> <colemickens "I just piped `config` over with "> where's this? I think this is what I do but it doesn't work
<hpfr[m]> also, as far as I can tell the NixOS option `config.system` is an attribute set, so maybe the one you're referring to is something else? I couldn't find something like that
<colemickens> I changed it to "config.services.upower.enable" and it still evaluates... ?
<colemickens> does that help?
<colemickens> (as in, s/config.system == "x86_64-linux"/config.services.upower.enable/g)
<hpfr[m]> Well that’s weird but I’ll take a closer look thanks
romanofski has quit [Quit: ZNC 1.7.4 - https://znc.in]
romanofski has joined #home-manager
malSet has quit [Read error: Connection reset by peer]
malSet has joined #home-manager
quinn has quit [Quit: ZNC 1.7.5 - https://znc.in]
quinn has joined #home-manager
<DamienCassou> hi
<DamienCassou> what does home-manager do better with services compared to nixos? Why should I enable a home-manager service compared to the same user service in nixos?
<energizer> that's an awkward situation. ideally both would be pulling from a shared repo of services
quinn has quit [Quit: ZNC 1.7.5 - https://znc.in]
__monty__ has joined #home-manager
MmeQuignon has joined #home-manager
asymptotically has joined #home-manager
greizgh has quit [Quit: greizgh]
greizgh has joined #home-manager
<DamienCassou> energizer: is home-manager doing anything special with the services?
<DamienCassou> is home-manager enabling/reloading the services?
<eyJhb> Depends what you mean
__monty__ has quit [Ping timeout: 256 seconds]
__monty__ has joined #home-manager
__monty__ has quit [Ping timeout: 246 seconds]
__monty__ has joined #home-manager
romanofski has quit [Quit: ZNC 1.7.4 - https://znc.in]
romanofski has joined #home-manager
<eyJhb> Jesus, error swithing. no usefull error
<hpfr[m]> Damien Cassou: what kinds of *user* services do nixos modules handle? I was not aware they did this
<__monty__> Do they? I thought only HM systemd stuff was `systemctl --user`?
<hpfr[m]> that's what I thought as well. I don't think nixos modules handle user services
<hpfr[m]> I searched nixos options under `users.users.<name?>.` and there's nothing related to services
<hpfr[m]> the option `nixpkgs.overlays` doesn't seem to work, I get `error: The option 'home-manager.users.lh.nixpkgs' does not exist.`
<hpfr[m]> never mind, useGlobalPkgs disables that
<eyJhb> Also, can I run a command after my windowmanager command?
<eyJhb> __monty__: any good ideas? Need to contact i3 after it has started
<__monty__> I'm not sure. Don't think an activation block will help cause that runs at activation, not every WM start.
<eyJhb> Unsure if I should pull out my wm form home-manager
<eyJhb> (window-manager)
<eyJhb> Then I can do more stuff
<__monty__> Well, nixos wouldn't have a better way afaik?
<eyJhb> The problem is, I have placed my autorandr files in global (/etc/xdg/autorandr). WHich works, etc.
<eyJhb> But now I want to run a command on start, that detects what profile is running and then running some i3-msg commands based on that
<eyJhb> Which I can see how. BUT!
<eyJhb> And on line 156 i3 is actually started
<eyJhb> rycee: maybe we need a initAfter :p
<eyJhb> Nope __monty__, NixOS is no better I guess
<eyJhb> Well, that is sowewhat hard still...
<__monty__> I don't think the WM command returns untill you stop i3?
<__monty__> Maybe there's a systemd target you can have a service wait for?
<eyJhb> __monty__: that might also be possible! But that is also what I got at
<eyJhb> The until I stop it
<eyJhb> But what can I target? systemctl --user start hm-graphical-session.target ?
<rycee> eyJhb: I don't think an `initAfter` would be very useful? Possibly if you want to do actions when the session is terminating. But then I would suggest using a systemd service instead.
quinn has joined #home-manager
<eyJhb> rycee: It was more meant as a `thing` that can run commands after the wm has started, not specifically in the file
<eyJhb> Currently I am writing a systemd service which uses the hm-graphical target, and the wathich for i3 having started
<eyJhb> But would be nice with that build-in
<rycee> eyJhb: You'll want `After = [ "graphical-session-pre.target" ];` and `PartOf = [ "graphical-session.target" ];`
<eyJhb> Now, I may be asking like a idiot. But why?
<eyJhb> systemd is still magic rycee , sorry
<rycee> We can't reliably do this in HM since we are mainly aiming for compatibility with NixOS, which has a bit broken user dbus.
<eyJhb> But more the targets and partof? - I still need to have a for loop for checking after i3 start. right?
<rycee> I don't remember why but it's described in some presentation that some RedHat or Fedora person did.
<rycee> Yes, you need that.
<rycee> You can use a `until pidof …; do sleep 0.5; done` or something.
__monty__ has quit [Quit: leaving]
<eyJhb> Is there a good way to extract the path for a executable rycee ? e.g. `/nix/store/xn86zvadm6x225afhnr347hh3zcvr8ia-i3-4.18.1/bin/i3bar --bar_id=bar-default --socket=/run/user/1000/i3/ipc-socket.1952` ?
<eyJhb> Ended up with this - https://pastebin.com/raw/8CbkfYMp
<rycee> Hmm, you mean to extract `/nix/store/xn86zvadm6x225afhnr347hh3zcvr8ia-i3-4.18.1/bin` from `/nix/store/xn86zvadm6x225afhnr347hh3zcvr8ia-i3-4.18.1/bin/i3bar`?
<eyJhb> Basically remove the args
<eyJhb> But while I am saying this, I realise I can just split on " "
<energizer> rycee: how to refer to the nixos config from within hm config?
<rycee> I guess the easiest would be someting like `${cmd%% *}`.
<rycee> energizer: If it's a standalone installation you'll need to evaluate the nixos configuration into a variable. If it's using the nixos module then just wire in the system level `config` variable into your HM configuration.
<energizer> rycee: wire it in?
<eyJhb> rycee: It does not seem like it starts the service
<eyJhb> Any ideas?
<rycee> energizer: Well, just to refer the the system level configuration through the system level `config` argument. If you also want to use the HM `config` argument you can bind the system config to some other name first.
<rycee> eyJhb: Perhaps `home.keyboard` is set to `null`?
<eyJhb> Wait. wrong thing I pasted
<eyJhb> Sorri
<energizer> rycee: i don't think i know how to do that
<eyJhb> Sorry*
<rycee> eyJhb: You'll need `Install = { WantedBy = [ "graphical-session.target" ]; };` as well.
<rycee> energizer: Which? Are you using the standalone or nixos install method?
<energizer> rycee: nixos
<rycee> energizer: In you nixos config add `let nixosConfig = config; in` just after the function argument, which must include the `config` attribute.
<rycee> Then, if you keep the HM config in the same file you should be able to do something like `home.file.test.text= nixosConfig.networking.hostName;`
<energizer> i see
<rycee> energizer: And if you keep your config in a different file I guess you could do something like `home-manager.users. youruser = { imports = [ ./path/to/your/hm/config.nix ]; _module.args.nixosConfig = config; }`
<energizer> rycee: ooo nice
<energizer> thanks
<rycee> And just add `nixosConfig` as an attribute in your HM modules.
cole-h has quit [Quit: Goodbye]
cole-h has joined #home-manager
<eyJhb> Well rycee, I just get a black screen with this :(
<eyJhb> Current version https://pastebin.com/sBpLQh3r
<eyJhb> Hope you can help, or someone can
asymptotically has quit [Quit: Leaving]
<rycee> eyJhb: I think you'll want simple instead of oneshot. The latter will block until the script has completed.
<rycee> I'll head to bed. Best of luck :-)
<eyJhb> rycee: Will try, thanks!
<hpfr[m]> rycee: I replied to the github issue asking about the different file nixosConfig situation. with `home-manager.users.youruser = { imports = [ ./path/to/your/hm/config.nix ]; _module.args.nixosConfig = config; }`, that seems to have all the home manager config in a different file.
<hpfr[m]> I do something like this, where my config is in the same file but does imports from other files: `home-manager.users.youruser = { config, pkgs, lib, ... }: { imports = [ ./path/to/my/hm/module.nix ]; regular.home-manager.options.here = value; };`
<hpfr[m]> In this case, I can use the let expression for the local config, but how can I give the imports nixosConfig? your multi-file example seems to have youruser as an attrset but mine is a function, and placing `_module.args.nixosConfig = config;` in the body of the function doesn't work
<hpfr[m]> never mind, placing that in the body of the function does work, I just forgot to add the `nixosConfig` argument to the modules