Commit Graph

251 Commits

Author SHA1 Message Date
Ludovic Courtès 0b8a376b68 gnu: vm: Factorize /etc creation.
* gnu/system/vm.scm (expression->derivation-in-linux-vm)[lower-inputs]:
  Move to top-level...
  (lower-inputs): ... here.  New variable.
  (file-union, etc-directory): New procedures.
  (system-qemu-image): Use 'etc-directory'; remove redundant code, and
  register the result of 'etc-directory' as a GC root.
2013-12-07 00:01:06 +01:00
Ludovic Courtès dd1a5a152c derivations: Use more keyword parameters for 'build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Turn 'system' and
  'inputs' into keyword parameters.
  Adjust callers accordingly.
* gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm,
  guix/build-system/gnu.scm, guix/build-system/perl.scm,
  guix/build-system/python.scm, guix/build-system/trivial.scm,
  guix/download.scm, guix/packages.scm, guix/profiles.scm,
  guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh,
  tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of
  'build-expression->derivation' and 'derivation-expression'
  accordingly.
* doc/guix.texi (Derivations): Adjust 'build-expression->derivation'
  documentation accordingly.
  (The Store Monad): Likewise for 'derivation-expression'.
2013-12-04 16:07:53 +01:00
Ludovic Courtès f5a345adeb gnu: dmd: Update start/stop of standard service definitions.
* gnu/system/dmd.scm (mingetty-service): Add 'stop' field.
  (nscd-service): Run with '--foreground'.  Change 'stop' to use
  'make-kill-destructor'.
  (syslog-service): Run with '--no-detach'; change 'stop' similarly.
  (guix-service): Likewise for 'stop'.
  (static-networking-service): Remove 'sleep' call from 'start'.  Change
  'stop' to return #f when networking was actually stopped.
2013-12-02 23:38:49 +01:00
Ludovic Courtès b4f0bb1771 gnu: dmd: Add service documentation.
* gnu/system/dmd.scm (<service>): Add 'documentation' field.
  (host-name-service, mingetty-service, nscd-service, syslog-service,
  static-networking-service): Provide a 'documentation' value.
  (dmd-configuration-file): Use it.
2013-11-28 00:15:07 +01:00
Ludovic Courtès 30e457501d gnu: vm: Really create a QCOW2-format image.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Pass "-f
  qcow2" to 'qemu-img create'.
2013-11-19 00:03:29 +01:00
Ludovic Courtès d9f0a23704 gnu: vm: Rewrite helper functions as monadic functions.
* gnu/system/dmd.scm (host-name-service, nscd-service, mingetty-service,
  syslog-service, guix-service, static-networking-service): Rewrite as
  monadic functions.
  (dmd-configuration-file): Use 'text-file' instead of
  'add-text-to-store'.
* gnu/system/grub.scm (grub-configuration-file): Rewrite as a monadic
  function.
* gnu/system/linux.scm (pam-services->directory): Likewise.
* gnu/system/shadow.scm (group-file, passwd-file, guix-build-accounts):
  Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm, qemu-image,
  union, system-qemu-image): Likewise.
2013-10-03 23:12:20 +02:00
Ludovic Courtès f887601ac8 gnu: guix: Update to 0.4.
* gnu/packages/package-management.scm (guix): Update to 0.4.
  (guix-0.4): Remove.
* gnu/system/vm.scm (qemu-image, system-qemu-image): Use GUIX instead of
  GUIX-0.4.
2013-09-27 21:09:02 +02:00
Ludovic Courtès 867e3c5553 gnu: vm: Remove erroneous store reference.
* gnu/system/vm.scm (system-qemu-image): Remove reference from BOOT to
  MINGETTY since MINGETTY may not be valid yet.
2013-09-27 21:06:35 +02:00
Ludovic Courtès 9f84f12fde gnu: vm: Add more packages to the profile.
* gnu/system/vm.scm (system-qemu-image): Add grep, sed, and Findutils to
  the profile.
2013-09-27 13:50:15 +02:00
Ludovic Courtès 5b16ff0985 gnu: vm: Add a few packages to the default profile.
* gnu/system/vm.scm (system-qemu-image): Add procps, psmisc, and Zile to
  the default profile.  Increase the image size to 550 MiB.
2013-09-27 00:46:18 +02:00
Ludovic Courtès 87eb734d38 gnu: dmd: Make the 'networking' service slightly more robust.
* gnu/system/dmd.scm (static-networking-service)[start]: Sleep before
  running 'route', to leave time for the interface to come up.
  [stop]: Run "route del -net default".
2013-09-27 00:46:18 +02:00
Ludovic Courtès 17886b3022 gnu: vm: Set the right permissions and ownership on directories.
* gnu/system/vm.scm (qemu-image): Change the store's mode to #o1775.
  Support 'populate' clauses that specify a UID and GID.
  (system-qemu-image): Make sure /nix/store has owner 'root' and group
  'guixbuild'.  Set the right owner for /home/guest.  Create
  /var/nix/profiles/per-user/{root,guest}.
2013-09-27 00:46:18 +02:00
Ludovic Courtès d0c66871b1 gnu: vm: Add build users.
* gnu/system/shadow.scm (guix-build-accounts): New procedure.
* gnu/system/vm.scm (system-qemu-image): Use it.  Add the "guixbuild"
  group.
* gnu/system/dmd.scm (guix-service): Add 'builder-group' parameter.
  Pass 'guix-daemon' the '--build-users-group' option.
2013-09-27 00:46:17 +02:00
Ludovic Courtès 3abf9b440b gnu: vm: Add /etc/{services,protocols,rpc} to the image.
* gnu/system/vm.scm (system-qemu-image): Link
  /etc/{services,protocols,rpc}.  Add net-base as an input.
2013-09-27 00:46:17 +02:00
Ludovic Courtès 8bc755c08c gnu: vm: Add a 'guest' account.
* gnu/system/vm.scm (system-qemu-image): Add a "guest" user and a
  "users" user group.  Make /home/guest.  Add /etc/group.  Update
  /etc/issue to mention it.
2013-09-27 00:46:17 +02:00
Ludovic Courtès 16a0e9dc34 gnu: shadow: Add record type for user groups.
* gnu/system/shadow.scm (<user-group>): New record type.
  (group-file): New procedure.
* gnu/system/vm.scm (system-qemu-image): Use it.
2013-09-27 00:46:17 +02:00
Ludovic Courtès bacadb026c gnu: shadow: Add record type for user accounts.
* gnu/system/shadow.scm (<user-account>): New record type.
  (passwd-file): Use it.
* gnu/system/vm.scm (system-qemu-image): Adjust accordingly.
2013-09-27 00:46:17 +02:00
Ludovic Courtès 59c5c4dee1 gnu: vm: Set the default networking route.
* gnu/system/dmd.scm (static-networking-service): Add #:gateway
  parameter and honor it.
* gnu/system/vm.scm (system-qemu-image): Pass #:gateway to
  'static-networking-service'.
2013-09-27 00:46:17 +02:00
Ludovic Courtès 349746dfcd gnu: vm: Add nscd service.
* gnu/system/dmd.scm (nscd-service): New procedure.
* gnu/system/vm.scm (system-qemu-image): Use it.  Make /var/run/nscd.
2013-09-26 00:07:42 +02:00
Ludovic Courtès f83e943fe7 gnu: vm: Add 'networking' service.
* gnu/system/vm.scm (system-qemu-image): Use
  'static-networking-service'.  Add /etc/resolv.conf.  Add Inetutils to
  the profile.
* gnu/system/dmd.scm (static-networking-service): New procedure.
2013-09-25 23:26:08 +02:00
Ludovic Courtès 27cab84c6d gnu: vm: Register the profile as a GC root.
* gnu/system/vm.scm (system-qemu-image): Register PROFILE as a GC root.
2013-09-25 23:05:33 +02:00
Ludovic Courtès ba47851fac gnu: vm: Add 'host-name' service.
* gnu/system/dmd.scm (host-name-service): New procedure.
  (mingetty-service): Require the 'host-name' service.
* gnu/system/vm.scm (system-qemu-image): Add the 'host-name' service.
  Set PS1 in /etc/bashrc to something sensible.
2013-09-25 21:49:22 +02:00
Ludovic Courtès 43a2779876 gnu: vm: Add /etc/issue and a motd.
* gnu/system/vm.scm (system-qemu-image): Build a 'motd' and an 'issue'
  file.  Pass 'unix-pam-service' that motd.  Have /etc/issue point to
  the 'issue' file.
2013-09-25 21:47:10 +02:00
Ludovic Courtès d5d0f286a2 gnu: vm: Change #:populate to a list of directives.
* gnu/system/vm.scm (qemu-image): Change 'populate' parameter to be a
  list of directives.
  (system-qemu-image): Adjust accordingly.
2013-09-25 18:58:25 +02:00
Ludovic Courtès 25eb16bf3b gnu: vm: Add more ttys.
* gnu/system/vm.scm (system-qemu-image): Add more ttys.
2013-09-25 18:58:25 +02:00
Ludovic Courtès 65d195e140 gnu: vm: Change GRUB label.
* gnu/system/vm.scm (system-qemu-image): Change GRUB label.
2013-09-25 18:58:25 +02:00
Ludovic Courtès 0b86a82dc7 gnu: vm: Make a union of the visible packages; add /etc/profile.
* gnu/system/vm.scm (qemu-image): Add Guix as an input when
  INITIALIZE-STORE?.
  (union): New procedure.
  (system-qemu-image): Use it.  Build /etc/profile.  Pass PROFILE among
  #:inputs-to-copy instead of listing all the individual profiles.
  Remove explicit 'build-derivations' call.
2013-09-25 18:58:25 +02:00
Ludovic Courtès 37c58656eb gnu: vm: Support derivation objects as inputs.
* gnu/system/vm.scm (expression->derivation-in-linux-vm)[input-alist]:
  Add case for derivation? objects.
  Same for #:inputs values.
  (qemu-image)[input->name+derivation]: Likewise.
2013-09-25 18:58:25 +02:00
Ludovic Courtès 9fcc355529 gnu: vm: Add a service for the Guix daemon.
* gnu/system/dmd.scm (guix-service): New procedure.
* gnu/system/vm.scm (system-qemu-image): Use it.
2013-09-24 23:40:50 +02:00
Ludovic Courtès 30f25b033c gnu: vm: Initialize the image's store.
* gnu/system/vm.scm (qemu-image): Add 'initialize-store?' keyword
  parameter.  Use 'guix-register' when INITIALIZE-STORE? is true.
  (system-qemu-image): Pass #:initialize-store? #t.
2013-09-24 23:40:50 +02:00
Ludovic Courtès 4646e30a7a gnu: QEMU images boots into dmd.
* gnu/system/dmd.scm: New file.
* gnu/system/vm.scm (system-qemu-image): Define dmd services.
  [populate]: Make var/log and etc/group.
  [boot]: Execute dmd directly.
  Add dmd and etc-group as inputs; add the inputs of dmd services.
* gnu-system.am (GNU_SYSTEM_MODULES): Add gnu/system/dmd.scm.
2013-09-21 01:09:06 +02:00
Ludovic Courtès 59688fc4b5 derivations: 'derivation' and related procedures return a single value.
* guix/derivations.scm (derivation->output-path,
  derivation->output-paths): New procedures.
  (derivation-path->output-path): Use 'derivation->output-path'.
  (derivation-path->output-paths): Use 'derivation->output-paths'.
  (derivation): Accept 'derivation?' objects as inputs.  Return a single
  value.
  (build-derivations): New procedure.
  (compiled-modules): Use 'derivation->output-paths'.
  (build-expression->derivation)[source-path]: Add case for when the
  input matches 'derivation?'.
  [prologue]: Accept 'derivation?' objects in INPUTS.
  [mod-dir, go-dir]: Use 'derivation->output-path'.
* guix/download.scm (url-fetch): Adjust to the single-value return.
* guix/packages.scm (package-output): Use 'derivation->output-path'.
* guix/scripts/build.scm (guix-build): When the argument is
  'derivation-path?', pass it through 'read-derivation'.
  Use 'derivation-file-name' to print out the .drv file names, and to
  register them.  Use 'derivation->output-path' instead of
  'derivation-path->output-path'.
* guix/scripts/package.scm (roll-back): Adjust to the single-value
  return.
  (guix-package): Use 'derivation->output-path'.
* guix/ui.scm (show-what-to-build): Adjust to deal with 'derivation?'
  objects instead of .drv file names.
* gnu/system/grub.scm (grub-configuration-file): Use
  'derivation->output-path' instead of 'derivation-path->output-path'.
* gnu/system/vm.scm (qemu-image, system-qemu-image): Likewise.
* tests/builders.scm, tests/derivations.scm, tests/packages.scm,
  tests/store.scm, tests/union.scm: Adjust to the new calling
  convention.
* doc/guix.texi (Defining Packages, The Store, Derivations): Adjust
  accordingly.
2013-09-18 18:49:53 +02:00
Ludovic Courtès 0ded70f37d gnu: Move helper code to (gnu system …) modules.
* gnu/packages/grub.scm (<menu-entry>, grub-configuration-file): Move
  to...
* gnu/system/grub.scm: ... here.  New file.
* gnu/packages/linux.scm (<pam-service>, <pam-entry>,
  pam-service->configuration, pam-service->directory,
  %pam-other-services, unix-pam-service): Move to...
* gnu/system/linux.scm: ... here.  New file.
* gnu/system/vm.scm (passwd-file): Move to...
* gnu/system/shadow.scm: ... here.  New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add
  gnu/system/{grub,linux,shadow}.scm.
2013-09-11 22:36:50 +02:00
Ludovic Courtès aedb72fbe0 gnu: vm: Remove potluck hacks.
* gnu/system/vm.scm (example1): Remove.
  (example2): Rename to...
  (system-qemu-image): ... this.  Add 'store' parameter, and remove call
  to 'open-connection'.
2013-09-11 20:27:36 +02:00
Ludovic Courtès a843fe2222 gnu: vm: Setup PAM.
* gnu/system/vm.scm (example2): Use 'pam-services->directory'.  Change
  POPULATE to create /etc/pam.d, /etc/login.defs, and /var/run.  Change
  BOOT to spawn syslogd; boot to Bash.  Add inputs.
2013-09-11 01:07:50 +02:00
Ludovic Courtès 3b07625ad6 gnu: vm: Create shadow files with the right format.
* gnu/system/vm.scm (passwd-file): When SHADOW? is true, use the right
  shadow(5) format.  Always add a trailing newline.
2013-09-11 01:07:50 +02:00
Ludovic Courtès d34c0ac6e9 gnu: vm: Copy /etc/shadow to the guest.
* gnu/system/vm.scm (example2): Add SHADOW to #:inputs-to-copy.
2013-09-09 21:52:14 +02:00
Ludovic Courtès 98aeb06b41 gnu: vm: Create valid /etc/shadow and /etc/passwd.
* gnu/system/vm.scm (/etc/passwd): Rename to...
  (passwd-file): ... this. Add 'shadow?' keyword parameter.  Change
  format of ACCOUNTS, and fix CONTENTS.
  (example2): Adjust accordingly.  Create both /etc/shadow and
  /etc/passwd, the latter being used by getpwnam(3) & co. when nscd is
  not running.
2013-09-08 23:52:03 +02:00
Ludovic Courtès 8ab73e91d6 gnu: vm: Clear timestamps on the imported files, like in the store.
* gnu/system/vm.scm (qemu-image): Clear timestamps on the copied files.
2013-09-08 23:30:12 +02:00
Ludovic Courtès 0e2ddecd8e gnu: grub: Add support for building configuration files.
* gnu/packages/grub.scm (<menu-entry>): New record type.
  (grub-configuration-file): New procedure.
* gnu/system/vm.scm (qemu-image): Remove parameters 'linux',
  'linux-arguments', and 'initrd'.  Add 'grub-configuration' parameter.
  Honor them, and remove grub.cfg generation code accordingly.
  (example2): Use `grub-configuration-file', and adjust accordingly.
2013-09-07 17:23:23 +02:00
Ludovic Courtès 785859d306 gnu: vm: Add /etc/shadow in the QEMU image.
* gnu/system/vm.scm (qemu-image): Add 'populate' keyword parameter and
  honor it; make it an input.
  (/etc/shadow): New procedure.
  (example2): Call it; build 'populate' script, and pass it to
  'qemu-image'.
2013-09-05 23:57:40 +02:00
Ludovic Courtès 002e5ba887 gnu: vm: Remove unused 'qemu-image' argument.
* gnu/system/vm.scm (qemu-image): Remove 'boot-expression' parameter,
  superseded by 'linux-arguments'.
2013-09-05 22:14:21 +02:00
Ludovic Courtès 1b89a66e1b gnu: vm: First stab at building a populated QEMU image.
* gnu/packages/linux-initrd.scm (gnu-system-initrd): New variable.
* gnu/system/vm.scm (qemu-image): Add #:linux-arguments parameter.
  [input->name+derivation]: Add case for 'store-path?' items.
  Remove LOADER from `inputs'.
2013-09-05 00:46:09 +02:00
Ludovic Courtès 7c1d8146a7 gnu: vm: 'qemu-image' populates /dev on the target root file system.
* gnu/system/vm.scm (qemu-image): Use (guix build linux-initrd).  Remove
  'mknod' calls; use 'make-essential-device-nodes' to populate /dev on
  the target image.
* gnu/packages/linux-initrd.scm (qemu-initrd): When /root/dev exists,
  don't call 'make-essential-device-nodes'.
2013-09-05 00:46:09 +02:00
Ludovic Courtès 93d44bd8de gnu: vm: `qemu-image' can copy store closures into the target image.
* gnu/system/vm.scm (qemu-image): Add #:inputs-to-copy and
  #:boot-expression parameters.  Honor them.  Append INPUTS-TO-COPY to
  the #:inputs argument for `expression->derivation-in-linux-vm'.
  (example2): Add #:boot-expression and #:inputs-to-copy arguments.
2013-08-31 23:02:18 +02:00
Ludovic Courtès 4c0f0673b2 gnu: `expression->derivation-in-linux-vm' accepts files as inputs.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Accept items
  in INPUTS that refer to a file instead of a package.
2013-08-31 23:02:18 +02:00
Ludovic Courtès ca85d7bcc6 gnu: `expression->derivation-in-linux-vm' export references graphs.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add
  #:reference-graphs parameter.  Honor it.  Delete duplicates in
  #:modules argument.
2013-08-31 23:02:18 +02:00
Ludovic Courtès 2455085a1e vm: Use more keyword parameters for `expression->derivation-in-linux-vm'.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Turn `system'
  and `inputs' into keyword parameters.
  (qemu-image, example1): Adjust accordingly.
2013-08-28 00:55:40 +02:00
Ludovic Courtès baed8816fc gnu: Have `qemu-image' explicitly reboot when done.
* gnu/system/vm.scm (qemu-image): Call `reboot' when we're done.  Change
  `menuentry' title.
2013-08-23 15:11:35 +02:00
Ludovic Courtès 50731c51a4 gnu: Remove QEMU-KVM, which is no longer needed.
* gnu/packages/qemu.scm (qemu-kvm): Remove.
  (qemu): Incorporate parts of QEMU-KVM that used to be inherited.
  (qemu-kvm/smb-shares): Rename to...
  (qemu/smb-shares): ... this.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Adjust
  accordingly.
2013-08-16 23:55:51 +02:00
Ludovic Courtès 040860152e Add (gnu system vm).
* gnu/system/vm.scm: New file.
* Makefile.am (MODULES): Add it.
2013-02-16 03:28:26 +01:00