From 73152e1702ee3f32e9811ca4bfa57ccf0c46a48e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 3 Feb 2013 10:35:11 +0100 Subject: [PATCH] etc.nix: Fix style --- modules/system/etc/etc.nix | 64 +++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/modules/system/etc/etc.nix b/modules/system/etc/etc.nix index 7553a569bebb..1300562b99cb 100644 --- a/modules/system/etc/etc.nix +++ b/modules/system/etc/etc.nix @@ -1,12 +1,32 @@ -# Produce a script to generate /etc. +# Management of static files in /etc. + { config, pkgs, ... }: with pkgs.lib; -###### interface let - option = { + etc = pkgs.stdenv.mkDerivation { + name = "etc"; + + builder = ./make-etc.sh; + + preferLocalBuild = true; + + /* !!! Use toXML. */ + sources = map (x: x.source) config.environment.etc; + targets = map (x: x.target) config.environment.etc; + modes = map (x: x.mode) config.environment.etc; + }; + +in + +{ + + ###### interface + + options = { + environment.etc = mkOption { default = []; example = [ @@ -37,37 +57,23 @@ let }; }; }; - }; -in -###### implementation -let - - etc = pkgs.stdenv.mkDerivation { - name = "etc"; - - builder = ./make-etc.sh; - - preferLocalBuild = true; - - /* !!! Use toXML. */ - sources = map (x: x.source) config.environment.etc; - targets = map (x: x.target) config.environment.etc; - modes = map (x: x.mode) config.environment.etc; }; -in -{ - require = [option]; + ###### implementation - system.build.etc = etc; + config = { - system.activationScripts.etc = stringAfter [ "stdio" ] - '' - # Set up the statically computed bits of /etc. - echo "setting up /etc..." - ${pkgs.perl}/bin/perl ${./setup-etc.pl} ${etc}/etc - ''; + system.build.etc = etc; + + system.activationScripts.etc = stringAfter [ "stdio" ] + '' + # Set up the statically computed bits of /etc. + echo "setting up /etc..." + ${pkgs.perl}/bin/perl ${./setup-etc.pl} ${etc}/etc + ''; + + }; }