* Synced with branches/fix-style @ 13861
svn path=/nixos/branches/modular-nixos/; revision=14946
This commit is contained in:
commit
9ac25ba853
@ -7,6 +7,230 @@
|
|||||||
NixOS.</para>
|
NixOS.</para>
|
||||||
|
|
||||||
|
|
||||||
|
<section>
|
||||||
|
|
||||||
|
<title>Extending NixOS</title>
|
||||||
|
|
||||||
|
<para>A unique syntax is used to express all system, hardware, computer and
|
||||||
|
service configurations. This syntax helps for reading and writing new
|
||||||
|
configuration files. It is coming with some extra strategies defined in
|
||||||
|
NixPkgs which are used to merge and evaluate all configuration files.</para>
|
||||||
|
|
||||||
|
<para>A configuration file is the same as your own computer
|
||||||
|
configuration.</para>
|
||||||
|
|
||||||
|
<example xml:id='conf-syntax'><title>Usual configuration file</title>
|
||||||
|
<programlisting>
|
||||||
|
{pkgs, config, ...}: <co xml:id='conf-syntax-1' />
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption; <co xml:id='conf-syntax-2' />
|
||||||
|
|
||||||
|
options = { <co xml:id='conf-syntax-3' />
|
||||||
|
services = {
|
||||||
|
locate = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = ''
|
||||||
|
If enabled, NixOS will periodically update the database of
|
||||||
|
files used by the <command>locate</command> command.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
period = mkOption {
|
||||||
|
default = "15 02 * * *";
|
||||||
|
description = ''
|
||||||
|
This option defines (in the format used by cron) when the
|
||||||
|
locate database is updated.
|
||||||
|
The default is to update at 02:15 (at night) every day.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
let
|
||||||
|
cfg = config.services.locate; <co xml:id='conf-syntax-4' />
|
||||||
|
inherit (pkgs.lib) mkIf mkThenElse;
|
||||||
|
|
||||||
|
locatedb = "/var/cache/locatedb";
|
||||||
|
logfile = "/var/log/updatedb";
|
||||||
|
cmd = "root updatedb --localuser=nobody --output=${locatedb} > ${logfile}";
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {<co xml:id='conf-syntax-5' />
|
||||||
|
require = [ <co xml:id='conf-syntax-6' />
|
||||||
|
options
|
||||||
|
|
||||||
|
# config.services.cron
|
||||||
|
(import ../../upstart-jobs/cron.nix)
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
cron = {
|
||||||
|
systemCronJobs = mkThenElse { <co xml:id='conf-syntax-7' />
|
||||||
|
thenPart = "${cfg.period} root ${cmd}";
|
||||||
|
elsePart = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}</programlisting>
|
||||||
|
</example>
|
||||||
|
|
||||||
|
<para><xref linkend='conf-syntax' /> shows the <emphasis>configuration
|
||||||
|
file</emphasis> for the locate service which uses cron to update the
|
||||||
|
database at some dates which can be defined by the user. This nix
|
||||||
|
expression is coming
|
||||||
|
from <filename>upstart-jobs/cron/locate.nix</filename>. It shows a simple
|
||||||
|
example of a service that can be either distributed on many computer that
|
||||||
|
are using the same configuration or to shared with the community. This
|
||||||
|
file is divided in two with the interface and the implementation. Both
|
||||||
|
the interface and the implementation declare a <emphasis>configuration
|
||||||
|
set</emphasis>.
|
||||||
|
|
||||||
|
<calloutlist>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-1'>
|
||||||
|
|
||||||
|
<para>This line declares the arguments of the configuration file. You
|
||||||
|
can omit this line if there is no reference to <varname>pkgs</varname>
|
||||||
|
and <varname>config</varname> inside the configuration file.</para>
|
||||||
|
|
||||||
|
<para>The argument <varname>pkgs</varname> refers to NixPkgs and allow
|
||||||
|
you to access all attributes contained inside it. In this
|
||||||
|
example <varname>pkgs</varname> is used to retrieve common functions to
|
||||||
|
ease the writing of configuration files
|
||||||
|
like <varname>mkOption</varname>, <varname>mkIf</varname>
|
||||||
|
and <varname>mkThenElse</varname>.</para>
|
||||||
|
|
||||||
|
<para>The argument <varname>config</varname> corresponds to the whole
|
||||||
|
NixOS configuration. This is a set which is build by merging all
|
||||||
|
configuration files imported to set up the system. Thus all options
|
||||||
|
declared are contained inside this variable. In this
|
||||||
|
example <varname>config</varname> is used to retrieve the status of
|
||||||
|
the <varname>enable</varname> flag. The important point of this
|
||||||
|
argument is that it contains either the result of the merge of different
|
||||||
|
settings or the default value, therefore you cannot assume
|
||||||
|
that <option>config.services.locate.enable</option> is always false
|
||||||
|
because it may have been defined in another configuration file.</para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-2'>
|
||||||
|
|
||||||
|
<para>This line is used to import a function that is useful for
|
||||||
|
writing this configuration file.</para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-3'>
|
||||||
|
|
||||||
|
<para>The variable <varname>options</varname> is
|
||||||
|
a <emphasis>configuration set</emphasis> which is only used to declare
|
||||||
|
options with the function <varname>mkOption</varname> imported
|
||||||
|
from <filename>pkgs/lib/default.nix</filename>. Options may contained
|
||||||
|
any attribute but only the following have a special
|
||||||
|
meaning: <varname>default</varname>, <varname>example</varname>,
|
||||||
|
<varname>description</varname>, <varname>merge</varname>
|
||||||
|
and <varname>apply</varname>.</para>
|
||||||
|
|
||||||
|
<para>The <varname>merge</varname> attribute is used to merge all values
|
||||||
|
defined in all configuration files and this function return a value
|
||||||
|
which has the same type as the default value. If the merge function is
|
||||||
|
not defined, then a default function
|
||||||
|
(<varname>pkgs.lib.mergeDefaultOption</varname>) is used to merge
|
||||||
|
values. The <varname>merge</varname> attribute is a function which
|
||||||
|
expect two arguments: the location of the option and the list of values
|
||||||
|
which have to be merged.</para>
|
||||||
|
|
||||||
|
<para>The <varname>apply</varname> attribute is a function used to
|
||||||
|
process the option. Thus the value return
|
||||||
|
by <option>config.<replaceable>option</replaceable></option> would be
|
||||||
|
the result of the <varname>apply</varname> function called with either
|
||||||
|
the <varname>default</varname> value or the result of
|
||||||
|
the <varname>merge</varname> function.</para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-4'>
|
||||||
|
|
||||||
|
<para>This line is a common trick used to reduce the amount of
|
||||||
|
writing. In this case <varname>cfg</varname> is just a sugar over
|
||||||
|
<option>config.services.locate</option></para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-5'>
|
||||||
|
|
||||||
|
<para>This line is used to declare a special <emphasis>IF</emphasis>
|
||||||
|
statement. If you had put a usual <emphasis>IF</emphasis> statement
|
||||||
|
here, with the same condition, then you will get an infinite loop. The
|
||||||
|
reason is that your condition ask for the value of the
|
||||||
|
option <option>config.services.locate.enable</option> but in order to
|
||||||
|
get this value you have to evaluate all configuration sets including the
|
||||||
|
configuration set contained inside your file.</para>
|
||||||
|
|
||||||
|
<para>To remove this extra complexity, <varname>mkIf</varname> has been
|
||||||
|
introduced to get rid of possible infinite loop and to factor your
|
||||||
|
writing.</para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-6'>
|
||||||
|
|
||||||
|
<para>The attribute <varname>require</varname> is the only special
|
||||||
|
option that exists. It is used to embed all option declarations that
|
||||||
|
are required by your configuration file and it is also used to provide
|
||||||
|
the options that you are declaring.</para>
|
||||||
|
|
||||||
|
<para>This attribute is processed
|
||||||
|
with <varname>pkgs.lib.uniqFlatten</varname> to collect all
|
||||||
|
configuration files that are used by your system and it avoid the
|
||||||
|
insertion of duplicated elements by comparing the configuration set codes.</para>
|
||||||
|
|
||||||
|
<para>Currently, the file <filename>configuration.nix</filename>
|
||||||
|
implicitly embeds <filename>system/options.nix</filename>. If you need
|
||||||
|
a special configuration file, then you will have to add similar lines
|
||||||
|
to your computer configuration.</para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
<callout arearefs='conf-syntax-7'>
|
||||||
|
|
||||||
|
<para>As <varname>mkIf</varname> does not need
|
||||||
|
any <emphasis>then</emphasis> part or <emphasis>else</emphasis> part,
|
||||||
|
then you can specify one on each option definition with the
|
||||||
|
function <varname>mkThenElse</varname>.</para>
|
||||||
|
|
||||||
|
<para>To avoid a lot of <varname>mkThenElse</varname> with empty
|
||||||
|
<emphasis>else</emphasis> part, a sugar has been added to infer the
|
||||||
|
corresponding <emphasis>empty</emphasis>-value of your option when the
|
||||||
|
function <varname>mkThenElse</varname> is not used.</para>
|
||||||
|
|
||||||
|
<para>If your <emphasis>then</emphasis> part
|
||||||
|
and <emphasis>else</emphasis> part are identical, then you should use
|
||||||
|
the function <varname>mkAlways</varname> to ignore the condition.</para>
|
||||||
|
|
||||||
|
<para>If you need to add another condition, then you can add <varname>mkIf</varname> to on
|
||||||
|
the appropriate location. Thus the <emphasis>then</emphasis> part will
|
||||||
|
only be used if all conditions declared with <varname>mkIf</varname>
|
||||||
|
are satisfied.</para>
|
||||||
|
|
||||||
|
</callout>
|
||||||
|
|
||||||
|
</calloutlist>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
<title>Building specific parts of NixOS</title>
|
<title>Building specific parts of NixOS</title>
|
||||||
|
@ -4,6 +4,7 @@ use File::Spec;
|
|||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
|
||||||
|
|
||||||
|
my @requireList = ();
|
||||||
my @kernelModules = ();
|
my @kernelModules = ();
|
||||||
my @initrdKernelModules = ();
|
my @initrdKernelModules = ();
|
||||||
|
|
||||||
@ -56,8 +57,6 @@ push @kernelModules, "kvm-amd" if hasCPUFeature "svm";
|
|||||||
# modules are auto-detected so we don't need to list them here.
|
# modules are auto-detected so we don't need to list them here.
|
||||||
# However, some are needed in the initrd to boot the system.
|
# However, some are needed in the initrd to boot the system.
|
||||||
|
|
||||||
my $enableIntel2200BGFirmware = "false";
|
|
||||||
my $enableIntel3945ABGFirmware = "false";
|
|
||||||
my $videoDriver = "vesa";
|
my $videoDriver = "vesa";
|
||||||
|
|
||||||
sub pciCheck {
|
sub pciCheck {
|
||||||
@ -97,11 +96,13 @@ sub pciCheck {
|
|||||||
# Can't rely on $module here, since the module may not be loaded
|
# Can't rely on $module here, since the module may not be loaded
|
||||||
# due to missing firmware. Ideally we would check modules.pcimap
|
# due to missing firmware. Ideally we would check modules.pcimap
|
||||||
# here.
|
# here.
|
||||||
$enableIntel2200BGFirmware = "true" if $vendor eq "0x8086" &&
|
push @requireList, "(import ./configurations/hardware/network/Intel2200BG.nix)" if
|
||||||
|
$vendor eq "0x8086" &&
|
||||||
($device eq "0x1043" || $device eq "0x104f" || $device eq "0x4220" ||
|
($device eq "0x1043" || $device eq "0x104f" || $device eq "0x4220" ||
|
||||||
$device eq "0x4221" || $device eq "0x4223" || $device eq "0x4224");
|
$device eq "0x4221" || $device eq "0x4223" || $device eq "0x4224");
|
||||||
|
|
||||||
$enableIntel3945ABGFirmware = "true" if $vendor eq "0x8086" &&
|
push @requireList, "(import ./configurations/hardware/network/Intel3945ABG.nix)" if
|
||||||
|
$vendor eq "0x8086" &&
|
||||||
($device eq "0x4229" || $device eq "0x4230" ||
|
($device eq "0x4229" || $device eq "0x4230" ||
|
||||||
$device eq "0x4222" || $device eq "0x4227");
|
$device eq "0x4222" || $device eq "0x4227");
|
||||||
|
|
||||||
@ -197,14 +198,26 @@ sub toNixExpr {
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub multiLineList {
|
||||||
|
my $indent = shift;
|
||||||
|
my $res = "";
|
||||||
|
foreach my $s (@_) {
|
||||||
|
$res .= "\n$indent $s";
|
||||||
|
}
|
||||||
|
$res .= "\nindent";
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
my $initrdKernelModules = toNixExpr(removeDups @initrdKernelModules);
|
my $initrdKernelModules = toNixExpr(removeDups @initrdKernelModules);
|
||||||
my $kernelModules = toNixExpr(removeDups @kernelModules);
|
my $kernelModules = toNixExpr(removeDups @kernelModules);
|
||||||
|
my $requireList = multiLineList(" ", removeDups @requireList);
|
||||||
|
|
||||||
## This is a generated file. Do not modify!
|
## This is a generated file. Do not modify!
|
||||||
## Make changes to /etc/nixos/configuration.nix instead.
|
## Make changes to /etc/nixos/configuration.nix instead.
|
||||||
print <<EOF ;
|
print <<EOF ;
|
||||||
{
|
{
|
||||||
|
require = [$requireList];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
initrd = {
|
initrd = {
|
||||||
extraKernelModules = [ $initrdKernelModules ];
|
extraKernelModules = [ $initrdKernelModules ];
|
||||||
@ -216,12 +229,15 @@ print <<EOF ;
|
|||||||
maxJobs = $cpus;
|
maxJobs = $cpus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# list of file systems which can be mounted.
|
||||||
|
fileSystems = [
|
||||||
|
];
|
||||||
|
|
||||||
|
# list of swap devices.
|
||||||
|
swapDevices = [
|
||||||
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
enableIntel3945ABGFirmware = $enableIntel3945ABGFirmware;
|
|
||||||
|
|
||||||
# Warning: setting this option to `true' requires acceptance of the
|
|
||||||
# firmware license, see http://ipw2200.sourceforge.net/firmware.php?fid=7.
|
|
||||||
enableIntel2200BGFirmware = $enableIntel2200BGFirmware;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
@ -229,7 +245,7 @@ print <<EOF ;
|
|||||||
xserver = {
|
xserver = {
|
||||||
videoDriver = "$videoDriver";
|
videoDriver = "$videoDriver";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
164
system/kernel.nix
Normal file
164
system/kernel.nix
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
boot = {
|
||||||
|
kernelPackages = mkOption {
|
||||||
|
default = pkgs.kernelPackages;
|
||||||
|
example = pkgs.kernelPackages_2_6_25;
|
||||||
|
description = "
|
||||||
|
This option allows you to override the Linux kernel used by
|
||||||
|
NixOS. Since things like external kernel module packages are
|
||||||
|
tied to the kernel you're using, it also overrides those.
|
||||||
|
This option is a function that takes Nixpkgs as an argument
|
||||||
|
(as a convenience), and returns an attribute set containing at
|
||||||
|
the very least an attribute <varname>kernel</varname>.
|
||||||
|
Additional attributes may be needed depending on your
|
||||||
|
configuration. For instance, if you use the NVIDIA X driver,
|
||||||
|
then it also needs to contain an attribute
|
||||||
|
<varname>nvidiaDrivers</varname>.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
kernelParams = mkOption {
|
||||||
|
default = [
|
||||||
|
"selinux=0"
|
||||||
|
"apm=on"
|
||||||
|
"acpi=on"
|
||||||
|
"vga=0x317"
|
||||||
|
"console=tty1"
|
||||||
|
"splash=verbose"
|
||||||
|
];
|
||||||
|
description = "
|
||||||
|
The kernel parameters. If you want to add additional
|
||||||
|
parameters, it's best to set
|
||||||
|
<option>boot.extraKernelParams</option>.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraKernelParams = mkOption {
|
||||||
|
default = [
|
||||||
|
];
|
||||||
|
example = [
|
||||||
|
"debugtrace"
|
||||||
|
];
|
||||||
|
description = "
|
||||||
|
Additional user-defined kernel parameters.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraModulePackages = mkOption {
|
||||||
|
default = [];
|
||||||
|
# !!! example = [pkgs.aufs pkgs.nvidiaDrivers];
|
||||||
|
description = ''
|
||||||
|
A list of additional packages supplying kernel modules.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
kernelModules = mkOption {
|
||||||
|
default = [];
|
||||||
|
description = "
|
||||||
|
The set of kernel modules to be loaded in the second stage of
|
||||||
|
the boot process. That is, these modules are not included in
|
||||||
|
the initial ramdisk, so they'd better not be required for
|
||||||
|
mounting the root file system. Add them to
|
||||||
|
<option>boot.initrd.extraKernelModules</option> if they are.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
initrd = {
|
||||||
|
|
||||||
|
kernelModules = mkOption {
|
||||||
|
default = [
|
||||||
|
# Note: most of these (especially the SATA/PATA modules)
|
||||||
|
# shouldn't be included by default since nixos-hardware-scan
|
||||||
|
# detects them, but I'm keeping them for now for backwards
|
||||||
|
# compatibility.
|
||||||
|
|
||||||
|
# Some SATA/PATA stuff.
|
||||||
|
"ahci"
|
||||||
|
"sata_nv"
|
||||||
|
"sata_via"
|
||||||
|
"sata_sis"
|
||||||
|
"sata_uli"
|
||||||
|
"ata_piix"
|
||||||
|
"pata_marvell"
|
||||||
|
|
||||||
|
# Standard SCSI stuff.
|
||||||
|
"sd_mod"
|
||||||
|
"sr_mod"
|
||||||
|
|
||||||
|
# Standard IDE stuff.
|
||||||
|
"ide_cd"
|
||||||
|
"ide_disk"
|
||||||
|
"ide_generic"
|
||||||
|
|
||||||
|
# Filesystems.
|
||||||
|
"ext3"
|
||||||
|
|
||||||
|
# Support USB keyboards, in case the boot fails and we only have
|
||||||
|
# a USB keyboard.
|
||||||
|
"ehci_hcd"
|
||||||
|
"ohci_hcd"
|
||||||
|
"usbhid"
|
||||||
|
|
||||||
|
# LVM.
|
||||||
|
"dm_mod"
|
||||||
|
];
|
||||||
|
description = "
|
||||||
|
The set of kernel modules in the initial ramdisk used during the
|
||||||
|
boot process. This set must include all modules necessary for
|
||||||
|
mounting the root device. That is, it should include modules
|
||||||
|
for the physical device (e.g., SCSI drivers) and for the file
|
||||||
|
system (e.g., ext3). The set specified here is automatically
|
||||||
|
closed under the module dependency relation, i.e., all
|
||||||
|
dependencies of the modules list here are included
|
||||||
|
automatically. If you want to add additional
|
||||||
|
modules, it's best to set
|
||||||
|
<option>boot.initrd.extraKernelModules</option>.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraKernelModules = mkOption {
|
||||||
|
default = [];
|
||||||
|
description = "
|
||||||
|
Additional kernel modules for the initial ramdisk. These are
|
||||||
|
loaded before the modules listed in
|
||||||
|
<option>boot.initrd.kernelModules</option>, so they take
|
||||||
|
precedence.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
let
|
||||||
|
kernelPackages = config.boot.kernelPackages;
|
||||||
|
kernel = kernelPackages.kernel;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = [
|
||||||
|
options
|
||||||
|
|
||||||
|
# udev
|
||||||
|
];
|
||||||
|
|
||||||
|
system = {
|
||||||
|
# include kernel modules.
|
||||||
|
modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
udev = {
|
||||||
|
# The Linux kernel >= 2.6.27 provides firmware
|
||||||
|
addFirmware = [ "${kernel}/lib/firmware" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -1,33 +1,7 @@
|
|||||||
{pkgs, config, ...}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs.lib) mkOption;
|
inherit (pkgs.lib) mkOption mergeOneOption;
|
||||||
inherit (builtins) head tail;
|
|
||||||
|
|
||||||
obsolete = what: f: name:
|
|
||||||
if builtins ? trace then
|
|
||||||
builtins.trace "${name}: Obsolete ${what}." f name
|
|
||||||
else f name;
|
|
||||||
|
|
||||||
obsoleteMerge =
|
|
||||||
obsolete "option" pkgs.lib.mergeDefaultOption;
|
|
||||||
|
|
||||||
# temporary modifications.
|
|
||||||
# backward here means that expression could either be a value or a
|
|
||||||
# function which expects to have a pkgs argument.
|
|
||||||
optionalPkgs = name: x:
|
|
||||||
if builtins.isFunction x
|
|
||||||
then obsolete "notation" (name: x pkgs) name
|
|
||||||
else x;
|
|
||||||
|
|
||||||
backwardPkgsFunListMerge = name: list:
|
|
||||||
pkgs.lib.concatMap (optionalPkgs name) list;
|
|
||||||
|
|
||||||
backwardPkgsFunMerge = name: list:
|
|
||||||
if list != [] && tail list == []
|
|
||||||
then optionalPkgs name (head list)
|
|
||||||
else abort "${name}: Defined at least twice.";
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -64,51 +38,6 @@ in
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelPackages = mkOption {
|
|
||||||
default = pkgs.kernelPackages;
|
|
||||||
example = pkgs.kernelPackages_2_6_25;
|
|
||||||
merge = backwardPkgsFunMerge;
|
|
||||||
description = "
|
|
||||||
This option allows you to override the Linux kernel used by
|
|
||||||
NixOS. Since things like external kernel module packages are
|
|
||||||
tied to the kernel you're using, it also overrides those.
|
|
||||||
This option is a function that takes Nixpkgs as an argument
|
|
||||||
(as a convenience), and returns an attribute set containing at
|
|
||||||
the very least an attribute <varname>kernel</varname>.
|
|
||||||
Additional attributes may be needed depending on your
|
|
||||||
configuration. For instance, if you use the NVIDIA X driver,
|
|
||||||
then it also needs to contain an attribute
|
|
||||||
<varname>nvidiaDrivers</varname>.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
kernelParams = mkOption {
|
|
||||||
default = [
|
|
||||||
"selinux=0"
|
|
||||||
"apm=on"
|
|
||||||
"acpi=on"
|
|
||||||
"vga=0x317"
|
|
||||||
"console=tty1"
|
|
||||||
"splash=verbose"
|
|
||||||
];
|
|
||||||
description = "
|
|
||||||
The kernel parameters. If you want to add additional
|
|
||||||
parameters, it's best to set
|
|
||||||
<option>boot.extraKernelParams</option>.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
extraKernelParams = mkOption {
|
|
||||||
default = [
|
|
||||||
];
|
|
||||||
example = [
|
|
||||||
"debugtrace"
|
|
||||||
];
|
|
||||||
description = "
|
|
||||||
Additional user-defined kernel parameters.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
hardwareScan = mkOption {
|
hardwareScan = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
description = "
|
description = "
|
||||||
@ -121,89 +50,8 @@ in
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraModulePackages = mkOption {
|
|
||||||
default = [];
|
|
||||||
# !!! example = [pkgs.aufs pkgs.nvidiaDrivers];
|
|
||||||
description = ''
|
|
||||||
A list of additional packages supplying kernel modules.
|
|
||||||
'';
|
|
||||||
merge = backwardPkgsFunListMerge;
|
|
||||||
};
|
|
||||||
|
|
||||||
kernelModules = mkOption {
|
|
||||||
default = [];
|
|
||||||
description = "
|
|
||||||
The set of kernel modules to be loaded in the second stage of
|
|
||||||
the boot process. That is, these modules are not included in
|
|
||||||
the initial ramdisk, so they'd better not be required for
|
|
||||||
mounting the root file system. Add them to
|
|
||||||
<option>boot.initrd.extraKernelModules</option> if they are.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
initrd = {
|
initrd = {
|
||||||
|
|
||||||
kernelModules = mkOption {
|
|
||||||
default = [
|
|
||||||
# Note: most of these (especially the SATA/PATA modules)
|
|
||||||
# shouldn't be included by default since nixos-hardware-scan
|
|
||||||
# detects them, but I'm keeping them for now for backwards
|
|
||||||
# compatibility.
|
|
||||||
|
|
||||||
# Some SATA/PATA stuff.
|
|
||||||
"ahci"
|
|
||||||
"sata_nv"
|
|
||||||
"sata_via"
|
|
||||||
"sata_sis"
|
|
||||||
"sata_uli"
|
|
||||||
"ata_piix"
|
|
||||||
"pata_marvell"
|
|
||||||
|
|
||||||
# Standard SCSI stuff.
|
|
||||||
"sd_mod"
|
|
||||||
"sr_mod"
|
|
||||||
|
|
||||||
# Standard IDE stuff.
|
|
||||||
"ide_cd"
|
|
||||||
"ide_disk"
|
|
||||||
"ide_generic"
|
|
||||||
|
|
||||||
# Filesystems.
|
|
||||||
"ext3"
|
|
||||||
|
|
||||||
# Support USB keyboards, in case the boot fails and we only have
|
|
||||||
# a USB keyboard.
|
|
||||||
"ehci_hcd"
|
|
||||||
"ohci_hcd"
|
|
||||||
"usbhid"
|
|
||||||
|
|
||||||
# LVM.
|
|
||||||
"dm_mod"
|
|
||||||
];
|
|
||||||
description = "
|
|
||||||
The set of kernel modules in the initial ramdisk used during the
|
|
||||||
boot process. This set must include all modules necessary for
|
|
||||||
mounting the root device. That is, it should include modules
|
|
||||||
for the physical device (e.g., SCSI drivers) and for the file
|
|
||||||
system (e.g., ext3). The set specified here is automatically
|
|
||||||
closed under the module dependency relation, i.e., all
|
|
||||||
dependencies of the modules list here are included
|
|
||||||
automatically. If you want to add additional
|
|
||||||
modules, it's best to set
|
|
||||||
<option>boot.initrd.extraKernelModules</option>.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
extraKernelModules = mkOption {
|
|
||||||
default = [];
|
|
||||||
description = "
|
|
||||||
Additional kernel modules for the initial ramdisk. These are
|
|
||||||
loaded before the modules listed in
|
|
||||||
<option>boot.initrd.kernelModules</option>, so they take
|
|
||||||
precedence.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
allowMissing = mkOption {
|
allowMissing = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
@ -295,17 +143,7 @@ in
|
|||||||
merge = pkgs.lib.mergeListOption;
|
merge = pkgs.lib.mergeListOption;
|
||||||
|
|
||||||
# Convert the list of path to only one path.
|
# Convert the list of path to only one path.
|
||||||
apply = list: pkgs.aggregateModules (
|
apply = pkgs.aggregateModules;
|
||||||
let
|
|
||||||
kernelPackages = config.boot.kernelPackages;
|
|
||||||
kernel = kernelPackages.kernel;
|
|
||||||
in
|
|
||||||
[ kernel ]
|
|
||||||
++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
|
|
||||||
++ config.boot.extraModulePackages
|
|
||||||
# should only keep this one, other have to be set by the option owners.
|
|
||||||
++ list
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sbin = {
|
sbin = {
|
||||||
@ -345,21 +183,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Hm, this sounds like a catch-all...
|
|
||||||
hardware = {
|
|
||||||
|
|
||||||
enableGo7007 = mkOption {
|
|
||||||
default = false;
|
|
||||||
merge = obsoleteMerge;
|
|
||||||
description = ''
|
|
||||||
Enable this option to get support for the WIS GO7007SB
|
|
||||||
multi-format video encoder, which is used in a number of
|
|
||||||
devices such as the Plextor ConvertX TV402U USB TV device.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|
||||||
@ -411,45 +234,6 @@ in
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
enableIntel2200BGFirmware = mkOption {
|
|
||||||
default = false;
|
|
||||||
merge = obsoleteMerge;
|
|
||||||
description = "
|
|
||||||
Turn on this option if you want firmware for the Intel
|
|
||||||
PRO/Wireless 2200BG to be loaded automatically. This is
|
|
||||||
required if you want to use this device. Intel requires you to
|
|
||||||
accept the license for this firmware, see
|
|
||||||
<link xlink:href='http://ipw2200.sourceforge.net/firmware.php?fid=7'/>.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
enableIntel3945ABGFirmware = mkOption {
|
|
||||||
default = false;
|
|
||||||
merge = obsoleteMerge;
|
|
||||||
description = "
|
|
||||||
This option enables automatic loading of the firmware for the Intel
|
|
||||||
PRO/Wireless 3945ABG.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
enableIntel4965AGNFirmware = mkOption {
|
|
||||||
default = false;
|
|
||||||
merge = obsoleteMerge;
|
|
||||||
description = "
|
|
||||||
This option enables automatic loading of the firmware for the Intel
|
|
||||||
PRO/Wireless 4965AGN.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
enableZydasZD1211Firmware = mkOption {
|
|
||||||
default = false;
|
|
||||||
merge = obsoleteMerge;
|
|
||||||
description = "
|
|
||||||
This option enables automatic loading of the firmware for the Zydas
|
|
||||||
ZyDAS ZD1211(b) 802.11a/b/g USB WLAN chip.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
localCommands = mkOption {
|
localCommands = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = "text=anything; echo You can put $text here.";
|
example = "text=anything; echo You can put $text here.";
|
||||||
@ -2346,7 +2130,6 @@ in
|
|||||||
extraPackages = mkOption {
|
extraPackages = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
example = [pkgs.firefox pkgs.thunderbird];
|
example = [pkgs.firefox pkgs.thunderbird];
|
||||||
merge = backwardPkgsFunListMerge;
|
|
||||||
description = "
|
description = "
|
||||||
This option allows you to add additional packages to the system
|
This option allows you to add additional packages to the system
|
||||||
path. These packages are automatically available to all users,
|
path. These packages are automatically available to all users,
|
||||||
@ -2363,7 +2146,7 @@ in
|
|||||||
nix = mkOption {
|
nix = mkOption {
|
||||||
default = pkgs.nixUnstable;
|
default = pkgs.nixUnstable;
|
||||||
example = pkgs.nixCustomFun /root/nix.tar.gz;
|
example = pkgs.nixCustomFun /root/nix.tar.gz;
|
||||||
merge = backwardPkgsFunMerge;
|
merge = mergeOneOption;
|
||||||
description = "
|
description = "
|
||||||
Use non-default Nix easily. Be careful, though, not to break everything.
|
Use non-default Nix easily. Be careful, though, not to break everything.
|
||||||
";
|
";
|
||||||
@ -2405,6 +2188,7 @@ in
|
|||||||
|
|
||||||
require = [
|
require = [
|
||||||
# boot (is it the right place ?)
|
# boot (is it the right place ?)
|
||||||
|
(import ../system/kernel.nix)
|
||||||
(import ../boot/boot-stage-2.nix)
|
(import ../boot/boot-stage-2.nix)
|
||||||
(import ../installer/grub.nix)
|
(import ../installer/grub.nix)
|
||||||
|
|
||||||
@ -2435,7 +2219,7 @@ in
|
|||||||
(import ../upstart-jobs/hal.nix)
|
(import ../upstart-jobs/hal.nix)
|
||||||
(import ../upstart-jobs/gpm.nix)
|
(import ../upstart-jobs/gpm.nix)
|
||||||
(import ../upstart-jobs/nagios/default.nix)
|
(import ../upstart-jobs/nagios/default.nix)
|
||||||
(import ../upstart-jobs/xserver.nix)
|
(import ../upstart-jobs/xserver/default.nix)
|
||||||
(import ../upstart-jobs/zabbix-agent.nix)
|
(import ../upstart-jobs/zabbix-agent.nix)
|
||||||
(import ../upstart-jobs/zabbix-server.nix)
|
(import ../upstart-jobs/zabbix-server.nix)
|
||||||
(import ../upstart-jobs/disnix.nix)
|
(import ../upstart-jobs/disnix.nix)
|
||||||
|
@ -287,7 +287,7 @@ in
|
|||||||
# Set the host name. Don't clear it if it's not configured in the
|
# Set the host name. Don't clear it if it's not configured in the
|
||||||
# NixOS configuration, since it may have been set by dhclient in the
|
# NixOS configuration, since it may have been set by dhclient in the
|
||||||
# meantime.
|
# meantime.
|
||||||
${if config.networking.hostName == "" then
|
${if config.networking.hostName != "" then
|
||||||
''hostname "${config.networking.hostName}"''
|
''hostname "${config.networking.hostName}"''
|
||||||
else ''
|
else ''
|
||||||
# dhclient won't do anything if the hostname isn't empty.
|
# dhclient won't do anything if the hostname isn't empty.
|
||||||
|
@ -11,14 +11,11 @@ rec {
|
|||||||
systemPathList
|
systemPathList
|
||||||
];
|
];
|
||||||
|
|
||||||
noOption = name: values:
|
|
||||||
abort "${name}: Used without option declaration.";
|
|
||||||
|
|
||||||
# Make a configuration object from which we can retrieve option
|
# Make a configuration object from which we can retrieve option
|
||||||
# values.
|
# values.
|
||||||
config =
|
config =
|
||||||
pkgs.lib.fixOptionSets
|
pkgs.lib.fixOptionSets
|
||||||
(pkgs.lib.mergeOptionSets noOption)
|
pkgs.lib.newMergeOptionSets
|
||||||
pkgs configComponents;
|
pkgs configComponents;
|
||||||
|
|
||||||
optionDeclarations =
|
optionDeclarations =
|
||||||
@ -158,7 +155,6 @@ rec {
|
|||||||
++ pkgs.lib.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
|
++ pkgs.lib.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
|
||||||
++ config.environment.extraPackages
|
++ config.environment.extraPackages
|
||||||
++ pkgs.lib.optional config.fonts.enableFontDir fontDir
|
++ pkgs.lib.optional config.fonts.enableFontDir fontDir
|
||||||
++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
|
|
||||||
|
|
||||||
# NSS modules need to be in `systemPath' so that (i) the builder
|
# NSS modules need to be in `systemPath' so that (i) the builder
|
||||||
# chroot gets to seem them, and (ii) applications can benefit from
|
# chroot gets to seem them, and (ii) applications can benefit from
|
||||||
|
@ -147,16 +147,8 @@ let
|
|||||||
inherit modprobe config;
|
inherit modprobe config;
|
||||||
inherit (pkgs) stdenv writeText substituteAll udev procps;
|
inherit (pkgs) stdenv writeText substituteAll udev procps;
|
||||||
inherit (pkgs.lib) cleanSource;
|
inherit (pkgs.lib) cleanSource;
|
||||||
firmwareDirs =
|
firmwareDirs = config.services.udev.addFirmware;
|
||||||
pkgs.lib.optional config.networking.enableIntel2200BGFirmware pkgs.ipw2200fw
|
extraUdevPkgs = config.services.udev.addUdevPkgs;
|
||||||
++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi3945ucode
|
|
||||||
++ pkgs.lib.optional config.networking.enableIntel4965AGNFirmware kernelPackages.iwlwifi4965ucode
|
|
||||||
++ pkgs.lib.optional config.networking.enableZydasZD1211Firmware pkgs.zd1211fw
|
|
||||||
++ pkgs.lib.optional config.hardware.enableGo7007 "${kernelPackages.wis_go7007}/firmware"
|
|
||||||
++ config.services.udev.addFirmware;
|
|
||||||
extraUdevPkgs =
|
|
||||||
pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
|
|
||||||
++ config.services.udev.addUdevPkgs;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# Makes LVM logical volumes available.
|
# Makes LVM logical volumes available.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Disnix server
|
# Disnix server
|
||||||
{config, pkgs}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
let
|
let
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{pkgs, config}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
let
|
let
|
||||||
|
@ -66,6 +66,7 @@ let
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
sessionType = mkOption {
|
sessionType = mkOption {
|
||||||
default = "gnome";
|
default = "gnome";
|
||||||
example = "xterm";
|
example = "xterm";
|
||||||
@ -91,14 +92,6 @@ let
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
renderingFlag = mkOption {
|
|
||||||
default = "";
|
|
||||||
example = "--indirect-rendering";
|
|
||||||
description = "
|
|
||||||
Possibly pass --indierct-rendering to Compiz.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
sessionStarter = mkOption {
|
sessionStarter = mkOption {
|
||||||
example = "${pkgs.xterm}/bin/xterm -ls";
|
example = "${pkgs.xterm}/bin/xterm -ls";
|
||||||
description = "
|
description = "
|
||||||
@ -107,6 +100,7 @@ let
|
|||||||
<option>services.xserver.sessionType</option> is empty.
|
<option>services.xserver.sessionType</option> is empty.
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
startSSHAgent = mkOption {
|
startSSHAgent = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
@ -118,41 +112,6 @@ let
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
slim = {
|
|
||||||
|
|
||||||
theme = mkOption {
|
|
||||||
default = null;
|
|
||||||
example = pkgs.fetchurl {
|
|
||||||
url = http://download.berlios.de/slim/slim-wave.tar.gz;
|
|
||||||
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
|
|
||||||
};
|
|
||||||
description = "
|
|
||||||
The theme for the SLiM login manager. If not specified, SLiM's
|
|
||||||
default theme is used. See <link
|
|
||||||
xlink:href='http://slim.berlios.de/themes01.php'/> for a
|
|
||||||
collection of themes.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultUser = mkOption {
|
|
||||||
default = "";
|
|
||||||
example = "login";
|
|
||||||
description = "
|
|
||||||
The default user to load. If you put a username here you
|
|
||||||
get it automatically loaded into the username field, and
|
|
||||||
the focus is placed on the password.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
|
|
||||||
hideCursor = mkOption {
|
|
||||||
default = false;
|
|
||||||
example = true;
|
|
||||||
description = "
|
|
||||||
Hide the mouse cursor on the login screen.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
isClone = mkOption {
|
isClone = mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
example = false;
|
||||||
@ -327,7 +286,6 @@ let
|
|||||||
# Abbreviations.
|
# Abbreviations.
|
||||||
cfg = config.services.xserver;
|
cfg = config.services.xserver;
|
||||||
xorg = cfg.package;
|
xorg = cfg.package;
|
||||||
gnome = pkgs.gnome;
|
|
||||||
stdenv = pkgs.stdenv;
|
stdenv = pkgs.stdenv;
|
||||||
|
|
||||||
knownVideoDrivers = {
|
knownVideoDrivers = {
|
||||||
@ -344,25 +302,9 @@ let
|
|||||||
# Get a bunch of user settings.
|
# Get a bunch of user settings.
|
||||||
videoDriver = cfg.videoDriver;
|
videoDriver = cfg.videoDriver;
|
||||||
resolutions = map (res: ''"${toString res.x}x${toString res.y}"'') (cfg.resolutions);
|
resolutions = map (res: ''"${toString res.x}x${toString res.y}"'') (cfg.resolutions);
|
||||||
sessionType = cfg.sessionType;
|
|
||||||
|
|
||||||
videoDriverModules = getAttr [ videoDriver ] (throw "unkown video driver : \"${videoDriver}\"") knownVideoDrivers;
|
videoDriverModules = getAttr [ videoDriver ] (throw "unkown video driver : \"${videoDriver}\"") knownVideoDrivers;
|
||||||
|
|
||||||
sessionCmd =
|
|
||||||
if sessionType == "" then cfg.sessionStarter else
|
|
||||||
if sessionType == "xterm" then "${pkgs.xterm}/bin/xterm -ls" else
|
|
||||||
if sessionType == "gnome" then "${gnome.gnometerminal}/bin/gnome-terminal -ls" else
|
|
||||||
abort ("unknown session type ${sessionType}");
|
|
||||||
|
|
||||||
|
|
||||||
windowManager =
|
|
||||||
let wm = cfg.windowManager; in
|
|
||||||
if wm != "" then wm else
|
|
||||||
if sessionType == "gnome" then "metacity" else
|
|
||||||
if sessionType == "kde" then "none" /* started by startkde */ else
|
|
||||||
"twm";
|
|
||||||
|
|
||||||
|
|
||||||
modules =
|
modules =
|
||||||
|
|
||||||
getAttr ["modulesFirst"] [] videoDriverModules
|
getAttr ["modulesFirst"] [] videoDriverModules
|
||||||
@ -518,240 +460,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
clientScript = pkgs.writeText "xclient" ''
|
nvidiaDrivers = (config.boot.kernelPackages pkgs).nvidiaDrivers;
|
||||||
|
|
||||||
source /etc/profile
|
|
||||||
|
|
||||||
exec > $HOME/.Xerrors 2>&1
|
|
||||||
|
|
||||||
|
|
||||||
### Load X defaults.
|
|
||||||
if test -e ~/.Xdefaults; then
|
|
||||||
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
${if cfg.startSSHAgent then ''
|
|
||||||
### Start the SSH agent.
|
|
||||||
export SSH_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
|
|
||||||
eval $(${pkgs.openssh}/bin/ssh-agent)
|
|
||||||
'' else ""}
|
|
||||||
|
|
||||||
### Allow user to override system-wide configuration
|
|
||||||
if test -f ~/.xsession; then
|
|
||||||
source ~/.xsession;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
### Start a window manager.
|
|
||||||
|
|
||||||
${if windowManager == "twm" then ''
|
|
||||||
${xorg.twm}/bin/twm &
|
|
||||||
''
|
|
||||||
|
|
||||||
else if windowManager == "metacity" then ''
|
|
||||||
env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/
|
|
||||||
# !!! Hack: load the schemas for Metacity.
|
|
||||||
GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \
|
|
||||||
--makefile-install-rule ${gnome.metacity}/etc/gconf/schemas/*.schemas # */
|
|
||||||
${gnome.metacity}/bin/metacity &
|
|
||||||
''
|
|
||||||
|
|
||||||
else if windowManager == "kwm" then ''
|
|
||||||
${pkgs.kdebase}/bin/kwin &
|
|
||||||
''
|
|
||||||
|
|
||||||
else if windowManager == "compiz" then ''
|
|
||||||
# !!! Hack: load the schemas for Compiz.
|
|
||||||
GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \
|
|
||||||
--makefile-install-rule ${pkgs.compiz}/etc/gconf/schemas/*.schemas # */
|
|
||||||
|
|
||||||
# !!! Hack: turn on most Compiz modules.
|
|
||||||
${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \
|
|
||||||
--set /apps/compiz/general/allscreens/options/active_plugins \
|
|
||||||
[gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water]
|
|
||||||
|
|
||||||
# Start Compiz and the GTK-style window decorator.
|
|
||||||
env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/
|
|
||||||
${pkgs.compiz}/bin/compiz gconf ${cfg.renderingFlag} &
|
|
||||||
${pkgs.compiz}/bin/gtk-window-decorator --sync &
|
|
||||||
''
|
|
||||||
|
|
||||||
else if windowManager == "xmonad" then ''
|
|
||||||
${pkgs.xmonad}/bin/xmonad &
|
|
||||||
''
|
|
||||||
|
|
||||||
else if windowManager == "none" then ''
|
|
||||||
# The session starter will start the window manager.
|
|
||||||
''
|
|
||||||
|
|
||||||
else abort ("unknown window manager " + windowManager)}
|
|
||||||
|
|
||||||
|
|
||||||
### Show a background image.
|
|
||||||
# (but not if we're starting a full desktop environment that does it for us)
|
|
||||||
${if sessionType != "kde" then ''
|
|
||||||
|
|
||||||
if test -e $HOME/.background-image; then
|
|
||||||
${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image
|
|
||||||
fi
|
|
||||||
|
|
||||||
'' else ""}
|
|
||||||
|
|
||||||
|
|
||||||
### Start the session.
|
|
||||||
${if sessionType == "kde" then ''
|
|
||||||
|
|
||||||
# Start KDE.
|
|
||||||
export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${pkgs.kdebase}:${pkgs.kdelibs}
|
|
||||||
export XDG_CONFIG_DIRS=${pkgs.kdebase}/etc/xdg:${pkgs.kdelibs}/etc/xdg
|
|
||||||
export XDG_DATA_DIRS=${pkgs.kdebase}/share
|
|
||||||
exec ${pkgs.kdebase}/bin/startkde
|
|
||||||
|
|
||||||
'' else ''
|
|
||||||
|
|
||||||
# For all other session types, we currently just start a
|
|
||||||
# terminal of the kind indicated by sessionCmd.
|
|
||||||
# !!! yes, this means that you 'log out' by killing the X server.
|
|
||||||
while ${sessionCmd}; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
''}
|
|
||||||
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
|
||||||
xserverArgs = [
|
|
||||||
"-ac"
|
|
||||||
"-logverbose"
|
|
||||||
"-verbose"
|
|
||||||
"-terminate"
|
|
||||||
"-logfile" "/var/log/X.${toString cfg.display}.log"
|
|
||||||
"-config ${configFile}"
|
|
||||||
":${toString cfg.display}" "vt${toString cfg.tty}"
|
|
||||||
"-xkbdir" "${pkgs.xkeyboard_config}/etc/X11/xkb"
|
|
||||||
] ++ optional (!config.services.xserver.tcpEnable) "-nolisten tcp";
|
|
||||||
|
|
||||||
|
|
||||||
slimConfig = pkgs.writeText "slim.cfg" ''
|
|
||||||
xauth_path ${xorg.xauth}/bin/xauth
|
|
||||||
default_xserver ${xorg.xorgserver}/bin/X
|
|
||||||
xserver_arguments ${toString xserverArgs}
|
|
||||||
login_cmd exec ${stdenv.bash}/bin/sh ${clientScript}
|
|
||||||
halt_cmd ${pkgs.upstart}/sbin/shutdown -h now
|
|
||||||
reboot_cmd ${pkgs.upstart}/sbin/shutdown -r now
|
|
||||||
${if cfg.slim.defaultUser != "" then "default_user " + cfg.slim.defaultUser else ""}
|
|
||||||
${if cfg.slim.hideCursor then "hidecursor true" else ""}
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
|
||||||
# Unpack the SLiM theme, or use the default.
|
|
||||||
slimThemesDir =
|
|
||||||
let
|
|
||||||
unpackedTheme = stdenv.mkDerivation {
|
|
||||||
name = "slim-theme";
|
|
||||||
buildCommand = ''
|
|
||||||
ensureDir $out
|
|
||||||
cd $out
|
|
||||||
unpackFile ${cfg.slim.theme}
|
|
||||||
ln -s * default
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in if cfg.slim.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
|
|
||||||
|
|
||||||
nvidiaDrivers = (config.boot.kernelPackages pkgs).nvidiaDrivers;
|
|
||||||
|
|
||||||
oldJob = rec {
|
|
||||||
# Warning the indentation is wrong since here in order to don't produce noise in diffs.
|
|
||||||
|
|
||||||
name = "xserver";
|
|
||||||
|
|
||||||
|
|
||||||
extraPath = [
|
|
||||||
xorg.xrandr
|
|
||||||
xorg.xrdb
|
|
||||||
xorg.setxkbmap
|
|
||||||
xorg.iceauth # required for KDE applications (it's called by dcopserver)
|
|
||||||
pkgs.feh
|
|
||||||
]
|
|
||||||
++ optional (windowManager == "twm") [
|
|
||||||
xorg.twm
|
|
||||||
]
|
|
||||||
++ optional (windowManager == "metacity") [
|
|
||||||
gnome.metacity
|
|
||||||
]
|
|
||||||
++ optional (windowManager == "compiz") [
|
|
||||||
pkgs.compiz
|
|
||||||
]
|
|
||||||
++ optional (sessionType == "xterm") [
|
|
||||||
pkgs.xterm
|
|
||||||
]
|
|
||||||
++ optional (sessionType == "gnome") [
|
|
||||||
gnome.gnometerminal
|
|
||||||
gnome.GConf
|
|
||||||
gnome.gconfeditor
|
|
||||||
]
|
|
||||||
++ optional (sessionType == "kde") [
|
|
||||||
pkgs.kdelibs
|
|
||||||
pkgs.kdebase
|
|
||||||
xorg.xset # used by startkde, non-essential
|
|
||||||
]
|
|
||||||
++ optional (videoDriver == "nvidia") [
|
|
||||||
kernelPackages.nvidiaDrivers
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
extraEtc =
|
|
||||||
optional (sessionType == "kde")
|
|
||||||
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
|
||||||
target = "X11/xkb";
|
|
||||||
}
|
|
||||||
++
|
|
||||||
optional cfg.exportConfiguration
|
|
||||||
{ source = "${configFile}";
|
|
||||||
target = "X11/xorg.conf";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
job = ''
|
|
||||||
start on ${if cfg.autorun then "network-interfaces" else "never"}
|
|
||||||
|
|
||||||
start script
|
|
||||||
|
|
||||||
rm -f /var/run/opengl-driver
|
|
||||||
${if videoDriver == "nvidia"
|
|
||||||
then ''
|
|
||||||
ln -sf ${kernelPackages.nvidiaDrivers} /var/run/opengl-driver
|
|
||||||
''
|
|
||||||
else if cfg.driSupport
|
|
||||||
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
|
|
||||||
else ""
|
|
||||||
}
|
|
||||||
|
|
||||||
rm -f /var/log/slim.log
|
|
||||||
|
|
||||||
end script
|
|
||||||
|
|
||||||
env SLIM_CFGFILE=${slimConfig}
|
|
||||||
env SLIM_THEMESDIR=${slimThemesDir}
|
|
||||||
env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup
|
|
||||||
env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension.
|
|
||||||
|
|
||||||
${if videoDriver == "nvidia"
|
|
||||||
then "env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidiaDrivers}/lib"
|
|
||||||
else ""
|
|
||||||
}
|
|
||||||
|
|
||||||
${if videoDriver != "nvidia"
|
|
||||||
then "env XORG_DRI_DRIVER_PATH=${pkgs.mesa}/lib/modules/dri"
|
|
||||||
else ""
|
|
||||||
}
|
|
||||||
|
|
||||||
exec ${pkgs.slim}/bin/slim
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -759,14 +468,19 @@ mkIf cfg.enable {
|
|||||||
require = [
|
require = [
|
||||||
options
|
options
|
||||||
|
|
||||||
|
# services.xserver.*Manager
|
||||||
|
(import ./displayManager/default.nix)
|
||||||
|
(import ./windowManager/default.nix)
|
||||||
|
(import ./desktopManager/default.nix)
|
||||||
|
|
||||||
# services.extraJobs
|
# services.extraJobs
|
||||||
(import ../upstart-jobs/default.nix)
|
(import ../../upstart-jobs/default.nix)
|
||||||
|
|
||||||
# environment.etc
|
# environment.etc
|
||||||
(import ../etc/default.nix)
|
(import ../../etc/default.nix)
|
||||||
|
|
||||||
# fonts.fonts
|
# fonts.fonts
|
||||||
(import ../system/fonts.nix)
|
(import ../../system/fonts.nix)
|
||||||
|
|
||||||
# boot.extraModulePackages
|
# boot.extraModulePackages
|
||||||
# security.extraSetuidPrograms
|
# security.extraSetuidPrograms
|
||||||
@ -779,29 +493,77 @@ mkIf cfg.enable {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
security = {
|
environment = {
|
||||||
extraSetuidPrograms = mkIf (cfg.sessionType == "kde") [
|
etc = mkIf cfg.exportConfiguration [
|
||||||
"kcheckpass"
|
{ source = "${configFile}";
|
||||||
|
target = "X11/xorg.conf";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
extraPackages = [
|
||||||
|
xorg.xrandr
|
||||||
|
xorg.xrdb
|
||||||
|
xorg.setxkbmap
|
||||||
|
xorg.iceauth # required for KDE applications (it's called by dcopserver)
|
||||||
|
]
|
||||||
|
++ optional (videoDriver == "nvidia") [
|
||||||
|
kernelPackages.nvidiaDrivers
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
environment = {
|
|
||||||
etc = [
|
|
||||||
{ source = ../etc/pam.d/kde;
|
|
||||||
target = "pam.d/kde";
|
|
||||||
}
|
|
||||||
{ source = ../etc/pam.d/slim;
|
|
||||||
target = "pam.d/slim";
|
|
||||||
}
|
|
||||||
] ++ oldJob.extraEtc;
|
|
||||||
|
|
||||||
extraPackages =
|
|
||||||
oldJob.extraPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
xserver = {
|
||||||
|
displayManager = {
|
||||||
|
xserverArgs = [
|
||||||
|
"-ac"
|
||||||
|
"-logverbose"
|
||||||
|
"-verbose"
|
||||||
|
"-terminate"
|
||||||
|
"-logfile" "/var/log/X.${toString cfg.display}.log"
|
||||||
|
"-config ${configFile}"
|
||||||
|
":${toString cfg.display}" "vt${toString cfg.tty}"
|
||||||
|
"-xkbdir" "${pkgs.xkeyboard_config}/etc/X11/xkb"
|
||||||
|
] ++ optional (!cfg.tcpEnable) "-nolisten tcp";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
extraJobs = [{
|
extraJobs = [{
|
||||||
inherit (oldJob) name job;
|
name = "xserver";
|
||||||
|
job = ''
|
||||||
|
start on ${if cfg.autorun then "network-interfaces" else "never"}
|
||||||
|
|
||||||
|
start script
|
||||||
|
|
||||||
|
rm -f /var/run/opengl-driver
|
||||||
|
${if videoDriver == "nvidia"
|
||||||
|
then ''
|
||||||
|
ln -sf ${kernelPackages.nvidiaDrivers} /var/run/opengl-driver
|
||||||
|
''
|
||||||
|
else if cfg.driSupport
|
||||||
|
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
|
||||||
|
else ""
|
||||||
|
}
|
||||||
|
|
||||||
|
${cfg.displayManager.job.beforeScript}
|
||||||
|
|
||||||
|
end script
|
||||||
|
|
||||||
|
${cfg.displayManager.job.env}
|
||||||
|
env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup
|
||||||
|
env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension.
|
||||||
|
|
||||||
|
${if videoDriver == "nvidia"
|
||||||
|
then "env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidiaDrivers}/lib"
|
||||||
|
else ""
|
||||||
|
}
|
||||||
|
|
||||||
|
${if videoDriver != "nvidia"
|
||||||
|
then "env XORG_DRI_DRIVER_PATH=${pkgs.mesa}/lib/modules/dri"
|
||||||
|
else ""
|
||||||
|
}
|
||||||
|
|
||||||
|
exec ${cfg.displayManager.job.execCmd}
|
||||||
|
'';
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
}
|
}
|
73
upstart-jobs/xserver/desktopManager/default.nix
Normal file
73
upstart-jobs/xserver/desktopManager/default.nix
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mergeOneOption mkIf filter optionalString any;
|
||||||
|
cfg = config.services.xserver.desktopManager;
|
||||||
|
|
||||||
|
needBGCond = d: ! (d ? bgSupport && d.bgSupport);
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = [
|
||||||
|
(import ./kde.nix)
|
||||||
|
(import ./gnome.nix)
|
||||||
|
(import ./xterm.nix)
|
||||||
|
(import ./none.nix)
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
displayManager = {
|
||||||
|
session = cfg.session.list;
|
||||||
|
};
|
||||||
|
|
||||||
|
desktopManager = {
|
||||||
|
session = mkOption {
|
||||||
|
default = [];
|
||||||
|
example = [{
|
||||||
|
name = "kde";
|
||||||
|
bgSupport = true;
|
||||||
|
start = "...";
|
||||||
|
}];
|
||||||
|
description = "
|
||||||
|
Internal option used to add some common line to desktop manager
|
||||||
|
scripts before forwarding the value to the
|
||||||
|
<varname>displayManager</varname>.
|
||||||
|
";
|
||||||
|
apply = list: {
|
||||||
|
list = map (d: d // {
|
||||||
|
manage = "desktop";
|
||||||
|
start = d.start
|
||||||
|
+ optionalString (needBGCond d) ''
|
||||||
|
if test -e $HOME/.background-image; then
|
||||||
|
${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}) list;
|
||||||
|
needBGPackages = [] != filter needBGCond list;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
default = mkOption {
|
||||||
|
default = "xterm";
|
||||||
|
example = "none";
|
||||||
|
description = "
|
||||||
|
Default desktop manager loaded if none have been chosen.
|
||||||
|
";
|
||||||
|
merge = list:
|
||||||
|
let defaultDM = mergeOneOption list; in
|
||||||
|
if any (w: w.name == defaultDM) cfg.session.list then
|
||||||
|
defaultDM
|
||||||
|
else
|
||||||
|
throw "Default desktop manager not found.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = mkIf cfg.session.needBGPackages {
|
||||||
|
extraPackages = [ pkgs.feh ];
|
||||||
|
};
|
||||||
|
}
|
47
upstart-jobs/xserver/desktopManager/gnome.nix
Normal file
47
upstart-jobs/xserver/desktopManager/gnome.nix
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.desktopManager.gnome;
|
||||||
|
gnome = pkgs.gnome;
|
||||||
|
|
||||||
|
options = { services = { xserver = { desktopManager = {
|
||||||
|
|
||||||
|
gnome = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable a gnome terminal as a desktop manager.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = options;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
desktopManager = {
|
||||||
|
session = [{
|
||||||
|
name = "gnome";
|
||||||
|
start = ''
|
||||||
|
${gnome.gnometerminal}/bin/gnome-terminal -ls &
|
||||||
|
waitPID=$!
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [
|
||||||
|
gnome.gnometerminal
|
||||||
|
gnome.GConf
|
||||||
|
gnome.gconfeditor
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
65
upstart-jobs/xserver/desktopManager/kde.nix
Normal file
65
upstart-jobs/xserver/desktopManager/kde.nix
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.desktopManager.kde;
|
||||||
|
xorg = config.services.xserver.package;
|
||||||
|
|
||||||
|
options = { services = { xserver = { desktopManager = {
|
||||||
|
|
||||||
|
kde = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the kde desktop manager.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = options;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
desktopManager = {
|
||||||
|
session = [{
|
||||||
|
name = "kde";
|
||||||
|
start = ''
|
||||||
|
# Start KDE.
|
||||||
|
export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${pkgs.kdebase}:${pkgs.kdelibs}
|
||||||
|
export XDG_CONFIG_DIRS=${pkgs.kdebase}/etc/xdg:${pkgs.kdelibs}/etc/xdg
|
||||||
|
export XDG_DATA_DIRS=${pkgs.kdebase}/share
|
||||||
|
exec ${pkgs.kdebase}/bin/startkde
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
security = {
|
||||||
|
extraSetuidPrograms = [
|
||||||
|
"kcheckpass"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [
|
||||||
|
pkgs.kdelibs
|
||||||
|
pkgs.kdebase
|
||||||
|
xorg.xset # used by startkde, non-essential
|
||||||
|
];
|
||||||
|
|
||||||
|
etc = [
|
||||||
|
{ source = ../../../etc/pam.d/kde;
|
||||||
|
target = "pam.d/kde";
|
||||||
|
}
|
||||||
|
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
||||||
|
target = "X11/xkb";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
14
upstart-jobs/xserver/desktopManager/none.nix
Normal file
14
upstart-jobs/xserver/desktopManager/none.nix
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
desktopManager = {
|
||||||
|
session = [{
|
||||||
|
name = "none";
|
||||||
|
start = "";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
44
upstart-jobs/xserver/desktopManager/xterm.nix
Normal file
44
upstart-jobs/xserver/desktopManager/xterm.nix
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.desktopManager.xterm;
|
||||||
|
|
||||||
|
options = { services = { xserver = { desktopManager = {
|
||||||
|
|
||||||
|
xterm = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable a xterm terminal as a desktop manager.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = options;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
desktopManager = {
|
||||||
|
session = [{
|
||||||
|
name = "xterm";
|
||||||
|
start = ''
|
||||||
|
${pkgs.xterm}/bin/xterm -ls &
|
||||||
|
waitPID=$!
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [
|
||||||
|
pkgs.xterm
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
167
upstart-jobs/xserver/displayManager/default.nix
Normal file
167
upstart-jobs/xserver/displayManager/default.nix
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mergeOneOption optionals filter concatMap concatMapStrings;
|
||||||
|
cfg = config.services.xserver;
|
||||||
|
xorg = cfg.package;
|
||||||
|
|
||||||
|
# file provided by services.xserver.displayManager.session.script
|
||||||
|
xsession = wm: dm: pkgs.writeText "xsession" ''
|
||||||
|
|
||||||
|
source /etc/profile
|
||||||
|
|
||||||
|
exec > $HOME/.Xerrors 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
### Load X defaults.
|
||||||
|
if test -e ~/.Xdefaults; then
|
||||||
|
${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults
|
||||||
|
fi
|
||||||
|
|
||||||
|
${if cfg.startSSHAgent then ''
|
||||||
|
### Start the SSH agent.
|
||||||
|
export SSH_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
|
||||||
|
eval $(${pkgs.openssh}/bin/ssh-agent)
|
||||||
|
'' else ""}
|
||||||
|
|
||||||
|
### Allow user to override system-wide configuration
|
||||||
|
if test -f ~/.xsession; then
|
||||||
|
source ~/.xsession;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this script expect to have as first argument the following input
|
||||||
|
# "desktop-manager + window-manager".
|
||||||
|
arg="$1"
|
||||||
|
|
||||||
|
# extract the window manager.
|
||||||
|
windowManager="''${arg##* + }"
|
||||||
|
: ''${windowManager:=${cfg.windowManager.default}}
|
||||||
|
# extract the desktop manager.
|
||||||
|
desktopManager="''${arg% + *}"
|
||||||
|
: ''${desktopManager:=${cfg.desktopManager.default}}
|
||||||
|
|
||||||
|
# used to restart the xserver.
|
||||||
|
waitPID=0
|
||||||
|
|
||||||
|
# handle window manager starts.
|
||||||
|
case $windowManager in
|
||||||
|
${concatMapStrings (s: "
|
||||||
|
(${s.name})
|
||||||
|
${s.start}
|
||||||
|
;;
|
||||||
|
") wm}
|
||||||
|
(*) echo "$0: Window manager '$windowManager' not found.";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# handle desktop manager starts.
|
||||||
|
case $desktopManager in
|
||||||
|
${concatMapStrings (s: "
|
||||||
|
(${s.name})
|
||||||
|
${s.start}
|
||||||
|
;;
|
||||||
|
") dm}
|
||||||
|
(*) echo "$0: Desktop manager '$desktopManager' not found.";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
test "$waitPID" != 0 && wait "$waitPID"
|
||||||
|
exit
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
# list of display managers.
|
||||||
|
require = [
|
||||||
|
(import ./slim.nix)
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
displayManager = {
|
||||||
|
|
||||||
|
xauthBin = mkOption {
|
||||||
|
default = "${xorg.xauth}/bin/xauth";
|
||||||
|
description = "
|
||||||
|
Path to the xauth binary used by display managers.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
xserverBin = mkOption {
|
||||||
|
default = "${xorg.xorgserver}/bin/X";
|
||||||
|
description = "
|
||||||
|
Path to the xserver binary used by display managers.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
xserverArgs = mkOption {
|
||||||
|
default = [];
|
||||||
|
example = [
|
||||||
|
"-ac"
|
||||||
|
"-logverbose"
|
||||||
|
"-nolisten tcp"
|
||||||
|
];
|
||||||
|
description = "
|
||||||
|
List of arguments which have to be pass to when
|
||||||
|
the display manager start the xserver.
|
||||||
|
";
|
||||||
|
apply = toString;
|
||||||
|
};
|
||||||
|
|
||||||
|
session = mkOption {
|
||||||
|
default = [];
|
||||||
|
example = [
|
||||||
|
{
|
||||||
|
manage = "desktop";
|
||||||
|
name = "xterm";
|
||||||
|
start = "
|
||||||
|
${pkgs.xterm}/bin/xterm -ls &
|
||||||
|
waitPID=$!
|
||||||
|
";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
List of session supported with the command used to start each
|
||||||
|
session. Each session script can set the
|
||||||
|
<varname>waitPID</varname> shell variable to make this script
|
||||||
|
waiting until the end of the user session. Each script is used
|
||||||
|
to define either a windows manager or a desktop manager. These
|
||||||
|
can be differentiated by setting the attribute
|
||||||
|
<varname>manage</varname> either to <literal>"window"</literal>
|
||||||
|
or <literal>"desktop"</literal>.
|
||||||
|
|
||||||
|
The list of desktop manager and window manager should appear
|
||||||
|
inside the display manager with the desktop manager name
|
||||||
|
followed by the window manager name.
|
||||||
|
'';
|
||||||
|
apply = list: rec {
|
||||||
|
wm = filter (s: s.manage == "window") list;
|
||||||
|
dm = filter (s: s.manage == "desktop") list;
|
||||||
|
names = concatMap (d: map (w: d.name + " + " + w.name) wm) dm;
|
||||||
|
script = xsession wm dm;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
job = mkOption {
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
beforeScript = ''
|
||||||
|
rm -f /var/log/slim.log
|
||||||
|
'';
|
||||||
|
env = ''
|
||||||
|
env SLIM_CFGFILE=/etc/slim.conf
|
||||||
|
'';
|
||||||
|
execCmd = "${pkgs.slim}/bin/slim";
|
||||||
|
};
|
||||||
|
|
||||||
|
description = "
|
||||||
|
List of arguments which have to be pass to when
|
||||||
|
the display manager start the xserver.
|
||||||
|
";
|
||||||
|
|
||||||
|
merge = mergeOneOption;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
112
upstart-jobs/xserver/displayManager/slim.nix
Normal file
112
upstart-jobs/xserver/displayManager/slim.nix
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption;
|
||||||
|
|
||||||
|
options = { services = { xserver = {
|
||||||
|
|
||||||
|
slim = {
|
||||||
|
|
||||||
|
theme = mkOption {
|
||||||
|
default = null;
|
||||||
|
example = pkgs.fetchurl {
|
||||||
|
url = http://download.berlios.de/slim/slim-wave.tar.gz;
|
||||||
|
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
|
||||||
|
};
|
||||||
|
description = "
|
||||||
|
The theme for the SLiM login manager. If not specified, SLiM's
|
||||||
|
default theme is used. See <link
|
||||||
|
xlink:href='http://slim.berlios.de/themes01.php'/> for a
|
||||||
|
collection of themes.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultUser = mkOption {
|
||||||
|
default = "";
|
||||||
|
example = "login";
|
||||||
|
description = "
|
||||||
|
The default user to load. If you put a username here you
|
||||||
|
get it automatically loaded into the username field, and
|
||||||
|
the focus is placed on the password.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
hideCursor = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "
|
||||||
|
Hide the mouse cursor on the login screen.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}; /* xserver */ }; /* services */ };
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
let
|
||||||
|
xcfg = config.services.xserver;
|
||||||
|
dmcfg = xcfg.displayManager;
|
||||||
|
cfg = xcfg.slim;
|
||||||
|
|
||||||
|
slimConfig = pkgs.writeText "slim.cfg" ''
|
||||||
|
xauth_path ${dmcfg.xauthBin}
|
||||||
|
default_xserver ${dmcfg.xserverBin}
|
||||||
|
xserver_arguments ${dmcfg.xserverArgs}
|
||||||
|
sessions ${pkgs.lib.concatStringsSep "," dmcfg.session.names}
|
||||||
|
login_cmd exec ${pkgs.stdenv.bash}/bin/sh ${dmcfg.session.script} "%session"
|
||||||
|
halt_cmd ${pkgs.upstart}/sbin/shutdown -h now
|
||||||
|
reboot_cmd ${pkgs.upstart}/sbin/shutdown -r now
|
||||||
|
${if cfg.defaultUser != "" then "default_user " + cfg.defaultUser else ""}
|
||||||
|
${if cfg.hideCursor then "hidecursor true" else ""}
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
# Unpack the SLiM theme, or use the default.
|
||||||
|
slimThemesDir =
|
||||||
|
let
|
||||||
|
unpackedTheme = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "slim-theme";
|
||||||
|
buildCommand = ''
|
||||||
|
ensureDir $out
|
||||||
|
cd $out
|
||||||
|
unpackFile ${cfg.theme}
|
||||||
|
ln -s * default
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = [
|
||||||
|
options
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
displayManager = {
|
||||||
|
job = {
|
||||||
|
beforeScript = ''
|
||||||
|
rm -f /var/log/slim.log
|
||||||
|
'';
|
||||||
|
env = ''
|
||||||
|
env SLIM_CFGFILE=${slimConfig}
|
||||||
|
env SLIM_THEMESDIR=${slimThemesDir}
|
||||||
|
'';
|
||||||
|
execCmd = "${pkgs.slim}/bin/slim";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
etc = [
|
||||||
|
{ source = ../../../etc/pam.d/slim;
|
||||||
|
target = "pam.d/slim";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
64
upstart-jobs/xserver/windowManager/compiz.nix
Normal file
64
upstart-jobs/xserver/windowManager/compiz.nix
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.windowManager.compiz;
|
||||||
|
xorg = config.services.xserver.package;
|
||||||
|
gnome = pkgs.gnome;
|
||||||
|
|
||||||
|
options = { services = { xserver = { windowManager = {
|
||||||
|
|
||||||
|
compiz = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the compiz window manager.";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
renderingFlag = mkOption {
|
||||||
|
default = "";
|
||||||
|
example = "--indirect-rendering";
|
||||||
|
description = "
|
||||||
|
Possibly pass --indierct-rendering to Compiz.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = options;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
session = [{
|
||||||
|
name = "compiz";
|
||||||
|
start = ''
|
||||||
|
# !!! Hack: load the schemas for Compiz.
|
||||||
|
GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \
|
||||||
|
--makefile-install-rule ${pkgs.compiz}/etc/gconf/schemas/*.schemas # */
|
||||||
|
|
||||||
|
# !!! Hack: turn on most Compiz modules.
|
||||||
|
${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \
|
||||||
|
--set /apps/compiz/general/allscreens/options/active_plugins \
|
||||||
|
[gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water]
|
||||||
|
|
||||||
|
# Start Compiz and the GTK-style window decorator.
|
||||||
|
env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/
|
||||||
|
${pkgs.compiz}/bin/compiz gconf ${cfg.renderingFlag} &
|
||||||
|
${pkgs.compiz}/bin/gtk-window-decorator --sync &
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [ pkgs.compiz ];
|
||||||
|
};
|
||||||
|
}
|
58
upstart-jobs/xserver/windowManager/default.nix
Normal file
58
upstart-jobs/xserver/windowManager/default.nix
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mergeOneOption any;
|
||||||
|
cfg = config.services.xserver.windowManager;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = [
|
||||||
|
(import ./compiz.nix)
|
||||||
|
(import ./kwm.nix)
|
||||||
|
(import ./metacity.nix)
|
||||||
|
(import ./none.nix)
|
||||||
|
(import ./twm.nix)
|
||||||
|
(import ./wmii.nix)
|
||||||
|
(import ./xmonad.nix)
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
displayManager = {
|
||||||
|
session = cfg.session;
|
||||||
|
};
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
session = mkOption {
|
||||||
|
default = [];
|
||||||
|
example = [{
|
||||||
|
name = "wmii";
|
||||||
|
start = "...";
|
||||||
|
}];
|
||||||
|
description = "
|
||||||
|
Internal option used to add some common line to window manager
|
||||||
|
scripts before forwarding the value to the
|
||||||
|
<varname>displayManager</varname>.
|
||||||
|
";
|
||||||
|
apply = map (d: d // {
|
||||||
|
manage = "window";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
default = mkOption {
|
||||||
|
default = "none";
|
||||||
|
example = "wmii";
|
||||||
|
description = "
|
||||||
|
Default window manager loaded if none have been chosen.
|
||||||
|
";
|
||||||
|
merge = list:
|
||||||
|
let defaultWM = mergeOneOption list; in
|
||||||
|
if any (w: w.name == defaultWM) cfg.session then
|
||||||
|
defaultWM
|
||||||
|
else
|
||||||
|
throw "Default window manager not found.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
46
upstart-jobs/xserver/windowManager/kwm.nix
Normal file
46
upstart-jobs/xserver/windowManager/kwm.nix
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.windowManager.kwm;
|
||||||
|
|
||||||
|
option = { services = { xserver = { windowManager = {
|
||||||
|
|
||||||
|
kwm = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the kwm window manager.";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = option;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
session = [{
|
||||||
|
name = "kwm";
|
||||||
|
start = "
|
||||||
|
${pkgs.kdebase}/bin/kwin &
|
||||||
|
waitPID=$!
|
||||||
|
";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [
|
||||||
|
pkgs.kdelibs
|
||||||
|
pkgs.kdebase
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
49
upstart-jobs/xserver/windowManager/metacity.nix
Normal file
49
upstart-jobs/xserver/windowManager/metacity.nix
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.windowManager.metacity;
|
||||||
|
xorg = config.services.xserver.package;
|
||||||
|
gnome = pkgs.gnome;
|
||||||
|
|
||||||
|
option = { services = { xserver = { windowManager = {
|
||||||
|
|
||||||
|
metacity = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the metacity window manager.";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = option;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
session = [{
|
||||||
|
name = "metacity";
|
||||||
|
start = ''
|
||||||
|
env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:/usr/lib/
|
||||||
|
# !!! Hack: load the schemas for Metacity.
|
||||||
|
GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \
|
||||||
|
--makefile-install-rule ${gnome.metacity}/etc/gconf/schemas/*.schemas # */
|
||||||
|
${gnome.metacity}/bin/metacity &
|
||||||
|
waitPID=$!
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [ gnome.metacity ];
|
||||||
|
};
|
||||||
|
}
|
12
upstart-jobs/xserver/windowManager/none.nix
Normal file
12
upstart-jobs/xserver/windowManager/none.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
windowManager = {
|
||||||
|
session = [{
|
||||||
|
name = "none";
|
||||||
|
start = "";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
44
upstart-jobs/xserver/windowManager/twm.nix
Normal file
44
upstart-jobs/xserver/windowManager/twm.nix
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.windowManager.twm;
|
||||||
|
xorg = config.services.xserver.package;
|
||||||
|
|
||||||
|
option = { services = { xserver = { windowManager = {
|
||||||
|
|
||||||
|
twm = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the twm window manager.";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; }; }; };
|
||||||
|
in
|
||||||
|
|
||||||
|
mkIf cfg.enable {
|
||||||
|
require = option;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
session = [{
|
||||||
|
name = "twm";
|
||||||
|
start = "
|
||||||
|
${xorg.twm}/bin/twm &
|
||||||
|
waitPID=$!
|
||||||
|
";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = [ xorg.twm ];
|
||||||
|
};
|
||||||
|
}
|
32
upstart-jobs/xserver/windowManager/wmii.nix
Normal file
32
upstart-jobs/xserver/windowManager/wmii.nix
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.windowManager.wmii;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
wmii = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the wmii window manager.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
session = mkIf cfg.enable [{
|
||||||
|
name = "wmii";
|
||||||
|
start = "
|
||||||
|
${pkgs.wmiiSnap}/bin/wmii &
|
||||||
|
waitPID=$!
|
||||||
|
";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
32
upstart-jobs/xserver/windowManager/xmonad.nix
Normal file
32
upstart-jobs/xserver/windowManager/xmonad.nix
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
cfg = config.services.xserver.windowManager.xmonad;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
services = {
|
||||||
|
xserver = {
|
||||||
|
|
||||||
|
windowManager = {
|
||||||
|
xmonad = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Enable the xmonad window manager.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
session = mkIf cfg.enable [{
|
||||||
|
name = "xmonad";
|
||||||
|
start = "
|
||||||
|
${pkgs.xmonad}/bin/xmonad &
|
||||||
|
waitPID=$!
|
||||||
|
";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
# Zabbix agent daemon.
|
# Zabbix agent daemon.
|
||||||
{config, pkgs}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
let
|
let
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Zabbix server daemon.
|
# Zabbix server daemon.
|
||||||
{config, pkgs}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
let
|
let
|
||||||
|
Loading…
x
Reference in New Issue
Block a user