* Synced with trunk @ 14801

svn path=/nixos/branches/modular-nixos/; revision=14953
This commit is contained in:
Nicolas Pierron 2009-04-08 14:01:16 +00:00
commit 3f1dd56e9e
19 changed files with 131 additions and 77 deletions

View File

@ -53,9 +53,11 @@ rec {
cp ${pkgs.e2fsprogs}/sbin/e2fsck $out/bin cp ${pkgs.e2fsprogs}/sbin/e2fsck $out/bin
cp ${pkgs.e2fsprogs}/sbin/tune2fs $out/bin cp ${pkgs.e2fsprogs}/sbin/tune2fs $out/bin
cp ${pkgs.e2fsprogs}/sbin/fsck $out/bin cp ${pkgs.e2fsprogs}/sbin/fsck $out/bin
cp ${pkgs.reiserfsprogs}/sbin/reiserfsck $out/bin
ln -s e2fsck $out/bin/fsck.ext2 ln -s e2fsck $out/bin/fsck.ext2
ln -s e2fsck $out/bin/fsck.ext3 ln -s e2fsck $out/bin/fsck.ext3
ln -s e2fsck $out/bin/fsck.ext4 ln -s e2fsck $out/bin/fsck.ext4
ln -s reiserfsck $out/bin/fsck.reiserfs
cp -pd ${pkgs.e2fsprogs}/lib/lib*.so.* $out/lib cp -pd ${pkgs.e2fsprogs}/lib/lib*.so.* $out/lib
@ -66,6 +68,9 @@ rec {
cp $lvm2/sbin/lvm $out/bin/lvm cp $lvm2/sbin/lvm $out/bin/lvm
fi fi
# Add RAID mdadm tool.
cp ${pkgs.mdadm}/sbin/mdadm $out/bin/mdadm
# Copy udev. # Copy udev.
cp ${pkgs.udev}/sbin/udevd ${pkgs.udev}/sbin/udevadm $out/bin cp ${pkgs.udev}/sbin/udevd ${pkgs.udev}/sbin/udevadm $out/bin
cp ${pkgs.udev}/lib/udev/*_id $out/bin cp ${pkgs.udev}/lib/udev/*_id $out/bin
@ -100,6 +105,8 @@ rec {
$out/bin/dmsetup --version | grep "version:" $out/bin/dmsetup --version | grep "version:"
LVM_SYSTEM_DIR=$out $out/bin/lvm 2>&1 | grep "LVM" LVM_SYSTEM_DIR=$out $out/bin/lvm 2>&1 | grep "LVM"
fi fi
$out/bin/reiserfsck -V
$out/bin/mdadm --version
''; # */ ''; # */

View File

@ -4,9 +4,9 @@ let
let env = builtins.getEnv name; in let env = builtins.getEnv name; in
if env == "" then default else env; if env == "" then default else env;
configuration = import (fromEnv "NIXOS_CONFIG" /etc/nixos/configuration.nix); configuration = import (fromEnv "NIXOS_CONFIG" /etc/nixos/configuration.nix);
nixpkgsPath = fromEnv "NIXPKGS" /etc/nixos/nixpkgs; nixpkgs = fromEnv "NIXPKGS" /etc/nixos/nixpkgs;
system = import system/system.nix { inherit configuration nixpkgsPath; }; system = import system/system.nix { inherit configuration nixpkgs; };
in in

View File

@ -1,14 +1,12 @@
{nixpkgsPath ? ../../../nixpkgs, nixpkgs ? null}: {nixpkgs ? ../../../nixpkgs}:
let let
pkgs = if nixpkgs == null then pkgs = import nixpkgs {};
import "${nixpkgsPath}/pkgs/top-level/all-packages.nix" {}
else nixpkgs;
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
(builtins.toXML (pkgs.lib.optionAttrSetToDocList "" (builtins.toXML (pkgs.lib.optionAttrSetToDocList ""
(import ../../system/system.nix {inherit nixpkgsPath; configuration = {};}).optionDeclarations))); (import ../../system/system.nix {inherit nixpkgs; configuration = {};}).optionDeclarations)));
optionsDocBook = pkgs.runCommand "options-db.xml" {} '' optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
${pkgs.libxslt}/bin/xsltproc -o $out ${./options-to-docbook.xsl} ${options} ${pkgs.libxslt}/bin/xsltproc -o $out ${./options-to-docbook.xsl} ${options}

View File

@ -190,6 +190,7 @@ let
"useradd" "useradd"
"chsh" "chsh"
"xlock" "xlock"
"samba"
"cups" "cups"
"ftp" "ftp"
"common" "common"

4
etc/pam.d/samba Normal file
View File

@ -0,0 +1,4 @@
auth include common
account include common
password include common
session include common

View File

@ -1,4 +1,4 @@
{ stdenv, perl, cdrkit, nixpkgsPath { stdenv, perl, cdrkit, nixpkgs
, # The file name of the resulting ISO image. , # The file name of the resulting ISO image.
isoName ? "cd.iso" isoName ? "cd.iso"
@ -11,13 +11,11 @@
, # In addition to `contents', the closure of the store paths listed , # In addition to `contents', the closure of the store paths listed
# in `packages' are also placed in the Nix store of the CD. This is # in `packages' are also placed in the Nix store of the CD. This is
# a list of attribute sets {source, target} where `source' if a # a list of attribute sets {object, symlink} where `object' if a
# store path whose closure will be copied, and `target' is a symlink # store path whose closure will be copied, and `symlink' is a
# to `source' that will be added to the CD. # symlink to `object' that will be added to the CD.
storeContents ? [] storeContents ? []
, buildStoreContents ? []
, # Whether this should be an El-Torito bootable CD. , # Whether this should be an El-Torito bootable CD.
bootable ? false bootable ? false
@ -52,7 +50,5 @@ stdenv.mkDerivation {
# For obtaining the closure of `storeContents'. # For obtaining the closure of `storeContents'.
exportReferencesGraph = exportReferencesGraph =
map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents; map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
exportBuildReferencesGraph = pathsFromGraph = "${nixpkgs}/pkgs/build-support/kernel/paths-from-graph.pl";
map (x: [("closure-build-" + baseNameOf x.object) x.object]) buildStoreContents;
pathsFromGraph = "${nixpkgsPath}/pkgs/build-support/kernel/paths-from-graph.pl";
} }

View File

@ -461,22 +461,17 @@ rec {
}; };
# Closures to be copied to the Nix store on the CD. # Closures to be copied to the Nix store on the CD.
storeContents = lib.uniqListExt { storeContents =
inputList= lib.concatLists lib.uniqListExt {
(map systemPackInstallClosures systemPacks); inputList = lib.concatLists
getter = x : x.object.drvPath; (map systemPackInstallClosures systemPacks);
compare = lib.eqStrings; getter = x: x.object.drvPath;
}; compare = lib.eqStrings;
}
buildStoreContents = lib.uniqList ++ lib.uniqList {
{ inputList = lib.optionals includeBuildDeps
inputList=([] (lib.concatLists (map systemPackInstallBuildClosure systemPacks));
++ };
(if includeBuildDeps then lib.concatLists
(map systemPackInstallBuildClosure systemPacks)
else [])
);
};
bootable = true; bootable = true;
bootImage = "boot/grub/stage2_eltorito"; bootImage = "boot/grub/stage2_eltorito";

View File

@ -4,7 +4,7 @@
then builtins.readFile ../../relname then builtins.readFile ../../relname
else "nixos-${builtins.readFile ../../VERSION}" else "nixos-${builtins.readFile ../../VERSION}"
, compressImage ? false , compressImage ? false
, nixpkgsPath ? ../../../nixpkgs , nixpkgs ? ../../../nixpkgs
}: }:
rec { rec {
@ -190,7 +190,7 @@ rec {
pkgs.gdb # for debugging Nix pkgs.gdb # for debugging Nix
pkgs.testdisk # useful for repairing boot problems pkgs.testdisk # useful for repairing boot problems
pkgs.mssys # for writing Microsoft boot sectors / MBRs pkgs.mssys # for writing Microsoft boot sectors / MBRs
pkgs.ntfsprogs # for resizing NTFS partitions
pkgs.sshfsFuse pkgs.sshfsFuse
pkgs.screen pkgs.screen
]; ];
@ -200,7 +200,7 @@ rec {
system = import ../../system/system.nix { system = import ../../system/system.nix {
inherit configuration platform nixpkgsPath; inherit configuration platform nixpkgs;
}; };
@ -211,7 +211,7 @@ rec {
# 0.11 (you won't get the manual). # 0.11 (you won't get the manual).
manual = manual =
if builtins ? unsafeDiscardStringContext if builtins ? unsafeDiscardStringContext
then "${import ../../doc/manual {inherit nixpkgsPath;}}/manual.html" then "${import ../../doc/manual {inherit nixpkgs;}}/manual.html"
else pkgs.writeText "dummy-manual" "Manual not included in this build!"; else pkgs.writeText "dummy-manual" "Manual not included in this build!";
@ -230,7 +230,7 @@ rec {
# Put Nixpkgs in a tarball. # Put Nixpkgs in a tarball.
nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" nixpkgsPath; nixpkgsTarball = makeTarball "nixpkgs.tar.bz2" nixpkgs;
# The configuration file for Grub. # The configuration file for Grub.
@ -255,7 +255,7 @@ rec {
# Create an ISO image containing the Grub boot loader, the kernel, # Create an ISO image containing the Grub boot loader, the kernel,
# the initrd produced above, and the closure of the stage 2 init. # the initrd produced above, and the closure of the stage 2 init.
rescueCD = import ../../helpers/make-iso9660-image.nix { rescueCD = import ../../helpers/make-iso9660-image.nix {
inherit nixpkgsPath; inherit nixpkgs;
inherit (pkgs) stdenv perl cdrkit; inherit (pkgs) stdenv perl cdrkit;
isoName = "${relName}-${platform}.iso"; isoName = "${relName}-${platform}.iso";

View File

@ -1,3 +1,5 @@
{ nixpkgs ? ../nixpkgs-wc }:
let let
@ -5,12 +7,11 @@ let
tarball = tarball =
{ nixosSrc ? {path = ./.; rev = 1234;} { nixosSrc ? {outPath = ./.; rev = 1234;}
, nixpkgs ? {path = ../nixpkgs-wc;}
, officialRelease ? false , officialRelease ? false
}: }:
with import nixpkgs.path {}; with import nixpkgs {};
releaseTools.makeSourceTarball { releaseTools.makeSourceTarball {
name = "nixos-tarball"; name = "nixos-tarball";
@ -22,7 +23,7 @@ let
inherit officialRelease; inherit officialRelease;
distPhase = '' distPhase = ''
releaseName=nixos-$VERSION releaseName=nixos-$VERSION$VERSION_SUFFIX
ensureDir "$out/tarballs" ensureDir "$out/tarballs"
mkdir ../$releaseName mkdir ../$releaseName
cp -prd . ../$releaseName cp -prd . ../$releaseName
@ -33,34 +34,32 @@ let
manual = manual =
{ nixosSrc ? {path = ./.; rev = 1234;} { nixosSrc ? {outPath = ./.; rev = 1234;}
, nixpkgs ? {path = ../nixpkgs-wc;}
, officialRelease ? false , officialRelease ? false
}: }:
import "${nixosSrc.path}/doc/manual" { import "${nixosSrc}/doc/manual" {
nixpkgsPath = nixpkgs.path; inherit nixpkgs;
}; };
iso = iso =
{ nixosSrc ? {path = ./.; rev = 1234;} { nixosSrc ? {outPath = ./.; rev = 1234;}
, nixpkgs ? {path = ../nixpkgs-wc;}
, officialRelease ? false , officialRelease ? false
, system ? "i686-linux" , system ? "i686-linux"
}: }:
with import nixpkgs.path {inherit system;}; with import nixpkgs {inherit system;};
let let
version = builtins.readFile ./VERSION + (if officialRelease then "" else "pre${toString nixosSrc.rev}"); version = builtins.readFile ./VERSION + (if officialRelease then "" else "pre${toString nixosSrc.rev}");
iso = (import "${nixosSrc.path}/installer/cd-dvd/rescue-cd.nix" { iso = (import "${nixosSrc}/installer/cd-dvd/rescue-cd.nix" {
platform = system; platform = system;
compressImage = true; compressImage = true;
nixpkgsPath = nixpkgs.path;
relName = "nixos-${version}"; relName = "nixos-${version}";
inherit nixpkgs;
}).rescueCD; }).rescueCD;
in in
@ -79,4 +78,4 @@ let
}; };
in jobs in jobs

View File

@ -19,7 +19,7 @@ let
Additional attributes may be needed depending on your Additional attributes may be needed depending on your
configuration. For instance, if you use the NVIDIA X driver, configuration. For instance, if you use the NVIDIA X driver,
then it also needs to contain an attribute then it also needs to contain an attribute
<varname>nvidiaDrivers</varname>. <varname>nvidia_x11</varname>.
"; ";
}; };
@ -52,7 +52,7 @@ let
extraModulePackages = mkOption { extraModulePackages = mkOption {
default = []; default = [];
# !!! example = [pkgs.aufs pkgs.nvidiaDrivers]; # !!! example = [pkgs.aufs pkgs.nvidia_x11];
description = '' description = ''
A list of additional packages supplying kernel modules. A list of additional packages supplying kernel modules.
''; '';

View File

@ -164,7 +164,7 @@ in
mount = mkOption { mount = mkOption {
internal = true; internal = true;
default = pkgs.utillinux.passthru.function { default = pkgs.utillinuxng.override {
buildMountOnly = true; buildMountOnly = true;
mountHelpers = pkgs.buildEnv { mountHelpers = pkgs.buildEnv {
name = "mount-helpers"; name = "mount-helpers";

View File

@ -1,7 +1,6 @@
{ platform ? __currentSystem { platform ? __currentSystem
, configuration , configuration
, nixpkgsPath ? ../../nixpkgs , nixpkgs ? ../../nixpkgs
, nixpkgs ? null
}: }:
rec { rec {
@ -25,9 +24,7 @@ rec {
pkgs configComponents pkgs configComponents
config; config;
pkgs = if nixpkgs == null then pkgs = import nixpkgs {system = platform;};
import "${nixpkgsPath}/pkgs/top-level/all-packages.nix" {system = platform;}
else nixpkgs;
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it manifests = config.installer.manifests; # exported here because nixos-rebuild uses it

View File

@ -19,7 +19,7 @@ let
# Build a Subversion instance with Apache modules and Swig/Python bindings. # Build a Subversion instance with Apache modules and Swig/Python bindings.
subversion = pkgs.subversion15.function (origArgs: { subversion = pkgs.subversion15.override (origArgs: {
bdbSupport = true; bdbSupport = true;
httpServer = true; httpServer = true;
sslSupport = true; sslSupport = true;

View File

@ -48,6 +48,9 @@ let
configFile = writeText "ntp.conf" '' configFile = writeText "ntp.conf" ''
driftfile ${stateDir}/ntp.drift driftfile ${stateDir}/ntp.drift
# Keep the drift file in ${stateDir}/ntp.drift. However, since we
# chroot to ${stateDir}, we have to specify it as /ntp.drift.
driftfile /ntp.drift
${toString (map (server: "server " + server + "\n") servers)} ${toString (map (server: "server " + server + "\n") servers)}
''; '';

View File

@ -70,7 +70,7 @@ mkIf config.services.portmap.enable {
job = job =
let portmap = pkgs.makePortmap { daemonUID = uid; daemonGID = gid; }; let portmap = pkgs.portmap.override { daemonUID = uid; daemonGID = gid; };
in in
'' ''
description "ONC RPC portmap" description "ONC RPC portmap"

View File

@ -27,7 +27,12 @@ let
user = "smbguest"; user = "smbguest";
group = "smbguest"; group = "smbguest";
smbConfig = ./smb.conf ; #smbConfig = ./smb.conf ;
smbConfig = pkgs.substituteAll {
src = ./smb.conf;
inherit samba;
};
inherit (pkgs) samba; inherit (pkgs) samba;
@ -79,13 +84,13 @@ mkIf config.services.samba.enable {
${samba}/sbin/nmbd -D -s ${smbConfig} & ${samba}/sbin/nmbd -D -s ${smbConfig} &
${samba}/sbin/smbd -D -s ${smbConfig} & ${samba}/sbin/smbd -D -s ${smbConfig} &
${samba}/sbin/winbindd -B -s ${smbConfig} & ${samba}/sbin/winbindd -s ${smbConfig} &
ln -fs ${smbConfig} /var/samba/config ln -fs ${smbConfig} /var/samba/config
end script end script
respawn ${samba}/sbin/nmbd -D -s ${smbConfig} &; ${samba}/sbin/smbd -D -s ${smbConfig} &; ${samba}/sbin/winbindd -B & respawn ${samba}/sbin/nmbd -D -s ${smbConfig} &; ${samba}/sbin/smbd -D -s ${smbConfig} &; ${samba}/sbin/winbindd &
''; '';
}]; }];

View File

@ -1,10 +1,35 @@
[global] [global]
workgroup = Users workgroup = Users
security = share
server string = %h server string = %h
comment = Samba comment = Samba
local master = no log file = /var/log/samba/log.%m
[default] log level = 10
path = /home/smbd max log size = 50000
security = user
#must be set to 'no' to use PAM
encrypt passwords = No
client plaintext auth = yes
client lanman auth = Yes
dns proxy = no
invalid users = root
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
# encrypt passwords = yes
# smb passwd file = @samba@/private/smbpasswd
#[default]
# path = /home/smbd
# read only = no
# guest ok = yes
[raidbackup]
path = /home/raidbackup/files
read only = no read only = no
guest ok = yes guest ok = no
available = yes
browseable = yes
public = yes
valid users = raidbackup
comment = Raid backup Files

View File

@ -48,6 +48,27 @@ let
Whether mkdir is permitted to anonymous users. Whether mkdir is permitted to anonymous users.
"; ";
}; };
chrootlocalUser = mkOption {
default = false;
description = "
Whether u can like out of ur home dir.
";
};
userlistEnable = mkOption {
default = false;
description = "
Whether users are included.
";
};
userlistDeny = mkOption {
default = false;
description = "
Whether users are excluded.
";
};
}; };
}; };
}; };
@ -57,7 +78,8 @@ in
let let
inherit (config.services.vsftpd) anonymousUser localUsers writeEnable anonymousUploadEnable anonymousMkdirEnable; inherit (config.services.vsftpd) anonymousUser localUsers writeEnable anonymousUploadEnable anonymousMkdirEnable
chrootlocalUser userlistEnable userlistDeny;
inherit (pkgs) vsftpd; inherit (pkgs) vsftpd;
yesNoOption = p : name : yesNoOption = p : name :
@ -110,6 +132,9 @@ mkIf config.services.vsftpd.enable {
${yesNoOption writeEnable "write_enable"} ${yesNoOption writeEnable "write_enable"}
${yesNoOption anonymousUploadEnable "anon_upload_enable"} ${yesNoOption anonymousUploadEnable "anon_upload_enable"}
${yesNoOption anonymousMkdirEnable "anon_mkdir_write_enable"} ${yesNoOption anonymousMkdirEnable "anon_mkdir_write_enable"}
${yesNoOption chrootlocalUser "chroot_local_user"}
${yesNoOption userlistEnable "userlist_enable"}
${yesNoOption userlistDeny "userlist_deny"}
background=NO background=NO
listen=YES listen=YES
nopriv_user=vsftpd nopriv_user=vsftpd

View File

@ -289,7 +289,7 @@ let
stdenv = pkgs.stdenv; stdenv = pkgs.stdenv;
knownVideoDrivers = { knownVideoDrivers = {
nvidia = { modulesFirst = [ kernelPackages.nvidiaDrivers ]; }; #make sure it first loads the nvidia libs nvidia = { modulesFirst = [ kernelPackages.nvidia_x11 ]; }; #make sure it first loads the nvidia libs
vesa = { modules = [xorg.xf86videovesa]; }; vesa = { modules = [xorg.xf86videovesa]; };
vga = { modules = [xorg.xf86videovga]; }; vga = { modules = [xorg.xf86videovga]; };
sis = { modules = [xorg.xf86videosis]; }; sis = { modules = [xorg.xf86videosis]; };
@ -462,7 +462,6 @@ let
}; };
nvidiaDrivers = (config.boot.kernelPackages pkgs).nvidiaDrivers;
in in
@ -491,7 +490,7 @@ mkIf cfg.enable {
boot = { boot = {
extraModulePackages = mkIf (cfg.videoDriver == "nvidia") [ extraModulePackages = mkIf (cfg.videoDriver == "nvidia") [
kernelPackages.nvidiaDrivers kernelPackages.nvidia_x11
]; ];
}; };
@ -509,7 +508,7 @@ mkIf cfg.enable {
xorg.iceauth # required for KDE applications (it's called by dcopserver) xorg.iceauth # required for KDE applications (it's called by dcopserver)
] ]
++ optional (videoDriver == "nvidia") [ ++ optional (videoDriver == "nvidia") [
kernelPackages.nvidiaDrivers kernelPackages.nvidia_x11
]; ];
}; };
@ -539,7 +538,7 @@ mkIf cfg.enable {
rm -f /var/run/opengl-driver rm -f /var/run/opengl-driver
${if videoDriver == "nvidia" ${if videoDriver == "nvidia"
then '' then ''
ln -sf ${kernelPackages.nvidiaDrivers} /var/run/opengl-driver ln -sf ${kernelPackages.nvidia_x11} /var/run/opengl-driver
'' ''
else if cfg.driSupport else if cfg.driSupport
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver" then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
@ -557,7 +556,7 @@ mkIf cfg.enable {
env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension. env XKB_BINDIR=${xorg.xkbcomp}/bin # Needed for the Xkb extension.
${if videoDriver == "nvidia" ${if videoDriver == "nvidia"
then "env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidiaDrivers}/lib" then "env LD_LIBRARY_PATH=${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11}/lib"
else "" else ""
} }