[Nix-dev] Problem setting a systemd service using dbus

2016-01-30 Thread Eric Sagnes
Hi,

I am having trouble setting a systemd service for a program that requires dbus.
At first it complained that it couldn't find `dbus-launch`, but adding 
`pkgs.dbus_daemon` to the service `path` fixed that.
But now it is complaining that DBUS_SESSION_BUS_ADDRESS is not set and that X11 
is not initialized (the last line).

```
1月 30 16:34:54 alpha fcitx[14131]: (WARN-14131 
/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/module/dbus/dbusstuff.c:188) 
Without DISPLAY or DBUS_SESSION_BUS_ADDRESS session bus will not work
1月 30 16:34:54 alpha fcitx[14131]: (ERROR-14131 
/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/module/notificationitem/notificationitem.c:187)
 DBus Not initialized
1月 30 16:44:15 alpha fcitx[14131]: (ERROR-14131 
/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/ui/kimpanel/kimpanel.c:317) 
DBus Not initialized
1月 30 16:44:15 alpha fcitx[14131]: (ERROR-14131 
/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/lib/fcitx/ui.c:165) no usable 
user interface.
1月 30 16:44:15 alpha fcitx[14131]: (FATAL-14131 
/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/frontend/xim/xim.c:134) 
X11が初期化されていません
```

Here the unit relevant settings:

```
  path= [ pkgs.dbus_daemon ];
  after   = [ "display-manager.service" ];
  wantedBy= [ "graphical.target" ];
```

The unit is loaded and active but the program is not appearing in the systray 
as it should, probably because it cannot find X11 and dbus.

Does someone knows how to address this problem?

-- 
Eric Sagnes
サニエ エリック
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Problem setting a systemd service using dbus

2016-01-30 Thread Tony
Hi!
Try looking at :
nixos/modules/services/hardware/bluetooth.nix in the nixpkgs repo on github.
You need the type dbus and the org.something bus name in your code.

Hope that helps.

Kind regards,
Tony

 Eric Sagnes wrote 

>Hi,
>
>I am having trouble setting a systemd service for a program that requires dbus.
>At first it complained that it couldn't find `dbus-launch`, but adding 
>`pkgs.dbus_daemon` to the service `path` fixed that.
>But now it is complaining that DBUS_SESSION_BUS_ADDRESS is not set and that 
>X11 is not initialized (the last line).
>
>```
>1月 30 16:34:54 alpha fcitx[14131]: (WARN-14131 
>/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/module/dbus/dbusstuff.c:188) 
>Without DISPLAY or DBUS_SESSION_BUS_ADDRESS session bus will not work
>1月 30 16:34:54 alpha fcitx[14131]: (ERROR-14131 
>/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/module/notificationitem/notificationitem.c:187)
> DBus Not initialized
>1月 30 16:44:15 alpha fcitx[14131]: (ERROR-14131 
>/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/ui/kimpanel/kimpanel.c:317) 
>DBus Not initialized
>1月 30 16:44:15 alpha fcitx[14131]: (ERROR-14131 
>/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/lib/fcitx/ui.c:165) no usable 
>user interface.
>1月 30 16:44:15 alpha fcitx[14131]: (FATAL-14131 
>/tmp/nix-build-fcitx-4.2.9.drv-0/fcitx-4.2.9/src/frontend/xim/xim.c:134) 
>X11が初期化されていません
>```
>
>Here the unit relevant settings:
>
>```
>  path= [ pkgs.dbus_daemon ];
>  after   = [ "display-manager.service" ];
>  wantedBy= [ "graphical.target" ];
>```
>
>The unit is loaded and active but the program is not appearing in the systray 
>as it should, probably because it cannot find X11 and dbus.
>
>Does someone knows how to address this problem?
>
>-- 
>Eric Sagnes
>サニエ エリック
>___
>nix-dev mailing list
>nix-dev@lists.science.uu.nl
>http://lists.science.uu.nl/mailman/listinfo/nix-dev
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] environment in systemd services

2016-01-30 Thread Arnold Krille
Nope, the aws credentials are in the url given in the config file.

I also tried setting serviceConfig with options privateTmp=false and
privateNetwork=false but these options seem to be for a later version
of systemd. I am on stock 15.09 here.

- Arnold

(Before anyone asks, the backup is encrypted and only the public part
of the gpg key is present on the server.)

On Sat, 30 Jan 2016 13:27:52 + zimbatm  wrote:
> Did you try to pass the AWS keypair trough an environment variable ? I
> don't know it that would fix it but it's a 3rd solution, not having
> access to the right keys.
> 
> On Sat, 30 Jan 2016 at 13:20 Arnold Krille 
> wrote:
> 
> > Hi all,
> >
> > yes, its the first time I am writing on this list.
> >
> > I am trying to get duply/duplicity to run. When I execute `duply
> > amazon backup` in a root shell, all is well. But I want it to be
> > run regularly by systemd. So I created a service:
> >
> > ```
> > systemd.services.duplyamazon =
> >   {
> > path = [ pkgs.duply ];
> > environment = { LANG = "C"; HOME="/root"; TMPDIR="/tmp"; };
> > script = "duply amazon status";
> > startAt = "Sat 4:10:00";
> >   };
> > ```
> >
> > But when I run that (either by the timer or by `systemctl start
> > duplyamazon`, it fails with very strange python backtrace:
> >
> > ```
> > Jan 30 14:10:08 portal duplyamazon-start[47296]: Using temporary
> > directory /tmp/duplicity-b53bV9-tempdir Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: Backend error detail: Traceback (most
> > recent call last): Jan 30 14:10:08 portal duplyamazon-start[47296]:
> > File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
> > line 1519, in  Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: with_tempdir(main) Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
> > line 1513, in with_tempdir Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: fn() Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
> > line 1354, in main Jan 30 14:10:08 portal duplyamazon-start[47296]:
> > action = commandline.ProcessCommandLine(sys.argv[1:]) Jan 30
> > 14:10:08 portal duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/commandline.py",
> > line 1062, in ProcessCommandLine Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: globals.backend =
> > backend.get_backend(args[0]) Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py",
> > line 223, in get_backend Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: obj = get_backend_object(url_string) Jan
> > 30 14:10:08 portal duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py",
> > line 209, in get_backend_object Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: return factory(pu) Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py",
> > line 161, in __init__ Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: self.resetConnection() Jan 30 14:10:08
> > portal duplyamazon-start[47296]: File
> >
> > "/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py",
> > line 187, in resetConnection Jan 30 14:10:08 portal
> > duplyamazon-start[47296]: raise BackendException(err.message) Jan 30
> > 14:10:08 portal duplyamazon-start[47296]: BackendException Jan 30
> > 14:10:08 portal duplyamazon-start[47296]: BackendException: Jan 30
> > 14:10:08 portal duplyamazon-start[47296]: 14:10:08.191 Task 'STATUS'
> > failed with exit code '23'.
> > ```
> >
> > I think its either because it can not access the tmpdir or because
> > it can not access the network. And I don't know whether that is
> > because of some missing environment variables or because of how
> > systemd services have to be configured.
> >
> > Can anyone try to point me in the right direction?
> >
> > Thanks in advance,
> >
> > Arnold
> >
> >
> > Background: I am currently setting up a new homeserver with NixOS
> > and therefore I am moving all the currently running services of my
> > ubuntu based homeserver. Expect more questions from me in the next
> > weeks… ;-) ___
> > nix-dev mailing list
> > nix-dev@lists.science.uu.nl
> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
> >



signature.asc
Description: PGP signature
___
nix-dev mailing list

[Nix-dev] [Fixed?] Re: environment in systemd services

2016-01-30 Thread Arnold Krille
Hi all,

I kind of fixed it. I played around with the duply config, but that
didn't really change anything.

Then I went back to getting fcron installed and sending emails. And
there I encountered the same problem with the same backtrace with the
empty error message!

So there seems to be something different between the system environment
and roots login shell. So I started not `duply amazon status` but `bash
-l -c "duply amazon status"`, thus running duply in roots login shell.
And now it works! Both when run in cron and when run in its own system
service!

I am not sure if this is the right solution, but at least I got some
backups working now.

As soon as I add backups to a local disk I will check again if duply
can't run with the system environment…

Have fun,

Arnold

On Sat, 30 Jan 2016 14:34:21 +0100 Arnold Krille 
wrote:
> Nope, the aws credentials are in the url given in the config file.
> 
> I also tried setting serviceConfig with options privateTmp=false and
> privateNetwork=false but these options seem to be for a later version
> of systemd. I am on stock 15.09 here.
> 
> - Arnold
> 
> (Before anyone asks, the backup is encrypted and only the public part
> of the gpg key is present on the server.)
> 
> On Sat, 30 Jan 2016 13:27:52 + zimbatm 
> wrote:
> > Did you try to pass the AWS keypair trough an environment
> > variable ? I don't know it that would fix it but it's a 3rd
> > solution, not having access to the right keys.



signature.asc
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Prepending files to initrd

2016-01-30 Thread Shea Levy
This may not be the case any more, but in the past at least you had to 
explicitly specify the newc cpio format (with -H newc) when calling cpio to 
make initrds.

> On Jan 30, 2016, at 5:26 AM, Roger Qiu  wrote:
> 
> Hi,
> 
> There's an option called: `boot.initrd.prepend`. I tried to prepend a 
> gzipped cpio archive containing 1 single file with no path. But I upon 
> rebooting, I received a `Initramfs unpacking failed: junk in compressed 
> archive`.
> 
> Here was the steps I took:
> 
> ```
> pushd /boot
> cpio -o <<< "luks-key.img" >luks-key.cpio
> gzip luks-key.cpio
> rm luks-key.img
> popd
> ```
> 
> Then inside `configuration.nix`: `boot.initrd.prepend = [ 
> "/boot/luks-key.cpio.gz" ];`.
> 
> I expect the file `luks-key.img` to be available in the initrd at stage 
> 1. I want to be able to reference this as `/luks-key.img`.
> 
> Is there anything I'm doing incorrect here?
> 
> Thanks,
> Roger
> 
> -- 
> Founder of Matrix AI
> https://matrix.ai/
> +61420925975
> 
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] environment in systemd services

2016-01-30 Thread Arnold Krille
Hi all,

yes, its the first time I am writing on this list.

I am trying to get duply/duplicity to run. When I execute `duply amazon
backup` in a root shell, all is well. But I want it to be run regularly
by systemd. So I created a service:

```
systemd.services.duplyamazon =
  {
path = [ pkgs.duply ];
environment = { LANG = "C"; HOME="/root"; TMPDIR="/tmp"; }; 
script = "duply amazon status"; 
startAt = "Sat 4:10:00";
  }; 
```

But when I run that (either by the timer or by `systemctl start
duplyamazon`, it fails with very strange python backtrace:

```
Jan 30 14:10:08 portal duplyamazon-start[47296]: Using temporary
directory /tmp/duplicity-b53bV9-tempdir Jan 30 14:10:08 portal
duplyamazon-start[47296]: Backend error detail: Traceback (most recent
call last): Jan 30 14:10:08 portal duplyamazon-start[47296]: File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
line 1519, in  Jan 30 14:10:08 portal duplyamazon-start[47296]:
with_tempdir(main) Jan 30 14:10:08 portal duplyamazon-start[47296]:
File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
line 1513, in with_tempdir Jan 30 14:10:08 portal
duplyamazon-start[47296]: fn() Jan 30 14:10:08 portal
duplyamazon-start[47296]: File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/bin/.duplicity-wrapped",
line 1354, in main Jan 30 14:10:08 portal duplyamazon-start[47296]:
action = commandline.ProcessCommandLine(sys.argv[1:]) Jan 30 14:10:08
portal duplyamazon-start[47296]: File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/commandline.py",
line 1062, in ProcessCommandLine Jan 30 14:10:08 portal
duplyamazon-start[47296]: globals.backend =
backend.get_backend(args[0]) Jan 30 14:10:08 portal
duplyamazon-start[47296]: File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py",
line 223, in get_backend Jan 30 14:10:08 portal
duplyamazon-start[47296]: obj = get_backend_object(url_string) Jan 30
14:10:08 portal duplyamazon-start[47296]: File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backend.py",
line 209, in get_backend_object Jan 30 14:10:08 portal
duplyamazon-start[47296]: return factory(pu) Jan 30 14:10:08 portal
duplyamazon-start[47296]: File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py",
line 161, in __init__ Jan 30 14:10:08 portal duplyamazon-start[47296]:
self.resetConnection() Jan 30 14:10:08 portal duplyamazon-start[47296]:
File
"/nix/store/ap2bv0p5m8napigg7f6yciap4nm61ap8-duplicity-0.7.02/lib/python2.7/site-packages/duplicity/backends/_boto_single.py",
line 187, in resetConnection Jan 30 14:10:08 portal
duplyamazon-start[47296]: raise BackendException(err.message) Jan 30
14:10:08 portal duplyamazon-start[47296]: BackendException Jan 30
14:10:08 portal duplyamazon-start[47296]: BackendException: Jan 30
14:10:08 portal duplyamazon-start[47296]: 14:10:08.191 Task 'STATUS'
failed with exit code '23'.
```

I think its either because it can not access the tmpdir or because it
can not access the network. And I don't know whether that is because of
some missing environment variables or because of how systemd services
have to be configured.

Can anyone try to point me in the right direction?

Thanks in advance,

Arnold


Background: I am currently setting up a new homeserver with NixOS and
therefore I am moving all the currently running services of my ubuntu
based homeserver. Expect more questions from me in the next weeks… ;-)


signature.asc
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Running `nixos-install` creates new generations inside `/mnt`

2016-01-30 Thread Roger Qiu
Hi,

Since I was debugging a number of issues with my configuration on the 
live ISO, I was running `nixos-install` multiple times. Every time I did 
this, and the configuration change caused a change in the initrd, this 
resulted in a new generation. Eventually I ran out of `/boot` space 
(this was on an ESP using gummiboot).

So what's the point of having `nixos-install` create new generations, 
there's no way to change generations or garbage collect generations 
inside `/mnt`? My suggestion would to be make it so that `nixos-install` 
never creates new generations, and always starts as if it only has 1 
generation. It would make it truly idempotent.

Thanks,
Roger

-- 
Founder of Matrix AI
https://matrix.ai/
+61420925975

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Prepending files to initrd

2016-01-30 Thread Roger Qiu
Hi,

There's an option called: `boot.initrd.prepend`. I tried to prepend a 
gzipped cpio archive containing 1 single file with no path. But I upon 
rebooting, I received a `Initramfs unpacking failed: junk in compressed 
archive`.

Here was the steps I took:

```
pushd /boot
cpio -o <<< "luks-key.img" >luks-key.cpio
gzip luks-key.cpio
rm luks-key.img
popd
```

Then inside `configuration.nix`: `boot.initrd.prepend = [ 
"/boot/luks-key.cpio.gz" ];`.

I expect the file `luks-key.img` to be available in the initrd at stage 
1. I want to be able to reference this as `/luks-key.img`.

Is there anything I'm doing incorrect here?

Thanks,
Roger

-- 
Founder of Matrix AI
https://matrix.ai/
+61420925975

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] [Fixed?] Re: environment in systemd services

2016-01-30 Thread Guillaume Maudoux (Layus)
Yep. Most probably SSL_CERT_FILE. Look for that string on thé github issues, or 
in the mailing list archives.

Layus.

Le 30 janvier 2016 17:35:17 UTC+01:00, zimbatm  a écrit :
>My guess is that it's probably an environnent variable that's missing
>and
>bash is sourcing the profiles.
>
>On Sat, 30 Jan 2016 17:30 Arnold Krille  wrote:
>
>> Hi all,
>>
>> I kind of fixed it. I played around with the duply config, but that
>> didn't really change anything.
>>
>> Then I went back to getting fcron installed and sending emails. And
>> there I encountered the same problem with the same backtrace with the
>> empty error message!
>>
>> So there seems to be something different between the system
>environment
>> and roots login shell. So I started not `duply amazon status` but
>`bash
>> -l -c "duply amazon status"`, thus running duply in roots login
>shell.
>> And now it works! Both when run in cron and when run in its own
>system
>> service!
>>
>> I am not sure if this is the right solution, but at least I got some
>> backups working now.
>>
>> As soon as I add backups to a local disk I will check again if duply
>> can't run with the system environment…
>>
>> Have fun,
>>
>> Arnold
>>
>> On Sat, 30 Jan 2016 14:34:21 +0100 Arnold Krille
>
>> wrote:
>> > Nope, the aws credentials are in the url given in the config file.
>> >
>> > I also tried setting serviceConfig with options privateTmp=false
>and
>> > privateNetwork=false but these options seem to be for a later
>version
>> > of systemd. I am on stock 15.09 here.
>> >
>> > - Arnold
>> >
>> > (Before anyone asks, the backup is encrypted and only the public
>part
>> > of the gpg key is present on the server.)
>> >
>> > On Sat, 30 Jan 2016 13:27:52 + zimbatm 
>> > wrote:
>> > > Did you try to pass the AWS keypair trough an environment
>> > > variable ? I don't know it that would fix it but it's a 3rd
>> > > solution, not having access to the right keys.
>>
>> ___
>> nix-dev mailing list
>> nix-dev@lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>
>
>
>
>___
>nix-dev mailing list
>nix-dev@lists.science.uu.nl
>http://lists.science.uu.nl/mailman/listinfo/nix-dev
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev