unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Installing file outside package in /etc
@ 2021-04-24  9:30 phodina via
  2021-04-24 14:44 ` Sergiu Ivanov
  0 siblings, 1 reply; 4+ messages in thread
From: phodina via @ 2021-04-24  9:30 UTC (permalink / raw)
  To: help-guix

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?

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?

Kind regards
Petr Hodina

Sent with [ProtonMail](https://protonmail.com) Secure Email.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Installing file outside package in /etc
  2021-04-24  9:30 Installing file outside package in /etc phodina via
@ 2021-04-24 14:44 ` Sergiu Ivanov
  2021-04-28 11:02   ` Utkarsh Singh
  0 siblings, 1 reply; 4+ messages in thread
From: Sergiu Ivanov @ 2021-04-24 14:44 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Installing file outside package in /etc
  2021-04-24 14:44 ` Sergiu Ivanov
@ 2021-04-28 11:02   ` Utkarsh Singh
  2021-04-28 11:05     ` Sergiu Ivanov
  0 siblings, 1 reply; 4+ messages in thread
From: Utkarsh Singh @ 2021-04-28 11:02 UTC (permalink / raw)
  To: Sergiu Ivanov; +Cc: help-guix

Hi,

On 2021-04-24, 16:44 +0200, Sergiu Ivanov <sivanov@colimite.fr> wrote:

> 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 :-)

You can make use of GNU Find utility to find more than one file that
refer to the same file on a file system, i.e., to the same inode.  For
example to search for same file as /etc/hostname in /etc directory you
can use:

$ find /etc -samefile /etc/hostname

You can read more here:
https://www.gnu.org/software/findutils/manual/html_mono/find.html#Hard-Links

-- 
Utkarsh Singh
http://utkarshsingh.xyz


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Installing file outside package in /etc
  2021-04-28 11:02   ` Utkarsh Singh
@ 2021-04-28 11:05     ` Sergiu Ivanov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergiu Ivanov @ 2021-04-28 11:05 UTC (permalink / raw)
  To: Utkarsh Singh; +Cc: help-guix

Hi,

Thus quoth  Utkarsh Singh  on Wed Apr 28 2021 at 13:02 (+0200):
> Hi,
>
> On 2021-04-24, 16:44 +0200, Sergiu Ivanov <sivanov@colimite.fr> wrote:
>
>> 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 :-)
>
> You can make use of GNU Find utility to find more than one file that
> refer to the same file on a file system, i.e., to the same inode.  For
> example to search for same file as /etc/hostname in /etc directory you
> can use:
>
> $ find /etc -samefile /etc/hostname
>
> You can read more here:
> https://www.gnu.org/software/findutils/manual/html_mono/find.html#Hard-Links

Ah, nice, thanks!  I had no idea find could help with that!

-
Sergiu


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-28 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24  9:30 Installing file outside package in /etc phodina via
2021-04-24 14:44 ` Sergiu Ivanov
2021-04-28 11:02   ` Utkarsh Singh
2021-04-28 11:05     ` Sergiu Ivanov

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git