;; -*- mode: scheme; -*- ;; This is an operating-system configuration template of a ;; 64-bit minimal system for a Raspberry Pi with an NFS root file-system. ;; It neither installs firmware nor device-tree files for the Raspberry Pi. ;; It just assumes them to be existing in boot/efi in the same way that some ;; UEFI firmware with ACPI data is usually assumed to be existing on PCs. ;; It expects the boot/efi directory to be served via TFTP and the root ;; file-system to be served via NFS. See the grub-efi-netboot-bootloader ;; description in the manual for more details. (use-modules (gnu) (gnu artwork) (gnu system nss)) (use-service-modules admin avahi networking ssh) (use-package-modules linux raspberry-pi ssh) (define-public raspberry-pi-64-nfs-root (operating-system (host-name "raspberrypi-guix") (timezone "Europe/Berlin") (bootloader (bootloader-configuration (bootloader grub-efi-bootloader-chain-raspi-64) (targets (list "/boot/efi")) (theme (grub-theme (resolution '(1920 . 1080)) (image (file-append %artwork-repository "/grub/GuixSD-fully-black-16-9.svg")))))) (kernel-arguments '("ip=dhcp")) (kernel (customize-linux #:linux linux-libre-arm64-generic #:extra-version "arm64-generic-netboot" #:configs '("CONFIG_NFS_SWAP=y" "CONFIG_USB_USBNET=y" "CONFIG_USB_LAN78XX=y" "CONFIG_USB_NET_SMSC95XX=y"))) (initrd-modules '()) (file-systems (cons* (file-system (mount-point "/") (type "nfs") (device ":/export/raspberrypi/guix") (options "addr=10.20.30.40,vers=4.1")) %base-file-systems)) (swap-devices (list (swap-space (target "/run/swapfile")))) (users (cons* (user-account (name "pi") (group "users") (supplementary-groups '("wheel" "netdev" "audio" "video")) (home-directory "/home/pi")) %base-user-accounts)) (packages (cons* openssh %base-packages)) (services (cons* (service avahi-service-type) (service dhcp-client-service-type) (service ntp-service-type) (service openssh-service-type (openssh-configuration (x11-forwarding? #t))) %base-services)) (name-service-switch %mdns-host-lookup-nss))) raspberry-pi-64-nfs-root e and, more importantly, leaves 'removeUnusedLinks' with fewer entries to traverse, thereby speeding it up proportionally. Partly fixes <https://issues.guix.gnu.org/24937>. * config-daemon.ac: Remove symlink hard link check and CAN_LINK_SYMLINK definition. * guix/store/deduplication.scm (%deduplication-minimum-size): New variable. (deduplicate)[loop]: Do not recurse when FILE's size is below %DEDUPLICATION-MINIMUM-SIZE. (dump-port): New procedure. (dump-file/deduplicate)[hash]: Turn into... [dump-and-compute-hash]: ... this thunk. Call 'deduplicate' only when SIZE is greater than %DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where st.st_size < deduplicationMinSize. * nix/libstore/local-store.hh (deduplicationMinSize): New declaration. * nix/libstore/optimise-store.cc (deduplicationMinSize): New variable. (LocalStore::optimisePath_): Return when PATH is a symlink or smaller than 'deduplicationMinSize'. * tests/derivations.scm ("identical files are deduplicated"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/nar.scm ("restore-file-set with directories (signed, valid)"): Likewise. * tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"): New test. ("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/store.scm ("substitute, deduplication"): Likewise. Ludovic Courtès 2020-12-15nar: Deduplicate files right as they are restored....This avoids having to traverse and re-read the files that we have just restored, thereby reducing I/O. * guix/serialization.scm (dump-file): New procedure. (restore-file): Add #:dump-file parameter and honor it. * guix/store/deduplication.scm (tee, dump-file/deduplicate): New procedures. * guix/nar.scm (restore-one-item): Pass #:dump-file to 'restore-file'. (finalize-store-file): Pass #:deduplicate? #f to 'register-items'. * tests/nar.scm <top level>: Call 'setenv' to set "NIX_STORE". Ludovic Courtès 2020-12-15serialization: 'restore-file' sets canonical timestamp and permissions....* guix/serialization.scm (restore-file): Set the permissions and mtime of FILE. * guix/nar.scm (finalize-store-file): Pass #:reset-timestamps? #f to 'register-items'. * tests/nar.scm (rm-rf): Add 'chmod' calls to ensure files are writable. ("write-file + restore-file with symlinks"): Ensure every file in OUTPUT passes 'canonical-file?'. * tests/guix-archive.sh: Run "chmod -R +w" before "rm -rf". Ludovic Courtès 2020-12-15serialization: 'fold-archive' notifies about directory processing completion....* guix/serialization.scm (fold-archive): Call PROC with a 'directory-complete tag when done with a directory. (restore-file): Handle it. * guix/scripts/archive.scm (list-contents): Likewise. * guix/scripts/challenge.scm (archive-contents): Likewise. * tests/nar.scm ("write-file-tree + fold-archive"): Adjust accordingly. Ludovic Courtès