From 3c84d56273ff6a5eb07d83448a3b046cb6c5ebc7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 28 May 2009 13:17:56 +0000 Subject: [PATCH] * Move the /etc generation to modules/system/etc. svn path=/nixos/branches/modular-nixos/; revision=15767 --- modules/legacy.nix | 1 - modules/module-list.nix | 1 + modules/programs/bash/bash.nix | 19 +++++++ etc/default.nix => modules/system/etc/etc.nix | 55 +++++-------------- {helpers => modules/system/etc}/make-etc.nix | 0 {helpers => modules/system/etc}/make-etc.sh | 0 6 files changed, 35 insertions(+), 41 deletions(-) rename etc/default.nix => modules/system/etc/etc.nix (65%) rename {helpers => modules/system/etc}/make-etc.nix (100%) rename {helpers => modules/system/etc}/make-etc.sh (100%) diff --git a/modules/legacy.nix b/modules/legacy.nix index 67a99ea900c..8b4d7199ae0 100644 --- a/modules/legacy.nix +++ b/modules/legacy.nix @@ -1,6 +1,5 @@ { require = [ - ../etc/default.nix ../system/assertion.nix ../system/nixos-environment.nix ../system/nixos-installer.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index a6843e09702..b10905fc35e 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -117,6 +117,7 @@ ./system/boot/kernel.nix ./system/boot/stage-1.nix ./system/boot/stage-2.nix + ./system/etc/etc.nix ./system/upstart-events/ctrl-alt-delete.nix ./system/upstart-events/halt.nix ./system/upstart-events/maintenance-shell.nix diff --git a/modules/programs/bash/bash.nix b/modules/programs/bash/bash.nix index d992d0888ba..205cadea7f3 100644 --- a/modules/programs/bash/bash.nix +++ b/modules/programs/bash/bash.nix @@ -3,7 +3,26 @@ {config, pkgs, ...}: +let + + options = { + + environment.shellInit = pkgs.lib.mkOption { + default = ""; + example = ''export PATH=/godi/bin/:$PATH''; + description = " + Script used to initialized user shell environments. + "; + merge = pkgs.lib.mergeStringOption; + }; + + }; + +in + { + require = [options]; + environment.etc = [ { # /etc/bashrc: script executed when the shell starts as a # non-login shell. /etc/profile also sources this file, so diff --git a/etc/default.nix b/modules/system/etc/etc.nix similarity index 65% rename from etc/default.nix rename to modules/system/etc/etc.nix index fad75ccbf31..c499cc0583a 100644 --- a/etc/default.nix +++ b/modules/system/etc/etc.nix @@ -6,41 +6,23 @@ let inherit (pkgs.lib) mkOption; option = { - environment = { - etc = mkOption { - default = []; - example = [ - { source = "/nix/store/.../etc/dir/file.conf.example"; - target = "dir/file.conf"; - mode = "0440"; - } - ]; - description = " - List of files that have to be linked in /etc. - "; - }; - - # !!! This should be moved outside of /etc/default.nix. - shellInit = mkOption { - default = ""; - example = ''export PATH=/godi/bin/:$PATH''; - description = " - Script used to initialized user shell environments. - "; - merge = pkgs.lib.mergeStringOption; - }; + environment.etc = mkOption { + default = []; + example = [ + { source = "/nix/store/.../etc/dir/file.conf.example"; + target = "dir/file.conf"; + mode = "0440"; + } + ]; + description = '' + List of files that have to be linked in /etc. + ''; }; }; in ###### implementation let - optional = pkgs.lib.optional; - -in - -let - inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry; copyScript = {source, target, mode ? "644", own ? "root.root"}: assert target != "nixos"; @@ -54,22 +36,15 @@ let chmod ${mode} "$target" ''; - makeEtc = import ../helpers/make-etc.nix { + makeEtc = import ./make-etc.nix { inherit (pkgs) stdenv; configFiles = config.environment.etc; }; + in { - require = [ - option - - # config.system.build - # ../system/system-options.nix - - # config.system.activationScripts - # ../system/activate-configuration.nix - ]; + require = [option]; system = { build = { @@ -77,7 +52,7 @@ in }; activationScripts = { - etc = fullDepEntry '' + etc = pkgs.lib.fullDepEntry '' # Set up the statically computed bits of /etc. staticEtc=/etc/static rm -f $staticEtc diff --git a/helpers/make-etc.nix b/modules/system/etc/make-etc.nix similarity index 100% rename from helpers/make-etc.nix rename to modules/system/etc/make-etc.nix diff --git a/helpers/make-etc.sh b/modules/system/etc/make-etc.sh similarity index 100% rename from helpers/make-etc.sh rename to modules/system/etc/make-etc.sh