;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2016 Christine Lemmer-Webber ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Marius Bakke ;;; Copyright © 2018 Chris Marusich ;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-01-06Update license headers.Ludovic Courtès
Change all license headers, except guix/build/* and ld-wrapper.scm, with this code: (use-modules (guix build utils) (srfi srfi-1)) (fluid-set! %default-port-encoding "UTF-8") (substitute* (remove (lambda (f) (or (string-contains f ".tar.") (string-contains f ".git/") (string-contains f ".so") (string-suffix? ".o" f) (string-suffix? ".a" f) (string-suffix? ".go" f) (string-suffix? ".pdf" f) (string-suffix? ".png" f) (string-suffix? ".info" f) (equal? (basename f) "guix-daemon") (equal? (basename f) "nix-setuid-helper") (string-contains f "nix-upstream/") (string-contains f "distro/packages/bootstrap/"))) (find-files "." "\\.[a-z]+$")) (("^([[:graph:]]+) This file is part of Guix." _ comment-start) (string-append comment-start " This file is part of GNU Guix.")) (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start) (string-append comment-start " GNU Guix --- Functional package management for GNU\n")) (("^([[:graph:]]+) Guix is " _ comment-start) (string-append comment-start " GNU Guix is ")) (("^([[:graph:]]+) along with Guix." _ comment-start) (string-append comment-start " along with GNU Guix.")) (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start) (string-append comment-start " Copyright ©"))) Change headers using C-style comments manually.
2012-11-25distro: Search bootstrap binaries and patches in %LOAD-PATH.Ludovic Courtès
* Makefile.am (patchdir, bootstrapdir): Change to be sub-directories of $(guilemoduledir). (.scm.go): Remove `DISTRO_' environment variables. * distro.scm (not-colon): Remove. (%patch-path, %bootstrap-binaries-path): Default to sub-directories of the entries in %LOAD-PATH. * pre-inst-env.in: Remove definition of `DISTRO_' environment variables.
2012-11-19distro: Add `fold-packages'.Ludovic Courtès
* distro.scm (fold-packages): New procedure. (find-packages-by-name): Use it instead of hand-written traversal; remove `package?' checks from `right-package?'. * tests/packages.scm ("fold-packages"): New test.
2012-10-27distro: Change $DISTRO_{PATCH,BOOTSTRAP}_DIRECTORY to search paths.Ludovic Courtès
* distro.scm (not-colon): New variable. (%patch-directory): Rename to... (%patch-path): ... this. Turn into a list. Expect $DISTRO_PATCH_PATH to be a colon-separated search path. (%bootstrap-binaries-directory): Rename to... (%bootstrap-binaries-path): ... this. Likewise. (search-patch, search-bootstrap-binary): Adjust accordingly. * pre-inst-env.in: Change to use `DISTRO_PATCH_PATH' and `DISTRO_BOOTSTRAP_PATH'.
2012-10-17distro: Use our own pre-built Guile to bootstrap.Ludovic Courtès
* distro/packages/base.scm (%bootstrap-guile): Build from a tarball containing a pre-built Guile. * distro.scm (%bootstrap-binaries-directory): New variable. (search-bootstrap-binary): New procedure. * Makefile.am (bootstrapdir, bootstrap_x86_64_linuxdir, dist_bootstrap_x86_64_linux_DATA, DISTCLEANFILES, DOWNLOAD_FILE): New variables. (distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz): New rule. (EXTRA_DIST): Add `build-aux/download.scm'. (.scm.go): Define the `DISTRO_BOOTSTRAP_DIRECTORY' and `DISTRO_INSTALLED_BOOTSTRAP_DIRECTORY' environment variables. * pre-inst-env.in: Define `DISTRO_BOOTSTRAP_DIRECTORY'. * build-aux/download.scm: New file. * distro/packages/bootstrap/x86_64-linux/{bash, mkdir, tar, xz}: New files.
2012-10-04distro: Fix typo in warning message.Ludovic Courtès
* distro.scm (package-files): Add missing newline in warning message.
2012-09-26distro: Add the `guile', `typesetting', and `databases' package modules.Ludovic Courtès
* distro.scm (package-files): Adjust PREFIX-LEN to use the top-level directory, not %DISTRO-MODULE-DIRECTORY. * distro/packages/base.scm (guile-reader, guile-reader/guile-1.8, guile-reader/guile-2.0, lout, recutils): Move to... * distro/packages/guile.scm, distro/packages/typesetting.scm, distro/packages/databases.scm: ... here. New files. * Makefile.am (MODULES): Add them. (EXTRA_DIST): Add `.dir-locals.el'. * .dir-locals.el: New file, with settings formerly in `base.scm'.
2012-09-26distro: Rename (distro ...) to (distro packages ...).Ludovic Courtès
* distro/base.scm, distro/ld-wrapper.scm: Move to `distro/packages'. Adjust LD-WRAPPER-BOOT3 input file name accordingly. * Makefile.am (MODULES): Adjust accordingly. * distro.scm (%distro-module-directory): Change to "/distro/packages". * guix/build-system/gnu.scm (standard-inputs): Change module name to (distro packages base). * tests/packages.scm (test-packages): Likewise.
2012-08-22distro: Move patches to their own directory.Ludovic Courtès
* Makefile.am (nobase_dist_guilemodule_DATA): Keep only $(MODULES). (patchdir): New variable. (dist_patch_DATA): New variable. Patch files formerly in $(nobase_dist_guilemodule_DATA). (.scm.go): Define `DISTRO_PATCH_DIRECTORY' and `DISTRO_INSTALLED_PATCH_DIRECTORY'. (TESTS_ENVIRONMENT): Define `DISTRO_PATCH_DIRECTORY'. * distro.scm (%patch-directory): New variable. (search-patch): New procedure. * distro/base.scm: Use `search-patch' instead of `(search-path %load-path ...)'. * distro/findutils-absolute-paths.patch, distro/guile-1.8-cpp-4.5.patch, distro/m4-readlink-EINVAL.patch, distro/m4-s_isdir.patch, distro/make-impure-dirs.patch: Move to `distro/patches'.
2012-06-30Add (distro) with a package searching facility.Ludovic Courtès
* Makefile.am (MODULES): Add `distro.scm'. * distro.scm: New file. * po/POTFILES.in: Add it. * tests/packages.scm ("find-packages-by-name", "find-packages-by-name with version"): New tests.
    offset)) ;; Set the 'device' field of each partition. (reverse (fold2 (lambda (part result index) (values (cons (partition (inherit part) (device (string-append device (number->string index)))) result) (+ 1 index))) '() 1 partitions))) (define MS_BIND 4096) ; again! (define* (create-ext-file-system partition type #:key label uuid (options '())) "Create an ext-family file system of TYPE on PARTITION. If LABEL is true, use that as the volume name. If UUID is true, use it as the partition UUID." (format #t "creating ~a partition... ~@[label: ~s~] ~@[uuid: ~s~]\n" type label (and uuid (uuid->string uuid))) (apply invoke (string-append "mkfs." type) "-F" partition `(,@(if label `("-L" ,label) '()) ,@(if uuid `("-U" ,(uuid->string uuid)) '()) ,@options))) (define* (create-fat-file-system partition #:key label uuid (options '())) "Create a FAT file system on PARTITION. The number of File Allocation Tables will be determined based on file system size. If LABEL is true, use that as the volume name." ;; FIXME: UUID is ignored! (format #t "creating FAT partition...\n") (apply invoke "mkfs.fat" partition (append (if label `("-n" ,label) '()) options))) (define* (format-partition partition type #:key label uuid (options '())) "Create a file system TYPE on PARTITION. If LABEL is true, use that as the volume name. Options is a list of command-line options passed to 'mkfs.FS'." (cond ((string-prefix? "ext" type) (create-ext-file-system partition type #:label label #:uuid uuid #:options options)) ((or (string-prefix? "fat" type) (string= "vfat" type)) (create-fat-file-system partition #:label label #:uuid uuid #:options options)) (else (error "Unsupported file system.")))) (define (initialize-partition partition) "Format PARTITION, a object with a non-#f 'device' field, mount it, run its initializer, and unmount it." (let ((target "/fs")) (format-partition (partition-device partition) (partition-file-system partition) #:label (partition-label partition) #:uuid (partition-uuid partition) #:options (partition-file-system-options partition)) (mkdir-p target) (mount (partition-device partition) target (partition-file-system partition)) ((partition-initializer partition) target) (umount target) partition)) (define* (root-partition-initializer #:key (closures '()) copy-closures? (register-closures? #t) system-directory (deduplicate? #t) (make-device-nodes make-essential-device-nodes) (extra-directives '())) "Return a procedure to initialize a root partition. If REGISTER-CLOSURES? is true, register all of CLOSURES in the partition's store. If DEDUPLICATE? is true, then also deduplicate files common to CLOSURES and the rest of the store when registering the closures. If COPY-CLOSURES? is true, copy all of CLOSURES to the partition. SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation. EXTRA-DIRECTIVES is an optional list of directives to populate the root file system that is passed to 'populate-root-file-system'." (lambda (target) (define target-store (string-append target (%store-directory))) (when copy-closures? ;; Populate the store. (populate-store (map (cut string-append "/xchg/" <>) closures) target #:deduplicate? deduplicate?)) ;; Populate /dev. (make-device-nodes target) ;; Optionally, register the inputs in the image's store. (when register-closures? (unless copy-closures? ;; XXX: 'register-closure' wants to palpate the things it registers, so ;; bind-mount the store on the target. (mkdir-p target-store) (mount (%store-directory) target-store "" MS_BIND)) (display "registering closures...\n") (for-each (lambda (closure) (register-closure target (string-append "/xchg/" closure))) closures) (unless copy-closures? (umount target-store))) ;; Add the non-store directories and files. (display "populating...\n") (populate-root-file-system system-directory target #:extras extra-directives) ;; 'register-closure' resets timestamps and everything, so no need to do it ;; once more in that case. (unless register-closures? ;; 'reset-timestamps' also resets file permissions; do that everywhere ;; except on /dev so that /dev/null remains writable, etc. (for-each (lambda (directory) (reset-timestamps (string-append target "/" directory))) (scandir target (match-lambda ((or "." ".." "dev") #f) (_ #t)))) (reset-timestamps (string-append target "/dev") #:preserve-permissions? #t)))) (define (register-bootcfg-root target bootcfg) "On file system TARGET, register BOOTCFG as a GC root." (let ((directory (string-append target "/var/guix/gcroots"))) (mkdir-p directory) (symlink bootcfg (string-append directory "/bootcfg")))) (define* (initialize-hard-disk device #:key bootloader-package bootcfg bootcfg-location bootloader-installer (grub-efi #f) (partitions '())) "Initialize DEVICE as a disk containing all the objects listed in PARTITIONS, and using BOOTCFG as its bootloader configuration file. Each partition is initialized by calling its 'initializer' procedure, passing it a directory name where it is mounted." (define (partition-bootable? partition) "Return the first partition found with the boot flag set." (member 'boot (partition-flags partition))) (define (partition-esp? partition) "Return the first EFI System Partition." (member 'esp (partition-flags partition))) (let* ((partitions (initialize-partition-table device partitions)) (root (find partition-bootable? partitions)) (esp (find partition-esp? partitions)) (target "/fs")) (unless root (error "no bootable partition specified" partitions)) (for-each initialize-partition partitions) (display "mounting root partition...\n") (mkdir-p target) (mount (partition-device root) target (partition-file-system root)) (install-boot-config bootcfg bootcfg-location target) (when bootloader-installer (display "installing bootloader...\n") (bootloader-installer bootloader-package device target)) (when esp ;; Mount the ESP somewhere and install GRUB UEFI image. (let ((mount-point (string-append target "/boot/efi"))) (display "mounting EFI system partition...\n") (mkdir-p mount-point) (mount (partition-device esp) mount-point (partition-file-system esp)) (display "creating EFI firmware image...") (install-efi-loader grub-efi mount-point) (display "done.\n") (umount mount-point))) ;; Register BOOTCFG as a GC root. (register-bootcfg-root target bootcfg) (umount target))) ;;; vm.scm ends here