diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-05-13 21:32:48 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-05-14 01:02:46 +0200 |
commit | 838d9a9ddb3186e587adfa7329c7e577d766001d (patch) | |
tree | 887af6170d73d3928d12d3f1e0c1753e8d01c0af /gnu | |
parent | 64d76fa6c2b7ded4f18874f413168c26dd5af803 (diff) |
system: Move skeleton code to (gnu system shadow).
* gnu/system.scm (default-skeletons, skeleton-directory): Move to...
* gnu/system/shadow.scm: ... here.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/system.scm | 45 | ||||
-rw-r--r-- | gnu/system/shadow.scm | 54 |
2 files changed, 49 insertions, 50 deletions
diff --git a/gnu/system.scm b/gnu/system.scm index fae8fe44a1..f78df7ce19 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -26,7 +26,6 @@ #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages admin) - #:use-module (gnu packages guile-wm) #:use-module (gnu packages package-management) #:use-module (gnu services) #:use-module (gnu services dmd) @@ -236,50 +235,6 @@ explicitly appear in OS." ;;; /etc. ;;; -(define (default-skeletons) - "Return the default skeleton files for /etc/skel. These files are copied by -'useradd' in the home directory of newly created user accounts." - (define copy-guile-wm - #~(begin - (use-modules (guix build utils)) - (copy-file (car (find-files #$guile-wm "wm-init-sample.scm")) - #$output))) - - (mlet %store-monad ((bashrc (text-file "bashrc" "\ -# Allow non-login shells such as an xterm to get things right. -test -f /etc/profile && source /etc/profile\n")) - (guile-wm (gexp->derivation "guile-wm" copy-guile-wm - #:modules - '((guix build utils)))) - (xdefaults (text-file "Xdefaults" "\ -XTerm*utf8: always -XTerm*metaSendsEscape: true\n")) - (gdbinit (text-file "gdbinit" "\ -# Tell GDB where to look for separate debugging files. -set debug-file-directory ~/.guix-profile/lib/debug\n"))) - (return `((".bashrc" ,bashrc) - (".Xdefaults" ,xdefaults) - (".guile-wm" ,guile-wm) - (".gdbinit" ,gdbinit))))) - -(define (skeleton-directory skeletons) - "Return a directory containing SKELETONS, a list of name/derivation pairs." - (gexp->derivation "skel" - #~(begin - (use-modules (ice-9 match)) - - (mkdir #$output) - (chdir #$output) - - ;; Note: copy the skeletons instead of symlinking - ;; them like 'file-union' does, because 'useradd' - ;; would just copy the symlinks as is. - (for-each (match-lambda - ((target source) - (copy-file source target))) - '#$skeletons) - #t))) - (define* (etc-directory #:key (locale "C") (timezone "Europe/Paris") (skeletons '()) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 8745ddb876..738816b78f 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -17,16 +17,13 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu system shadow) - #:use-module (guix store) #:use-module (guix records) - #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix monads) #:use-module ((gnu packages admin) #:select (shadow)) #:use-module (gnu packages bash) - #:use-module (srfi srfi-1) - #:use-module (ice-9 match) + #:use-module (gnu packages guile-wm) #:export (user-account user-account? user-account-name @@ -43,7 +40,10 @@ user-group-name user-group-password user-group-id - user-group-members)) + user-group-members + + default-skeletons + skeleton-directory)) ;;; Commentary: ;;; @@ -73,4 +73,48 @@ (id user-group-id (default #f)) (members user-group-members (default '()))) +(define (default-skeletons) + "Return the default skeleton files for /etc/skel. These files are copied by +'useradd' in the home directory of newly created user accounts." + (define copy-guile-wm + #~(begin + (use-modules (guix build utils)) + (copy-file (car (find-files #$guile-wm "wm-init-sample.scm")) + #$output))) + + (mlet %store-monad ((bashrc (text-file "bashrc" "\ +# Allow non-login shells such as an xterm to get things right. +test -f /etc/profile && source /etc/profile\n")) + (guile-wm (gexp->derivation "guile-wm" copy-guile-wm + #:modules + '((guix build utils)))) + (xdefaults (text-file "Xdefaults" "\ +XTerm*utf8: always +XTerm*metaSendsEscape: true\n")) + (gdbinit (text-file "gdbinit" "\ +# Tell GDB where to look for separate debugging files. +set debug-file-directory ~/.guix-profile/lib/debug\n"))) + (return `((".bashrc" ,bashrc) + (".Xdefaults" ,xdefaults) + (".guile-wm" ,guile-wm) + (".gdbinit" ,gdbinit))))) + +(define (skeleton-directory skeletons) + "Return a directory containing SKELETONS, a list of name/derivation pairs." + (gexp->derivation "skel" + #~(begin + (use-modules (ice-9 match)) + + (mkdir #$output) + (chdir #$output) + + ;; Note: copy the skeletons instead of symlinking + ;; them like 'file-union' does, because 'useradd' + ;; would just copy the symlinks as is. + (for-each (match-lambda + ((target source) + (copy-file source target))) + '#$skeletons) + #t))) + ;;; shadow.scm ends here |