<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?
<{^_^}>
#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 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
<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
<__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>
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` ?
<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
<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`?
<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 :(
<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