Changes between Initial Version and Version 1 of Transfer the sources you need by USB-drive


Ignore:
Timestamp:
04/30/25 08:23:54 (4 weeks ago)
Author:
enno
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Transfer the sources you need by USB-drive

    v1 v1  
     1== Transfer the sources you need by USB-drive
     2
     3If you want to build everything from source on the CI/CD server, you must transfer:
     4
     5* Updated package definitions (e.g., new Guix commit / channel state)
     6
     7* All required source code (not binaries)
     8
     9=== Step 1: On a networked (twin) machine
     10
     11* Check for new versions
     12
     13{{{#!sh
     14guix refresh PACKAGE-NAME
     15}}}
     16
     17This will update the local package definition in your channel checkout (if you're maintaining your own channels or overlay packages).
     18
     19* Build the package to pull source code into the store
     20
     21{{{#!sh
     22guix build --source PACKAGE-NAME
     23}}}
     24
     25This ensures that all source tarballs and patches are downloaded and cached.
     26
     27* Export source code and channel state
     28
     29Export the source derivation (not the binaries!):
     30
     31{{{#!sh
     32guix archive --export -r $(guix build --source PACKAGE-NAME) > sources.nar
     33}}}
     34
     35Also export the updated Guix channels or commit used:
     36
     37{{{#!sh
     38guix describe --format=channels > channels.scm
     39}}}
     40
     41=== Step 2: Transfer to the air-gapped CI/CD server
     42
     43Copy the following files via USB or other air-gap-compliant method:
     44
     45* sources.nar (the archive of source derivations)
     46
     47* channels.scm (to sync channel state)
     48
     49* Optionally: your custom channel checkout (if using overlays)
     50
     51=== Step 3: On the CI/CD server
     52
     53* Sync channel state
     54
     55{{{#!sh
     56guix time-machine -C channels.scm -- build PACKAGE-NAME
     57}}}
     58
     59Or, if you want to pull into your main Guix:
     60
     61{{{#!sh
     62guix pull --channels=channels.scm
     63}}}
     64
     65* Import the sources
     66
     67{{{#!sh
     68guix archive --import < sources.nar
     69}}}
     70
     71Now the CI/CD server has all it needs to build the package from source without network access.
     72
     73=== Optional: Preload additional sources or dependencies
     74
     75To avoid surprises, you may want to pre-fetch all sources recursively:
     76
     77{{{#!sh
     78guix build --sources=transitive PACKAGE-NAME
     79guix archive --export -r $(guix build --sources=transitive PACKAGE-NAME) > all-sources.nar
     80}}}
     81
     82This ensures no source fetch attempts will occur during CI builds.