aboutsummaryrefslogtreecommitdiff
#pragma once

namespace nix {


#define WORKER_MAGIC_1 0x6e697863
#define WORKER_MAGIC_2 0x6478696f

#define PROTOCOL_VERSION 0x164
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)


typedef enum {
    wopIsValidPath = 1,
    wopHasSubstitutes = 3,
    wopQueryPathHash = 4,
    wopQueryReferences = 5,
    wopQueryReferrers = 6,
    wopAddToStore = 7,
    wopAddTextToStore = 8,
    wopBuildPaths = 9,
    wopEnsurePath = 10,
    wopAddTempRoot = 11,
    wopAddIndirectRoot = 12,
    wopSyncWithGC = 13,
    wopFindRoots = 14,
    wopExportPath = 16,
    wopQueryDeriver = 18,
    wopSetOptions = 19,
    wopCollectGarbage = 20,
    wopQuerySubstitutablePathInfo = 21,
    wopQueryDerivationOutputs = 22,
    wopQueryAllValidPaths = 23,
    wopQueryFailedPaths = 24,
    wopClearFailedPaths = 25,
    wopQueryPathInfo = 26,
    wopImportPaths = 27,
    wopQueryDerivationOutputNames = 28,
    wopQueryPathFromHashPart = 29,
    wopQuerySubstitutablePathInfos = 30,
    wopQueryValidPaths = 31,
    wopQuerySubstitutablePaths = 32,
    wopQueryValidDerivers = 33,
    wopOptimiseStore = 34,
    wopVerifyStore = 35,
    wopBuiltinBuilders = 80,
    wopSubstituteURLs = 81
} WorkerOp;


#define STDERR_NEXT  0x6f6c6d67
#define STDERR_READ  0x64617461 // data needed from source
#define STDERR_WRITE 0x64617416 // data for sink
#define STDERR_LAST  0x616c7473
#define STDERR_ERROR 0x63787470


Path readStorePath(Source & from);
template<class T> T readStorePaths(Source & from);


}
pe luks-device-mapping))) (define %os-with-mapped-device (operating-system (host-name "komputilo") (timezone "Europe/Berlin") (locale "en_US.utf8") (bootloader (bootloader-configuration (bootloader grub-bootloader) (targets '("/dev/sdX")))) (mapped-devices (list %luks-device)) (file-systems (cons (file-system (inherit %root-fs) (dependencies (list %luks-device))) %base-file-systems)) (users %base-user-accounts))) (%graft? #f) (test-begin "system") (test-assert "operating-system-store-file-system" ;; %BASE-FILE-SYSTEMS defines a bind-mount for /gnu/store, but this ;; shouldn't be a problem. (eq? %root-fs (operating-system-store-file-system %os))) (test-assert "operating-system-store-file-system, prefix" (let* ((gnu (file-system (device "foobar") (mount-point (dirname (%store-prefix))) (type "ext5"))) (os (operating-system (inherit %os) (file-systems (cons* gnu %root-fs %base-file-systems))))) (eq? gnu (operating-system-store-file-system os)))) (test-assert "operating-system-store-file-system, store" (let* ((gnu (file-system (device "foobar") (mount-point (%store-prefix)) (type "ext5"))) (os (operating-system (inherit %os) (file-systems (cons* gnu %root-fs %base-file-systems))))) (eq? gnu (operating-system-store-file-system os)))) (test-equal "operating-system-user-mapped-devices" '() (operating-system-user-mapped-devices %os-with-mapped-device)) (test-equal "operating-system-boot-mapped-devices" (list %luks-device) (operating-system-boot-mapped-devices %os-with-mapped-device)) (test-equal "operating-system-boot-mapped-devices, implicit dependency" (list %luks-device) ;; Here we expect the implicit dependency between "/" and ;; "/dev/mapper/my-luks-device" to be found, in spite of the lack of a ;; 'dependencies' field in the root file system. (operating-system-boot-mapped-devices (operating-system (inherit %os-with-mapped-device) (file-systems (cons (file-system (device "/dev/mapper/my-luks-device") (mount-point "/") (type "ext4")) %base-file-systems))))) (test-equal "non-boot-file-system-service" '() ;; Make sure that mapped devices with at least one needed-for-boot user are ;; handled exclusively from the initrd. See <https://bugs.gnu.org/31889>. (append-map file-system-dependencies (service-value ((@@ (gnu system) non-boot-file-system-service) (operating-system (inherit %os-with-mapped-device) (file-systems (list (file-system (mount-point "/foo/bar") (device "qux:baz") (type "none") (dependencies (list %luks-device))) (file-system (device (file-system-label "my-root")) (mount-point "/") (type "ext4") (dependencies (list %luks-device)))))))))) (test-assert "lower-object, %current-system sensitivity" ;; Make sure that 'lower-object' returns the same derivation, no matter what ;; '%current-system' is. See <https://issues.guix.gnu.org/55951>. (let ((drv1 (with-store store (parameterize ((%current-system "x86_64-linux")) (run-with-store store (lower-object %os "aarch64-linux"))))) (drv2 (with-store store (parameterize ((%current-system "aarch64-linux")) (run-with-store store (lower-object %os "aarch64-linux")))))) (eq? drv1 drv2))) (test-end)