help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installing file outside package in /etc


From: Sergiu Ivanov
Subject: Re: Installing file outside package in /etc
Date: Sat, 24 Apr 2021 16:44:52 +0200
User-agent: mu4e 1.4.15; emacs 27.2

Hi,

Guix beginner here.

Thus quoth  phodina via  on Sat Apr 24 2021 at 11:30 (+0200):
> I'm creating a package for application which needs to install file
> outside of the derivation directory.
>
> The file in question is /etc/sudoers.d but it can be generalized for
> other things like udev etc. I understand this won't be trivial since
> it modifies the system and will probably require some wrapper with
> higher privileges. However, I could not find any section in the Guix
> reference Manual.
>
> The file is installed in the install phase. Is it the right phase or
> shall I use different? If so how do I patch it?

>From what I understand of Guix/Nix, you would have to modify the
definition of your operating-system (in /etc/config.scm) to install
a file under /etc/, which is clearly not what you are trying to achieve.

I have the impression that modifying files outside the output directory
is out of the scope of Guix/Nix packages, which is probably why the Guix
manual doesn't even speak about that problem.

Maybe some more experienced people have better advice.

> Also if I compare the contents of GuixSD to NixOS, then the NixOS has
> more files linked to /etc/static/ which then links to
> /nix/store. Could somebody please explain what were/are the thoughts
> behind this?

I checked /etc/static on two machines, one running Guix System and the
other one NixOS, and it looks to me that those symlinks contain the
static (duh) parts of the configurations, which are generated from the
corresponding operating system definitions.  These files are put into
the store and are not supposed to be changed other than by changing the
definitions of the operating system.

I have the impression that Nix links every single static file to a file
in the store, while Guix only links directories.  For example, on my
Guix System, /etc/hostname is a normal file, while on NixOS it is
a symlink to /etc/static/hostname.  This should explain the difference
in the number of symlinks.

Note however that /etc/hostname appearing to be a normal file may be
misleading, since it may also be a hardlink to a file in the store.
It is beyond my knowledge/motivation to figure out whether it really is
or not :-)

-
Sergiu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]