Re: [Nix-dev] Directly configuring sysfs or /sys (not sysctl)

2015-05-24 Thread Bjørn Forsman
On 24 May 2015 at 06:27, Roger Qiu roger@polycademy.com wrote:
 I think sysctl is not the same as sysfs in Linux. The sysfs is a vfs that is
 mounted on `/sys`, whereas sysctl only controls the settings that are
 available inside `/proc/sys`.

Right. Sorry, I didn't pay enough attention.

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


Re: [Nix-dev] Directly configuring sysfs or /sys (not sysctl)

2015-05-23 Thread Roger Qiu
Just listing the current possible methods for configuring /sys (I 
haven't tried all of them):


* Configuring a custom systemd service to run on boot that just executes 
something like `bash -c 'echo ...  /sys...`

* Setting up a udev rule: http://serverfault.com/a/636759/147813
* Use systemd's tmpfiles.d and write a rule that writes a parameter to 
/sys: http://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
* Use `/etc/sysfs.conf` or `/etc/sysfs.d/` and package up the systemd 
sysfsutils.service (this doesn't exist in Nix/NixOS currently).


Perhaps the primitive in Nix could use of them as a backing. The 
configuration primitive could be`boot.kernel.sys` or `boot.sys`.


On 24/05/2015 3:25 AM, Roger Qiu wrote:

Hi,

I was wondering if there was a particular Nix/NixOS configuration 
primitive that allowed direct  permanent editing of arbitrary sysfs 
`/sys` parameters?


Currently it seems that it's possible by creating custom systemd 
services (or maybe a udev rule) that run at boot which set the 
settings, or you could use `|/etc/sysfs.conf|.` or `/etc/sysfs.d/` 
(but I'm not sure if these are enabled in NixOS).


Unlike sysctl settings which are clearly explained in the 
documentation, it's not clear where the canonical place to set `/sys` 
settings should be such as CPU frequency.. etc.


Thanks,
Roger

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

--
Founder of Matrix AI
http://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] Directly configuring sysfs or /sys (not sysctl)

2015-05-23 Thread Bjørn Forsman
On 23 May 2015 at 19:35, Roger Qiu roger@polycademy.com wrote:
 Just listing the current possible methods for configuring /sys (I haven't
 tried all of them):

 * Configuring a custom systemd service to run on boot that just executes
 something like `bash -c 'echo ...  /sys...`
 * Setting up a udev rule: http://serverfault.com/a/636759/147813
 * Use systemd's tmpfiles.d and write a rule that writes a parameter to /sys:
 http://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
 * Use `/etc/sysfs.conf` or `/etc/sysfs.d/` and package up the systemd
 sysfsutils.service (this doesn't exist in Nix/NixOS currently).

 Perhaps the primitive in Nix could use of them as a backing. The
 configuration primitive could be`boot.kernel.sys` or `boot.sys`.

There is already boot.kernel.sysctl:

https://nixos.org/nixos/manual/ch-options.html#opt-boot.kernel.sysctl

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


Re: [Nix-dev] Directly configuring sysfs or /sys (not sysctl)

2015-05-23 Thread Roger Qiu
I think sysctl is not the same as sysfs in Linux. The sysfs is a vfs 
that is mounted on `/sys`, whereas sysctl only controls the settings 
that are available inside `/proc/sys`.

Not all the settings in `/sys` is related to the kernel. So it's 
probably better for it to be located in `boot.sys`.

For example /sys allows you to change CPU frequency.

See:

* http://www.noah.org/wiki/sysctl_and_sysfs
* 
http://people.ee.ethz.ch/~arkeller/linux/multi/kernel_user_space_howto-2.html

On BSD I think it's different, in that sysctl there might be able to do 
everything.

On 24/05/2015 4:08 AM, Bjørn Forsman wrote:
 On 23 May 2015 at 19:35, Roger Qiu roger@polycademy.com wrote:
 Just listing the current possible methods for configuring /sys (I haven't
 tried all of them):

 * Configuring a custom systemd service to run on boot that just executes
 something like `bash -c 'echo ...  /sys...`
 * Setting up a udev rule: http://serverfault.com/a/636759/147813
 * Use systemd's tmpfiles.d and write a rule that writes a parameter to /sys:
 http://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
 * Use `/etc/sysfs.conf` or `/etc/sysfs.d/` and package up the systemd
 sysfsutils.service (this doesn't exist in Nix/NixOS currently).

 Perhaps the primitive in Nix could use of them as a backing. The
 configuration primitive could be`boot.kernel.sys` or `boot.sys`.
 There is already boot.kernel.sysctl:

 https://nixos.org/nixos/manual/ch-options.html#opt-boot.kernel.sysctl

 - Bjørn

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

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