all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* open config.scm with sudo and gedit or emacs
@ 2023-03-11 10:33 Gottfried
  2023-03-11 10:57 ` Thanos Apollo
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Gottfried @ 2023-03-11 10:33 UTC (permalink / raw)
  To: help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 1010 bytes --]

Hi,

because of my limited knowledge
when opening my config.scm file with sudo
I can do it only with nano
But nano doesn’t show the matching parenthesis.

1.
I would like to open my config.scm file with emacs or gedit,
because both show the matching parenthesis.

How can I do that?
.....................................................
2.
In emacs it opens the file only in read-able mode.
How can I change this?

3.
In gedit it is also only in read-able mode.
....................................................

4.
Are there commands on the command line
to open my config.scm file with emacs/gedit in sudo mode?
....................................................

Untile now I opened my config.scm in gedit,
I saw the matching parenthesis
and was playing around with it
but then opening the file with sudo nano /etc/config.scm
I changed the parenthesis.

It would be better to do it in a different way,
but I am not a linux expert.

-- 
Kind regards

Gottfried


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 10:33 open config.scm with sudo and gedit or emacs Gottfried
@ 2023-03-11 10:57 ` Thanos Apollo
  2023-03-11 11:03 ` Bruno Victal
  2023-03-11 17:05 ` Sergiu Ivanov
  2 siblings, 0 replies; 12+ messages in thread
From: Thanos Apollo @ 2023-03-11 10:57 UTC (permalink / raw)
  To: Gottfried; +Cc: help-guix


Hey Gottfried!


Gottfried <gottfried@posteo.de> writes:

[...]
> 1.
> I would like to open my config.scm file with emacs or gedit,
> because both show the matching parenthesis.
>
> How can I do that?
Not a Guix expert here either, but you might want to copy your
auto-generated config.scm as  ~/.config/guix/config.scm or something
like that so you will be able edit it as $USER and not just be owned by
root(and also keep your /etc/config.scm just in case you make a typo for
your filesystem as a backup).

> .....................................................
> 2.
> In emacs it opens the file only in read-able mode.
> How can I change this?
>
You should try out the `sudo-edit` package for editing
with root privileges in emacs ;)

Hope this helps!

-- 
Thanos



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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 10:33 open config.scm with sudo and gedit or emacs Gottfried
  2023-03-11 10:57 ` Thanos Apollo
@ 2023-03-11 11:03 ` Bruno Victal
  2023-03-11 17:05 ` Sergiu Ivanov
  2 siblings, 0 replies; 12+ messages in thread
From: Bruno Victal @ 2023-03-11 11:03 UTC (permalink / raw)
  To: Gottfried; +Cc: help-guix

Hi Gottfried,

On 2023-03-11 10:33, Gottfried wrote:
> Hi,
> 
> because of my limited knowledge
> when opening my config.scm file with sudo
> I can do it only with nano
> But nano doesn’t show the matching parenthesis.
> 
> 1.
> I would like to open my config.scm file with emacs or gedit,
> because both show the matching parenthesis.

Change the EDITOR environment variable, i.e.
$ export EDITOR=emacs

> 
> How can I do that?
> .....................................................
> 2.
> In emacs it opens the file only in read-able mode.
> How can I change this?

Use sudoedit.

> 
> 4.
> Are there commands on the command line
> to open my config.scm file with emacs/gedit in sudo mode?
> ....................................................

EDITOR=emacs sudoedit config.scm


Cheers,
Bruno


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 10:33 open config.scm with sudo and gedit or emacs Gottfried
  2023-03-11 10:57 ` Thanos Apollo
  2023-03-11 11:03 ` Bruno Victal
@ 2023-03-11 17:05 ` Sergiu Ivanov
  2023-03-11 18:58   ` Kyle
  2023-03-11 23:42   ` SeerLite
  2 siblings, 2 replies; 12+ messages in thread
From: Sergiu Ivanov @ 2023-03-11 17:05 UTC (permalink / raw)
  To: Gottfried; +Cc: help-guix

Hi Gottfried,

Gottfried <gottfried@posteo.de> [2023-03-11T11:33:33+0100]:
>
> because of my limited knowledge
> when opening my config.scm file with sudo
> I can do it only with nano

The strategy I personally prefer is to edit a file in my home directory
and then sudo cp to /etc/config.scm.

More concretely, I store my system configuration in
~/.config/guix/system-config.scm.  I edit it with Emacs, as I would edit
any other normal file.  When I am done editing, I do what essentially is

sudo cp ~/.config/guix/system-config.scm /etc/config.scm

I use Emacs's Dired mode + Tramp to actually do the copy, but that's
inessential to the strategy.

One advantage of this approach is that you can version your local file
using Git or some other version control system (VCS).  Even without VCS,
editing a local copy of your system configuration may prevent some
silly mistakes.

-
Sergiu


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 17:05 ` Sergiu Ivanov
@ 2023-03-11 18:58   ` Kyle
  2023-03-11 23:42   ` SeerLite
  1 sibling, 0 replies; 12+ messages in thread
From: Kyle @ 2023-03-11 18:58 UTC (permalink / raw)
  To: help-guix, Sergiu Ivanov, Gottfried

Hi Gottfried, 

I had some success editing things owned by the root user in emacs using Tramp.

The syntax a bit confusing. You search for the file in the usual way in Emacs, but you delete all the text it fills in for you and instead replace it with:

```
 /sudo:$USER@localhost:/etc/config.scm
```

You can replace $USER with your username.

On March 11, 2023 12:05:01 PM EST, Sergiu Ivanov <sivanov@colimite.fr> wrote:
>Hi Gottfried,
>
>Gottfried <gottfried@posteo.de> [2023-03-11T11:33:33+0100]:
>>
>> because of my limited knowledge
>> when opening my config.scm file with sudo
>> I can do it only with nano
>
>The strategy I personally prefer is to edit a file in my home directory
>and then sudo cp to /etc/config.scm.
>
>More concretely, I store my system configuration in
>~/.config/guix/system-config.scm.  I edit it with Emacs, as I would edit
>any other normal file.  When I am done editing, I do what essentially is
>
>sudo cp ~/.config/guix/system-config.scm /etc/config.scm
>
>I use Emacs's Dired mode + Tramp to actually do the copy, but that's
>inessential to the strategy.
>
>One advantage of this approach is that you can version your local file
>using Git or some other version control system (VCS).  Even without VCS,
>editing a local copy of your system configuration may prevent some
>silly mistakes.
>
>-
>Sergiu
>

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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 17:05 ` Sergiu Ivanov
  2023-03-11 18:58   ` Kyle
@ 2023-03-11 23:42   ` SeerLite
  2023-03-12  7:07     ` Boris A. Dekshteyn
                       ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: SeerLite @ 2023-03-11 23:42 UTC (permalink / raw)
  To: help-guix, Sergiu Ivanov, Gottfried

On March 11, 2023 2:05:01 PM GMT-03:00, Sergiu Ivanov <sivanov@colimite.fr> wrote:
>Hi Gottfried,
>
>Gottfried <gottfried@posteo.de> [2023-03-11T11:33:33+0100]:
>>
>> because of my limited knowledge
>> when opening my config.scm file with sudo
>> I can do it only with nano
>
>The strategy I personally prefer is to edit a file in my home directory
>and then sudo cp to /etc/config.scm.
>
>More concretely, I store my system configuration in
>~/.config/guix/system-config.scm. I edit it with Emacs, as I would edit
>any other normal file. When I am done editing, I do what essentially is
>
>sudo cp ~/.config/guix/system-config.scm /etc/config.scm

Hi!

Why not use the configuration from ~/.config directly? Why copy at all? I do

    sudo guix system reconfigure ~/.config/guix/system-config.scm

SeerLite


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 23:42   ` SeerLite
@ 2023-03-12  7:07     ` Boris A. Dekshteyn
  2023-03-12  9:33       ` SeerLite
  2023-03-12 11:00     ` Sergiu Ivanov
  2023-03-12 13:27     ` Felix Lechner via
  2 siblings, 1 reply; 12+ messages in thread
From: Boris A. Dekshteyn @ 2023-03-12  7:07 UTC (permalink / raw)
  To: help-guix

SeerLite <seerlite@disroot.org> writes:

>
>     sudo guix system reconfigure ~/.config/guix/system-config.scm

sudo -E ...

-- 
WBR, Boris Dekshteyn


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-12  7:07     ` Boris A. Dekshteyn
@ 2023-03-12  9:33       ` SeerLite
  0 siblings, 0 replies; 12+ messages in thread
From: SeerLite @ 2023-03-12  9:33 UTC (permalink / raw)
  To: help-guix, Boris A. Dekshteyn

Hi!

On March 12, 2023 4:07:25 AM GMT-03:00, "Boris A. Dekshteyn" <boris.dekshteyn@gmail.com> wrote:
>SeerLite <seerlite@disroot.org> writes:
>
>>
>>     sudo guix system reconfigure ~/.config/guix/system-config.scm
>
>sudo -E ...
>

No, that will create root-owned files in ~/.cache. I always get trouble using sudo -E because programs tend to create root-owned files under ~.

There's no need for -E as guix doesn't need any environment variable from the user to reconfigure, everything is self contained in the `guix` binary and the system configuration file.

SeerLite


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 23:42   ` SeerLite
  2023-03-12  7:07     ` Boris A. Dekshteyn
@ 2023-03-12 11:00     ` Sergiu Ivanov
  2023-03-12 18:13       ` Luis Felipe
  2023-03-12 13:27     ` Felix Lechner via
  2 siblings, 1 reply; 12+ messages in thread
From: Sergiu Ivanov @ 2023-03-12 11:00 UTC (permalink / raw)
  To: SeerLite; +Cc: help-guix, Gottfried

Hi SeerLite,

SeerLite <seerlite@disroot.org> [2023-03-12T00:42:42+0100]:
> On March 11, 2023 2:05:01 PM GMT-03:00, Sergiu Ivanov <sivanov@colimite.fr> wrote:
>>Gottfried <gottfried@posteo.de> [2023-03-11T11:33:33+0100]:
>>>
>>> because of my limited knowledge
>>> when opening my config.scm file with sudo
>>> I can do it only with nano
>>
>>The strategy I personally prefer is to edit a file in my home directory
>>and then sudo cp to /etc/config.scm.
>>
>>More concretely, I store my system configuration in
>>~/.config/guix/system-config.scm. I edit it with Emacs, as I would edit
>>any other normal file. When I am done editing, I do what essentially is
>>
>>sudo cp ~/.config/guix/system-config.scm /etc/config.scm
>
> Why not use the configuration from ~/.config directly? Why copy at all? I do
>
>     sudo guix system reconfigure ~/.config/guix/system-config.scm

You are right, it's probably even better.

I prefer keeping my system config in /etc/config.scm because this is
what everyone seems to do, but that's probably a bad reason, supported
by unreliable data :D

-
Sergiu


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-11 23:42   ` SeerLite
  2023-03-12  7:07     ` Boris A. Dekshteyn
  2023-03-12 11:00     ` Sergiu Ivanov
@ 2023-03-12 13:27     ` Felix Lechner via
  2 siblings, 0 replies; 12+ messages in thread
From: Felix Lechner via @ 2023-03-12 13:27 UTC (permalink / raw)
  To: SeerLite; +Cc: help-guix, Sergiu Ivanov, Gottfried

Hi everyone,

On Sat, Mar 11, 2023 at 3:43 PM SeerLite <seerlite@disroot.org> wrote:
>
>     sudo guix system reconfigure ~/.config/guix/system-config.scm

As a user of a FUSE-encrypted file system for my home folder (I use
Gocryptfs) I cannot execute the command above. After some
experimentation, I settled on using 'guix deploy' for my local machine
just as I do for all my other Guix equipment.

My setup works great, except it presently comes with some security
drawbacks. It requires password-less access to root accounts
everywhere (via SSH).

Kind regards
Felix


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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-12 11:00     ` Sergiu Ivanov
@ 2023-03-12 18:13       ` Luis Felipe
  2023-03-12 19:05         ` Sergiu Ivanov
  0 siblings, 1 reply; 12+ messages in thread
From: Luis Felipe @ 2023-03-12 18:13 UTC (permalink / raw)
  To: Sergiu Ivanov, SeerLite; +Cc: help-guix, Gottfried


[-- Attachment #1.1.1: Type: text/plain, Size: 2410 bytes --]

Hello people,

El 12/03/23 a las 11:00, Sergiu Ivanov escribió:
> Hi SeerLite,
>
> SeerLite <seerlite@disroot.org> [2023-03-12T00:42:42+0100]:
>> On March 11, 2023 2:05:01 PM GMT-03:00, Sergiu Ivanov <sivanov@colimite.fr> wrote:
>>> Gottfried <gottfried@posteo.de> [2023-03-11T11:33:33+0100]:
>>>> because of my limited knowledge
>>>> when opening my config.scm file with sudo
>>>> I can do it only with nano
>>> The strategy I personally prefer is to edit a file in my home directory
>>> and then sudo cp to /etc/config.scm.
>>>
>>> More concretely, I store my system configuration in
>>> ~/.config/guix/system-config.scm. I edit it with Emacs, as I would edit
>>> any other normal file. When I am done editing, I do what essentially is
>>>
>>> sudo cp ~/.config/guix/system-config.scm /etc/config.scm
>> Why not use the configuration from ~/.config directly? Why copy at all? I do
>>
>>      sudo guix system reconfigure ~/.config/guix/system-config.scm
> You are right, it's probably even better.
>
> I prefer keeping my system config in /etc/config.scm because this is
> what everyone seems to do, but that's probably a bad reason, supported
> by unreliable data :D
I don't think there is any need to edit /etc/config.scm at all (maybe 
something in the manual needs clarification?). Once you have installed 
the Guix System, you can

 1. Open /etc/config.scm with any text editor you want
 2. Copy its contents and save them to a file in any location in your
    home folder. For example: ~/Documents/my-guix-things/production-os.scm.

 From that moment on, you can edit production-os.scm as your regular 
user in any way you like and only use "sudo" to apply the configuration 
to your system:

    guix pull  # Recommended.
    sudo guix system reconfigure
    ~/Documents/my-guix-things/production-os.scm

You can even create copies of "production-os.scm" and shape different 
systems you'd like to try out separately (e.g. gnome-os.scm, 
sway-os.scm, some-server.scm, etc.).

In fact, the Guix manual says: "The normal way to change the system 
configuration is by updating this file [a file like the 
production-os.scm] and re-running ‘[sudo] guix system reconfigure’.  One 
should never have to touch files in ‘/etc’" (see System Configuration).

Hope that helps,


-- 
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2881 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

* Re: open config.scm with sudo and gedit or emacs
  2023-03-12 18:13       ` Luis Felipe
@ 2023-03-12 19:05         ` Sergiu Ivanov
  0 siblings, 0 replies; 12+ messages in thread
From: Sergiu Ivanov @ 2023-03-12 19:05 UTC (permalink / raw)
  To: Luis Felipe; +Cc: SeerLite, help-guix, Gottfried

Hello Luis Felipe,

Luis Felipe <sirgazil@zoho.com> [2023-03-12T19:13:54+0100]:
> In fact, the Guix manual says: "The normal way to change the system
> configuration is by updating this file [a file like the
> production-os.scm] and re-running ‘[sudo] guix system reconfigure’. 
> One should never have to touch files in ‘/etc’" (see System
> Configuration).

Thanks a lot for this reference, I will change the way I handle my
system configuration file!

-
Sergiu


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

end of thread, other threads:[~2023-03-12 19:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-11 10:33 open config.scm with sudo and gedit or emacs Gottfried
2023-03-11 10:57 ` Thanos Apollo
2023-03-11 11:03 ` Bruno Victal
2023-03-11 17:05 ` Sergiu Ivanov
2023-03-11 18:58   ` Kyle
2023-03-11 23:42   ` SeerLite
2023-03-12  7:07     ` Boris A. Dekshteyn
2023-03-12  9:33       ` SeerLite
2023-03-12 11:00     ` Sergiu Ivanov
2023-03-12 18:13       ` Luis Felipe
2023-03-12 19:05         ` Sergiu Ivanov
2023-03-12 13:27     ` Felix Lechner via

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.