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
mexisme has joined #home-manager
pi3r has joined #home-manager
<pi3r> Would someone know why string context is not working here ? https://gist.github.com/PierreR/bbc4a6003aa8257cc22c30df016b9162#file-doc-nix-L14
<pi3r> So how can I possibly prevent the hardcoding of the user home ?
pi3r has quit [Quit: Leaving]
mexisme has quit [Ping timeout: 268 seconds]
evelyn has quit [Quit: WeeChat 1.6]
mexisme has joined #home-manager
andi- has quit [Remote host closed the connection]
greizgh has quit [Quit: greizgh]
greizgh has joined #home-manager
andi- has joined #home-manager
maralorn has quit [Quit: WeeChat 2.6]
maralorn has joined #home-manager
mexisme has quit [Ping timeout: 240 seconds]
mexisme has joined #home-manager
mexisme has quit [Ping timeout: 240 seconds]
mexisme has joined #home-manager
mexisme has quit [Ping timeout: 276 seconds]
hmpffff has joined #home-manager
pi3r has joined #home-manager
__monty__ has joined #home-manager
mexisme has joined #home-manager
mexisme has quit [Quit: WeeChat 2.6]
<pi3r> FWIW this problem is not related to the home-manager at all ... Just the crazy way paths are handled in nix ... Basically I need ./ the root path literal
<pi3r> Coupled with the fact that toPath does not return a path this has been quite a confusing journey ;-)
<rycee> pi3r: Hey. Ah yeah.
<rycee> The builtins.path command sometimes is helpful.
<pi3r> rycee: Thanks for the tip. Any idea about https://github.com/rycee/home-manager/issues/890 ? ;-)
<{^_^}> #890 (by PierreR, 1 day ago, open): Q? : Eclipse with egit & m2e included
<rycee> Unfortuntely no. When I used Eclipse I installed m2e through Eclipse.
<rycee> It seemed tricky to package m2e and a few other plugins so I gave up on those.
<rycee> So I always installed m2e and the marketplace plugins + some from the marketplace manually.
<pi3r> Good to know thanks. I do the same with the eclipse cli but that's not better.
<rycee> Unfortunately the plugin package situation for Eclipse is tricky. I never figured out the best way to do it for more complicated plugins.
<rycee> Now I just use Emacs with lsp-java :-)
evelyn_ has joined #home-manager
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #home-manager
hmpffff has quit [Client Quit]
hmpffff has joined #home-manager
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #home-manager
hmpffff has quit [Client Quit]
pi3r has quit [Quit: Leaving]
hmpffff has joined #home-manager
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #home-manager
hmpffff has quit [Client Quit]
hmpffff has joined #home-manager
hmpffff has quit [Quit: nchrrrr…]
Synthetica has joined #home-manager
thomashoneyman has joined #home-manager
<thomashoneyman> hey folks! i'm using `jrnl` and i'd like to control an arbitrary file in my home directory with home-manager
<thomashoneyman> i was looking at the home-manager documentation but I didn't see anything specific to this
<thomashoneyman> any advice on where to look to do this?
<thomashoneyman> the idea would be to write a .jrnl_config file with json, making the file read-only and only written by home-manager
<__monty__> there's a files attribute or something. Search appendix A.
<thomashoneyman> oh, perfect, under home.file you can control a list of files in the home directory
<thomashoneyman> including home.file.<name?>.target for the path and home.file.<name?>.text for the contents
<thomashoneyman> thanks!
<rycee> thomashoneyman: You can use the `home.file` option but it will create a symlink. If you require a real file then you'll have to do that using a custom activation block.
<rycee> thomashoneyman: You can omit the target option if you set `name` to the path.
<thomashoneyman> as in i can have a file in ~/Documents/something.txt and have home-manager symlink it to ~/.something.txt?
<thomashoneyman> what i'd like to do is have home-manager _write_ the file
<thomashoneyman> i'm not sure what custom activation blocks are; i'll look that up
<thomashoneyman> rycee: mind explaining briefly what 'custom activation block' refers to?
<__monty__> They're a way to run arbitrary shell commands basically.
<__monty__> home.activation.<name> = config.lib.dag.entryAfter [ "writeBoundary" ] "<shell commands>";
<__monty__> There's different boundaries that determine when the commands are run.
<__monty__> Make sure the commands are idempotent though. I've managed to nest symlinks this way and it can get confusing : )
<rycee> The home.file option always copies the file to the Nix store. So if you want to avoid that you need an activation block like monty showed.
thomashoneyman has quit [Ping timeout: 240 seconds]
<rycee> Hehe, yeah I recognize that :-)
thomashoneyman has joined #home-manager
<thomashoneyman> i see; i'd want to write the file in the activation block, and perhaps symlink with home.file after?
<thomashoneyman> to restate the original goal: i'd like home-manager to entirely control a file, ~/.jrnl_config, meaning that `home-manager switch` writes the file and it is read-only after that
<thomashoneyman> i'll go ahead and try with the custom activation block alone
<thomashoneyman> but i am perfectly happy for the file to simply get written into the nix store and not exist anywhere else
<rycee> Yeah, if at all possible it is best to use `home.file`, e.g, `home.file.".jrnl_config".text = "foo";`.
<rycee> Phew, tricky to write code on the phone keyboard :-)
<thomashoneyman> oh, i misunderstood what you meant by the symlink
<thomashoneyman> i thought you were saying that home.file relied on there already being a real file
<thomashoneyman> thanks for attempting to write code from your phone -- i know it's tough!
<rycee> Ah, no. I meant that the target will be a symlink into the Nix store.
<rycee> I'm drinking beer as well so I'm doubly handicapped :-D
<__monty__> Past the Balmer peak?
<thomashoneyman> it's noon where i live, so i too am drinking a beer
<thomashoneyman> but i'm also eating Mexican food, so I feel like it's acceptable
<rycee> monty: Something like that :-)
<thomashoneyman> sweet! working just fine.
<thomashoneyman> thanks for the help. now to attempt to get dropdox working as a systemd service via home-manager...
<__monty__> 👍
<__monty__> Not too hard. Especially if you already have a service file to translate.
<__monty__> Do note though that the service would run under `systemctl --user`.
<__monty__> So you have to pass that flag whenever you want to control it.
<thomashoneyman> for now i'm researching systemd, as i've been a MacOS user my whole life up until installing NixOS this summer
<__monty__> It's actually kinda similar to launchctl. Might've been inspired by even iirc.
<thomashoneyman> there are some home-manager modules which manage systemd services, right?
<thomashoneyman> i'm browsing through for a good, similar example to dropbox
<thomashoneyman> monty: never used launchctl!
<thomashoneyman> i work as a UI developer using PureScript, so a lot of this stuff is new
<__monty__> Launchctl's the worst you have to write everything in this poorly documented xml.
<__monty__> Not that systemd's so much better documented : >
<thomashoneyman> i know enough to consider writing xml hellish
<__monty__> PS, nice!
<thomashoneyman> (most of the time)
<thomashoneyman> i'd also like to write some kind of service which checks for updates to my dotfiles and automatically pushes changes to github
<thomashoneyman> maybe that's just a cron thing
<__monty__> Systemd replaces cron. Look into systemd timers.
<__monty__> That's actually a serious improvement imo.
<thomashoneyman> ah! excellent. thanks for the pointers.
<thomashoneyman> i'm just googling around for systemd, but if you know of any particularly helpful resources i'd love links
<__monty__> freedesktop.org
<__monty__> Basically the manpages online.
<thomashoneyman> ^ that link actually has a service description, but there is no timer. am i to understand that this will only sync on systemd startup?
<thomashoneyman> there's only ExecStart
<thomashoneyman> i'm putting together a service in home.nix which i can upstream
<__monty__> It depends on the before, after, wantedby, etc. clauses.
<__monty__> But probably just once, yeah.
<__monty__> A timer is just another unit btw. https://www.freedesktop.org/software/systemd/man/systemd.timer.html
<thomashoneyman> Should I be worried about seeing this message after 'home-manager switch': "User systemd daemon not running. Skipping reload."
<thomashoneyman> thanks for the timer link. on review it looks like Dropbox might handle triggering sync on its own
<rycee> thomashoneyman: Home Manager is a bit dumb about reloading the systemd units. If some user systemd using has failed then HM fails to notice it running.
<rycee> Basically if `systemctl --user status` says a state different from "running".
<thomashoneyman> hmm
<thomashoneyman> `systemctl --user status` is running
<thomashoneyman> *displays 'running', that is
<rycee> thomashoneyman: Hmm, and `systemctl --user is-system-running`
<thomashoneyman> i have in .config/systemd/ the file dropbox.service, yet 'systemctl start dropbox.service' returns a 'service not found'
<thomashoneyman> yep, `systeemctl --user is-system-running` returns 'running'
<rycee> thomashoneyman: The service file goes in `.config/systemd/user/`.
<thomashoneyman> whoops, typo
<thomashoneyman> it is in `~/.config/systemd/user/dropbox.service`
<thomashoneyman> along with some other services which *are* running, like polybar
<thomashoneyman> although maybe that's a red herring, as i start polybar via i3
<rycee> Hmm, interesting. Could you try `XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} systemctl --user is-system-running`?
<rycee> You have to run `systemctl --user daemon-reload` for it to notice the new file. Perhaps you missed doing that?
<thomashoneyman> i did not run that
<thomashoneyman> i wasn't sure if i needed to run anything other than home-manager switch
<rycee> HM will only auto start services it manages itself.
<thomashoneyman> wouldn't this one count?
<thomashoneyman> maybe i'm misunderstanding
<thomashoneyman> this is written into home.nix
<rycee> Through the `systemd.user.services` option.
<thomashoneyman> yes
<thomashoneyman> ^ that file is the output
<thomashoneyman> (of running home-manager switch)
<rycee> thomashoneyman: Ah, you have to tell the service when to start as well. Like this: https://github.com/rycee/home-manager/blob/149c0593abac5879631f63e55ef5b68277020b66/modules/services/keybase.nix#L32-L34
<thomashoneyman> oh! ok, thanks
<thomashoneyman> added that in and it's in the file
<thomashoneyman> i still get the 'User systemd daemon not running' after home-manager switch
<thomashoneyman> and i don't see dropbox in the services with `systemctl`
<thomashoneyman> hmmm
<rycee> Is it shown when you run `systemctl --user list-unit-files`/
<thomashoneyman> i can manually run the executable
<thomashoneyman> one sec
<rycee> * Is it shown when you run `systemctl --user list-unit-files`?
<thomashoneyman> yes, it is listed
<thomashoneyman> with state 'enabled'
<rycee> Then you probably should be able to start it with `systemctl --user start dropbox.service`
<thomashoneyman> yes, that worked
<thomashoneyman> hmmm
hmpffff has joined #home-manager
<thomashoneyman> thanks, rycee, it's running
<thomashoneyman> though it's a bit worrying to run that command manually
<thomashoneyman> vs. it automatically starting up, but i might be missing something
<thomashoneyman> ouch: need to get a newer version for it to function, too.
<thomashoneyman> off to the rabbit hole
<rycee> Oh and you need to set `systemd.user.startServices = true;` to make HM start and stop services.
<rycee> Otherwise it will just write suggested systemctl commands to run.
<rycee> But the "User systemd daemon not running. Skipping reload." means that the `XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} systemctl --user is-system-running` command returns with an error when HM tries to run it.
<thomashoneyman> strange. running that command manually returns 'running'
<rycee> Yeah, it seems a bit odd. Are you using the `home-manager switch` or managing your user from the system configuration?
<thomashoneyman> i'm using 'home-manager switch' on the command line
<thomashoneyman> hmm
<thomashoneyman> i've got 'programs.home-manager.enable = true' set
<thomashoneyman> my user account is defined in configuration.nix
<rycee> thomashoneyman: Yeah, but you aren't using the `home-manager.users` option in the system configuration.
<thomashoneyman> no, i am not
<thomashoneyman> i don't think i saw that in the readme / manual
<thomashoneyman> looking for it now
<rycee> thomashoneyman: Could you try logging out and logging back in? To see if that fixes the `home-manager switch` error message.
<rycee> The NixOS module is documented a bit in https://rycee.gitlab.io/home-manager/index.html#sec-install-nixos-module.
thomashoneyman has quit [Quit: Lost terminal]
thomashoneyman has joined #home-manager
<thomashoneyman> nope: logging out and logging in still says 'user systemd daemon not running'
<dtz> if something fails like a random user service (perhaps a sync/timer-based service that handle failure or net issues gracefully aka as a success) then 'systemctl status --user' will report 'degraded' and home-manager checks that before trying to switch
<rycee> dtz: The curious thing is that his systemd says "running", not degraded and `systemctl --user is-system-running` also reports running.
<rycee> But for some reason when HM runs the same command it must be getting an error.
<dtz> D: oh sorry if missed some context. That IS strange.
<rycee> And apparently a relog didn't fix it.
<rycee> Hmm, perhaps the systemd started by PAM is not compatible with the systemctl command that ends up being used in the activation script?
<rycee> thomashoneyman: Perhaps could try adding something like this to your `home.nix`:
<thomashoneyman> "failed to query system state: Access denied"
<thomashoneyman> voila
<rycee> Hohoo. That looks fun.
<thomashoneyman> i'm not sure what to do about that
<thomashoneyman> running the command as my user it works fine; it's the only user i've got set up
<thomashoneyman> like when i'm asked to authenticate as a user, it's always either `root` or my user account
<rycee> Yeah, and everything run through `home-manager switch` should happen using the running user.
<rycee> thomashoneyman: Could you run `grep systemctl /nix/var/nix/profiles/per-user/$USER/home-manager/activate`?
<rycee> And compare the systemd version with the one you get from `systemctl --version`.
<thomashoneyman> different versions
<thomashoneyman> the former: systemd-243; the latter: systemd-239
<rycee> Have you recently switched from NixOS 19.03 to 19.09?
<thomashoneyman> you know what, I did switch to https://nixos.org/channels/nixos-unstable a little while ago
<thomashoneyman> i can't quite remember why i felt it was necessary to do so
<thomashoneyman> i can try switching to 19.03 or 19.09 though
<rycee> I imagine that the Nixpkgs that HM sees still is 19.03.
<rycee> 19.09 is the current stable version.
<rycee> But I guess nixpkgs-unstable also is on systemd 243.
<thomashoneyman> 2 │ https://nixos.org/channels/nixos-unstable nixpkgs
<thomashoneyman> those are the two lines in my .nix-channels
<thomashoneyman> i'm not sure how otherwise to control what channel HM might see
<rycee> HM should pick up the nixpkgs channel
<thomashoneyman> perhaps i haven't properly switched?
<rycee> What does `ls ~/.nix-defexpr/*` say when you run it as your regular user?
<thomashoneyman> interesting
<rycee> Or better: `ls -l /home/rycee/.nix-defexpr/*/`
<thomashoneyman> hmm
<thomashoneyman> i'm not sure how to multiline paste in irc
<thomashoneyman> one sec
<__monty__> thomashoneyman: You don't : ) Use a pastebin.
<__monty__> ,paste
<{^_^}> Use a website such as [ https://gist.github.com/ http://ix.io/ https://hastebin.com/ http://sprunge.us/ https://paste.ee/ ] or similar services to share anything that's longer than a couple lines.
<thomashoneyman> well then
<thomashoneyman> still 19.03, it seems
<thomashoneyman> weird, because i've updated `.nix-channels` to unstable and run `nix-channel --update`
<rycee> Generally I would recommend managing all channels through the root user.
<thomashoneyman> I'm not sure how to do that, but I'm happy to do so
<thomashoneyman> I've had a lot of trouble trying to figure out what the 'right thing' to do in NixOS is
<rycee> Yeah, channels are a bit tricky, hopefully they'll be replaced soonish.
<__monty__> thomashoneyman: For future reference. pastebin.com is almost the one pastebin nobody likes, because of the ad cancer.
<thomashoneyman> good lord almighty
<thomashoneyman> i'm happy to switch, though `pastebinit` is a great utility
<rycee> thomashoneyman: In any case, I would suggest removing doing `nix-channel --remove` on all user channels.
<thomashoneyman> rycee: i'm looking around for how to manage nix-channels as root
<thomashoneyman> does it just come down to running the command as root or something?
<__monty__> Yeah.
<thomashoneyman> oh
<thomashoneyman> well, that's no problem
<__monty__> Keep in mind nix-env won't work if you remove all the user channels.
<rycee> Then if you want to use NixOS unstable you can run `nix-channel --add https://nixos.org/channels/nixos-unstable` as a user.
<__monty__> It's not recommended anyway, but something that's good to know.
<thomashoneyman> i don't use nix-env, fortunately
<thomashoneyman> i see; under root, i see:
<rycee> If you are running NixOS then nixos-unstable is better than nixpkgs-unstable since I believe it make sure some critical system tests pass before the channel is updated.
<rycee> Ah, maybe it has to be `nix-channel --add https://nixos.org/channels/nixos-unstable nixos` to override the old entry.
<thomashoneyman> i'll try 19.09 first; i don't really need to be on unstable, i don't think
<rycee> Yup.
<rycee> Then also run `nix-channel --add https://github.com/rycee/home-manager/archive/release-19.09.tar.gz home-manager` as root
<thomashoneyman> currently dowrloading a ton of stuff
<thomashoneyman> but i'll let you know if it works
<thomashoneyman> rycee: __monty__: thanks for all your help, by the way
<thomashoneyman> i'm sorry to be requiring so much of it!
<rycee> Yeah, I imagine you are still actually running 19.03 on your system…
<rycee> And are now updating to 19.09.
<__monty__> Np, but rycee's definitely doing the heavy lifting ; )
<rycee> No worries. It was a interesting problem you run into :-)
<thomashoneyman> still building...
<thomashoneyman> hah! no way!
<thomashoneyman> "Failed to query system state: Access denied"
<thomashoneyman> typical software bug
<thomashoneyman> *issue
<thomashoneyman> never where you think
<thomashoneyman> interesting
<thomashoneyman> still 19.03 in channels
<thomashoneyman> maybe i need to manually delete them?
<rycee> PID 1 is probably still having systemd 239
<thomashoneyman> i did --remove and .nix-channels for my user is blank, but i still have a /channels directory containing 19.03
<thomashoneyman> one sec, i'll log out and log in again
thomashoneyman has quit [Quit: Lost terminal]
<rycee> Did you do a `nixos-rebuild switch`?
<__monty__> They're not here rn.
thomasho1eyman has joined #home-manager
<thomasho1eyman> lol i suppose i'm thomasho1eyman according to irssi now
<__monty__> thomasho1eyman: PID 1 won't get replaced unless you reboot.
<__monty__> Oh, and rycee asked whether you `nixos-rebuild switch`ed while you were gone.
<__monty__> nn, peoples
__monty__ has quit [Quit: leaving]
<rycee> See ya __monty__ :-)
<rycee> thomasho1eyman: Yeah, if you now updated the system from 19.03 to 19.09 then you'll need to reboot as well to replace systemd running as PID 1.
<rycee> thomasho1eyman: Have a look at the release notes https://nixos.org/nixos/manual/release-notes.html#sec-release-19.09
thomasho1eyman has quit [Ping timeout: 240 seconds]
<rycee> To make sure you don't have to perform any special step.
mexisme has joined #home-manager
thomashoneyman has joined #home-manager
<thomashoneyman> well, i've returned, with news
<thomashoneyman> updating to 19.09 seems to have done something funky with my network connection
<thomashoneyman> i'm only now managing to stay connected long enough to even send these messages
thomashoneyman has quit [Remote host closed the connection]
thomashoneyman has joined #home-manager
<thomashoneyman> ok! with all this taken care of it's finally able to connect
<thomashoneyman> no more 'access denied'
mexisme has quit [Ping timeout: 246 seconds]
<rycee> Oh, pity about the networking but I'm glad the systemd issue was resolved.
<rycee> I have to go to bed but I'm sure somebody in #nixos could assist with the networking.
<thomashoneyman> no worriees!
<rycee> Good luck! :-)
<thomashoneyman> i seem to be connected now, so maybe it was a temporary issue
<rycee> Yeah, hopefully!
<thomashoneyman> seems like systemd did some renaming of network devices
<thomashoneyman> htanks again for all your help, good night!
<rycee> Ah, yeah that might very well be. I have some recollection of reading something about it changing the naming algorithm.
<rycee> See ya
hmpffff has quit [Quit: nchrrrr…]
thomashoneyman has quit [Ping timeout: 240 seconds]
mexisme has joined #home-manager
mexisme has quit [Ping timeout: 265 seconds]