This is guix.pt_BR.info, produced by makeinfo version 6.7 from guix.pt_BR.texi. Copyright © 2012-2022 Ludovic Courtès Copyright © 2013, 2014, 2016 Andreas Enge Copyright © 2013 Nikita Karetnikov Copyright © 2014, 2015, 2016 Alex Kost Copyright © 2015, 2016 Mathieu Lirzin Copyright © 2014 Pierre-Antoine Rault Copyright © 2015 Taylan Ulrich Bayırlı/Kammer Copyright © 2015, 2016, 2017, 2019, 2020, 2021 Leo Famulari Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus Copyright © 2016 Ben Woodcroft Copyright © 2016, 2017, 2018, 2021 Chris Marusich Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner Copyright © 2016 John Darrington Copyright © 2016, 2017 Nikita Gillmann Copyright © 2016, 2017, 2018, 2019, 2020 Jan Nieuwenhuizen Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Julien Lepiller Copyright © 2016 Alex ter Weele Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Christopher Baines Copyright © 2017, 2018, 2019 Clément Lassieur Copyright © 2017, 2018, 2020, 2021, 2022 Mathieu Othacehe Copyright © 2017 Federico Beffa Copyright © 2017, 2018 Carlo Zancanaro Copyright © 2017 Thomas Danckaert Copyright © 2017 humanitiesNerd Copyright © 2017, 2021 Christine Lemmer-Webber Copyright © 2017, 2018, 2019, 2020, 2021, 2022 Marius Bakke Copyright © 2017, 2019, 2020, 2022 Hartmut Goebel Copyright © 2017, 2019, 2020, 2021, 2022 Maxim Cournoyer Copyright © 2017–2022 Tobias Geerinckx-Rice Copyright © 2017 George Clemmer Copyright © 2017 Andy Wingo Copyright © 2017, 2018, 2019, 2020 Arun Isaac Copyright © 2017 nee Copyright © 2018 Rutger Helling Copyright © 2018, 2021 Oleg Pykhalov Copyright © 2018 Mike Gerwitz Copyright © 2018 Pierre-Antoine Rouby Copyright © 2018, 2019 Gábor Boskovits Copyright © 2018, 2019, 2020, 2022 Florian Pelz Copyright © 2018 Laura Lazzati Copyright © 2018 Alex Vong Copyright © 2019 Josh Holland Copyright © 2019, 2020 Diego Nicola Barbato Copyright © 2019 Ivan Petkov Copyright © 2019 Jakob L. Kreuze Copyright © 2019 Kyle Andrews Copyright © 2019 Alex Griffin Copyright © 2019, 2020, 2021, 2022 Guillaume Le Vaillant Copyright © 2020 Liliana Marie Prikler Copyright © 2019, 2020, 2021, 2022 Simon Tournier Copyright © 2020 Wiktor Żelazny Copyright © 2020 Damien Cassou Copyright © 2020 Jakub Kądziołka Copyright © 2020 Jack Hill Copyright © 2020 Naga Malleswari Copyright © 2020, 2021 Brice Waegeneire Copyright © 2020 R Veera Kumar Copyright © 2020, 2021 Pierre Langlois Copyright © 2020 pinoaffe Copyright © 2020 André Batista Copyright © 2020, 2021 Alexandru-Sergiu Marton Copyright © 2020 raingloom Copyright © 2020 Daniel Brooks Copyright © 2020 John Soo Copyright © 2020 Jonathan Brielmaier Copyright © 2020 Edgar Vincent Copyright © 2021, 2022 Maxime Devos Copyright © 2021 B. Wilson Copyright © 2021 Xinglu Chen Copyright © 2021 Raghav Gururajan Copyright © 2021 Domagoj Stolfa Copyright © 2021 Hui Lu Copyright © 2021 pukkamustard Copyright © 2021 Alice Brenon Copyright © 2021, 2022 Josselin Poiret Copyright © 2021 muradm Copyright © 2021, 2022 Andrew Tropin Copyright © 2021 Sarah Morgensen Copyright © 2022 Remco van ’t Veer Copyright © 2022 Aleksandr Vityazev Copyright © 2022 Philip M^{c}Grath Copyright © 2022 Karl Hallsby Copyright © 2022 Justin Veilleux Copyright © 2022 Reily Siegel Copyright © 2022 Simon Streit Copyright © 2022 ( Copyright © 2022 John Kehayias Permissão concedida para copiar, distribuir e/ou modificar este documento sob os termos da Licença de Documentação Livre GNU, Versão 1.3 ou qualquer versão mais recente publicada pela Free Software Foundation; sem Seções Invariantes, Textos de Capa Frontal, e sem Textos de Contracapa. Uma cópia da licença está incluída na seção intitulada “GNU Free Documentation License”. INFO-DIR-SECTION Administração de Sistemas START-INFO-DIR-ENTRY * Guix: (guix). Gerencie softwares instalados e configuração do sistema. * guix package: (guix)Invocando guix package. Instalando, removendo e atualizando pacotes. * guix gc: (guix)Invocando guix gc. Recuperando espaço em disco não utilizado. * guix pull: (guix)Invocando guix pull. Atualize a lista de pacotes disponíveis. * guix system: (guix)Invocando guix system. Gerencie a configuração do sistema operacional. * guix deploy: (guix)Invoking guix deploy. Manage operating system configurations for remote hosts. END-INFO-DIR-ENTRY INFO-DIR-SECTION Desenvolvimento de software START-INFO-DIR-ENTRY * guix shell: (guix)Invoking guix shell. Creating software environments. * guix environment: (guix)Invocando guix environment. Compilando ambientes de desenvolvimento com Guix. * guix build: (guix)Invocando guix build. Compilando pacotes. * guix pack: (guix)Invocando guix pack. Criando pacotes de binários. END-INFO-DIR-ENTRY  File: guix.pt_BR.info, Node: Top, Next: Introdução, Up: (dir) GNU Guix ******** Esse documento descreve Guix versão 1.4.0, uma ferramenta de gerenciamento de pacotes funcional escrita para o sistema GNU. This manual is also available in Simplified Chinese (*note (guix.zh_CN)Top::), French (*note (guix.fr)Top::), German (*note (guix.de)Top::), Spanish (*note (guix.es)Top::), Brazilian Portuguese (*note (guix.pt_BR)Top::), and Russian (*note (guix.ru)Top::). If you would like to translate it in your native language, consider joining Weblate (https://translate.fedoraproject.org/projects/guix/documentation-manual) (*note Traduzindo o Guix::). * Menu: * Introdução:: Sobre o que é o Guix? * Instalação:: Instalando o Guix. * Instalação do sistema:: Instalando todo o sistema operacional. * System Troubleshooting Tips:: When things don’t go as planned. * Primeiros passos:: Your first steps. * Gerenciamento de pacote:: Instalação de pacote, atualização, etc. * Canais:: Personalizando a coleção de pacotes. * Desenvolvimento:: Desenvolvimento de software auxiliado pelo Guix. * Interface de programação:: Usando o Guix no Scheme. * Utilitários:: Comandos de gerenciamento de pacote. * Foreign Architectures:: Build for foreign architectures. * Configuração do sistema:: Configurando o sistema operacional. * Home Configuration:: Configuring the home environment. * Documentação:: Navegando por manuais do usuário do software. * Platforms:: Defining platforms. * System Images:: Creating system images. * Instalando arquivos de depuração:: Alimentando o depurador. * Using TeX and LaTeX:: Typesetting. * Atualizações de segurança:: Implementando correções de segurança rapidamente. * Inicializando:: GNU/Linux compilado do zero. * Portando:: Objetivando outra plataforma ou kernel. * Contribuindo:: Sua ajuda é necessária! * Agradecimentos:: Obrigado! * Licença de Documentação Livre GNU:: A licença deste manual. * Índice de conceitos:: Conceitos. * Índice de programação:: Tipos de dados, funções e variáveis. — A listagem detalhada de nós — Introdução * Gerenciando software do jeito do Guix:: O que há de especial. * Distribuição GNU:: Os pacotes e as ferramentas. Instalação * Instalação de binários:: Faça o Guix funcionar rapidamente! * Requisitos:: Software necessário para compilar e executar o Guix. * Executando a suíte de testes:: Testando o Guix. * Configurando o daemon:: Preparando o ambiente do daemon de compilação. * Invocando guix-daemon:: Executando o daemon de compilação. * Configuração de aplicativo:: Configuração específica de aplicativo. * Upgrading Guix:: Upgrading Guix and its build daemon. Configurando o daemon * Configuração do ambiente de compilação:: Preparando o ambiente de compilação isolado. * Configuração de descarregamento de daemon:: Descarregando compilações para máquinas remotas. * Suporte a SELinux:: Usando um política SELinux para o daemon. Instalação do sistema * Limitações:: O que você pode esperar. * Considerações de hardware:: Hardware suportado. * Instalação em um pendrive e em DVD:: Preparando a mídia de instalação. * Preparando para instalação:: Rede, particionamento, etc. * Instalação gráfica guiada:: Instalação gráfica fácil. * Instalação manual:: Instalação manual para magos. * Após a instalação do sistema:: Quando a instalação conclui com sucesso. * Instalando Guix em um VM:: Parque de diversões do Guix System. * Compilando a imagem de instalação:: Como isso vem a ser. System Troubleshooting Tips * Chrooting into an existing system:: Fixing things from a chroot Instalação manual * Disposição de teclado e rede e particionamento:: Configuração inicial. * Prosseguindo com a instalação:: Instalando. Gerenciamento de pacote * Recursos:: Como o Guix vai iluminar a sua vida. * Invocando guix package:: Instalação de pacote, remoção, etc. * Substitutos:: Baixando binários pré-compilados. * Pacotes com múltiplas saídas:: Um único pacote de fontes, várias saídas. * Invocando guix gc:: Executando o coletor de lixo. * Invocando guix pull:: Obtendo o Guix mais recente e distribuição. * Invoking guix time-machine:: Running an older revision of Guix. * Inferiores:: Interagindo com outra revisão do Guix. * Invocando guix describe:: Exibe informações sobre sua revisão do Guix. * Invocando guix archive:: Exportando e importando arquivos do armazém. Substitutos * Official Substitute Servers:: Uma fonte específica de substitutos. * Autorização de servidor substituto:: Como habilitar ou desabilitar substitutos. * Getting Substitutes from Other Servers:: Substitute diversity. * Autenticação de substituto:: Como Guix verifica substitutos. * Configurações de proxy:: Como obter substitutos via proxy. * Falha na substituição:: O que acontece quando a substituição falha. * Confiança em binários:: Como você pode confiar naquele blob binário? Canais * Specifying Additional Channels:: Extending the package collection. * Using a Custom Guix Channel:: Using a customized Guix. * Replicating Guix:: Running the _exact same_ Guix. * Channel Authentication:: How Guix verifies what it fetches. * Channels with Substitutes:: Using channels with available substitutes. * Creating a Channel:: How to write your custom channel. * Package Modules in a Sub-directory:: Specifying the channel’s package modules location. * Declaring Channel Dependencies:: How to depend on other channels. * Specifying Channel Authorizations:: Defining channel authors authorizations. * Primary URL:: Distinguishing mirror to original. * Writing Channel News:: Communicating information to channel’s users. Desenvolvimento * Invoking guix shell:: Spawning one-off software environments. * Invocando guix environment:: Configurando ambientes de desenvolvimento. * Invocando guix pack:: Criando pacotes de software. * The GCC toolchain:: Working with languages supported by GCC. * Invoking guix git authenticate:: Authenticating Git repositories. Interface de programação * Módulos de pacote:: Pacotes do ponto de vista do programador. * Definindo pacotes:: Definindo novos pacotes. * Defining Package Variants:: Customizing packages. * Writing Manifests:: The bill of materials of your environment. * Sistemas de compilação:: Especificando como pacotes são compilados. * Build Phases:: Phases of the build process of a package. * Build Utilities:: Helpers for your package definitions and more. * Search Paths:: Declaring search path environment variables. * O armazém:: Manipulação do armazém de pacotes. * Derivações:: Interface de baixo nível para derivações de pacotes. * A mônada do armazém:: Interface puramente funcional para o armazém. * Expressões-G:: Manipulação de expressões de compilação. * Invocando guix repl:: Programming Guix in Guile. * Using Guix Interactively:: Fine-grain interaction at the REPL. Definindo pacotes * Referência do package:: O tipo de dados package. * Referência do origin:: O tipo de dados origin. Utilitários * Invocando guix build:: Compilando pacotes a partir da linha de comando. * Invocando guix edit:: Editando definições de pacote. * Invocando guix download:: Baixando um arquivo e imprimindo seu hash. * Invocando guix hash:: Computando a hash criptográfica de um arquivo. * Invocando guix import:: Importando definições de pacote. * Invocando guix refresh:: Atualizando definições de pacotes. * Invoking guix style:: Styling package definitions. * Invocando guix lint:: Encontrando erros nas definições de pacote. * Invocando guix size:: Perfilando uso de disco. * Invocando guix graph:: Visualizando o grafo de pacotes. * Invocando guix publish:: Compartilhando substitutos. * Invocando guix challenge:: Desafiando servidores substitutos. * Invocando guix copy:: Copiando para e de um armazém remoto. * Invocando guix container:: Isolação de processo. * Invocando guix weather:: Acessando disponibilidade de substituto. * Invocando guix processes:: Listando processos do cliente. Invocando ‘guix build’ * Opções de compilação comum:: Opções de compilação para a maioria dos comandos. * Opções de transformação de pacote:: Criando variantes de pacotes. * Opções de compilação adicional:: Opções específicas para "guix build". * Depurando falhas de compilação:: Experiência de empacotamento na vida real. Foreign Architectures * Cross-Compilation:: Cross-compiling for another architecture. * Native Builds:: Targeting another architecture through native builds. Configuração do sistema * Usando o sistema de configuração:: Personalizando seu sistema GNU. * Referência do operating-system:: Detalhe das declarações do operating-system. * Sistemas de arquivos:: Configurando montagens de sistema de arquivos. * Dispositivos mapeados:: Processamento extra de dispositivo de bloco. * Swap Space:: Backing RAM with disk space. * Contas de usuários:: Especificando contas de usuários. * Disposição do teclado:: Como o sistema interpreta pressionamento de teclas. * Locales:: Configurações de idioma e de convenção cultural. * Serviços:: Especificando serviços de sistema. * Programas setuid:: Programs running with elevated privileges. * Certificados X.509:: Autenticando servidores HTTPS. * Name Service Switch:: Configurando name service switch do libc. * Disco de RAM inicial:: Inicialização do Linux-Libre. * Configuração do carregador de inicialização:: Configurando o "bootloader". * Invocando guix system:: Inicializando uma configuração de sistema. * Invoking guix deploy:: Deploying a system configuration to a remote host. * Executando Guix em uma VM:: Como executar Guix System em uma máquina virtual. * Definindo serviços:: Adicionando novas definições de serviço. Home Environment Configuration * Invoking guix home:: Instantiating a home environment configuration. Serviços * Serviços base:: Serviços essenciais do sistema. * Execução de trabalho agendado:: O serviço mcron. * Rotação de log:: O serviço rottlog. * Networking Setup:: Configurando interfaces de rede. * Serviços de Rede:: Firewall, SSH daemon, etc. * Unattended Upgrades:: Automated system upgrades. * X Window:: Exibição gráfica. * Serviços de impressão:: Suporte a impressora local e remota. * Serviços de desktop:: Serviços de D-Bus e desktop. * Serviços de som:: Serviços ALSA e Pulseaudio. * Serviços de bancos de dados:: Banco de dados SQL, armazenamentos de valor chave, etc. * Serviços de correio:: IMAP, POP3, SMTP e tudo isso. * Serviços de mensageria:: Serviços de mensageria. * Serviços de telefonia:: Serviços de telefonia. * Serviços de monitoramento:: Serviços de monitoramento. * Serviços Kerberos:: Serviços Kerberos. * LDAP Services:: LDAP services. * Serviços Web:: Servidores Web. * Serviços de certificado:: Certificados TLS via Let’s Encrypt. * Serviços DNS:: Deamons DNS. * Serviços VPN:: Deamons VPN. * Sistema de arquivos de rede:: Serviços relacionados a NFS. * Samba Services:: Samba services. * Integração contínua:: Cuirass and Laminar services. * Serviços de gerenciamento de energia:: Estendendo a vida da bateria. * Serviços de áudio:: O MPD. * Serviços de virtualização:: Serviços de virtualização. * Serviços de controlando versão:: Fornecendo acesso remoto a repositórios Git. * Serviços de jogos:: Servidores de jogos. * PAM Mount Service:: Service to mount volumes when logging in. * Guix Services:: Services relating specifically to Guix. * Linux Services:: Services tied to the Linux kernel. * Hurd Services:: Services specific for a Hurd System. * Serviços diversos:: Outros serviços. Definindo serviços * Composição de serviço:: O modelo para serviços de composição. * Tipos de Service e Serviços:: Tipos e serviços. * Referência de Service:: Referência de API. * Serviços de Shepherd:: Um tipo em particular de serviço. * Complex Configurations:: Defining bindings for complex configurations. Platforms * platform Reference:: Detail of platform declarations. * Supported Platforms:: Description of the supported platforms. System Images * image Reference:: Detail of image declarations. * Instantiate an Image:: How to instantiate an image record. * image-type Reference:: Detail of image types declaration. * Image Modules:: Definition of image modules. Instalando arquivos de depuração * Separate Debug Info:: Installing ’debug’ outputs. * Rebuilding Debug Info:: Building missing debug info. Inicializando * Reduced Binary Seed Bootstrap:: A Bootstrap worthy of GNU. * Preparing to Use the Bootstrap Binaries:: Building that what matters most.  File: guix.pt_BR.info, Node: Introdução, Next: Instalação, Prev: Top, Up: Top 1 Introdução ************ GNU Guix(1) é uma ferramenta de gerenciamento de pacotes e distribuição do sistema GNU. O Guix facilita a instalação, a atualização ou a remoção de pacotes de software, a reversão para um conjunto de pacotes anterior, a compilação de pacotes a partir do código-fonte e geralmente ajuda na criação e manutenção de ambientes de software. Você pode instalar o GNU Guix sobre um sistema GNU/Linux existente, onde ele complementa as ferramentas disponíveis sem interferência (*note Instalação::) ou você pode usá-lo como uma distribuição de sistema operacional independente, “Guix System”(2). *Note Distribuição GNU::. * Menu: * Gerenciando software do jeito do Guix:: O que há de especial. * Distribuição GNU:: Os pacotes e as ferramentas. ---------- Footnotes ---------- (1) “Guix” é pronunciado como “geeks”, ou “ɡiːks” usando o alfabeto fonético internacional (IPA). (2) Costumávamos nos referir ao Guix System como “Guix System Distribution” ou “GuixSD”. Agora consideramos que faz mais sentido agrupar tudo sob o banner “Guix”, pois, afinal, o Guix System está prontamente disponível através do comando ‘guix system’, mesmo se você estiver usando uma distribuição diferente por baixo!  File: guix.pt_BR.info, Node: Gerenciando software do jeito do Guix, Next: Distribuição GNU, Up: Introdução 1.1 Gerenciando software do jeito do Guix ========================================= Guix provides a command-line package management interface (*note Gerenciamento de pacote::), tools to help with software development (*note Desenvolvimento::), command-line utilities for more advanced usage (*note Utilitários::), as well as Scheme programming interfaces (*note Interface de programação::). O “build daemon” é responsável por compilar pacotes em nome dos usuários (*note Configurando o daemon::) e por baixar binários pré-compilados de fontes autorizados (*note Substitutos::). Guix inclui definições de pacotes para muitos pacotes GNU e não-GNU, todos os quais respeitam a liberdade de computação do usuário (https://www.gnu.org/philosophy/free-sw.html). É _extensível_: os usuários podem escrever suas próprias definições de pacotes (*note Definindo pacotes::) e disponibilizá-los como módulos de pacotes independentes (*note Módulos de pacote::). Também é _personalizável_: os usuários podem _derivar_ definições de pacotes especializados das existentes, incluindo da linha de comando (*note Opções de transformação de pacote::). Nos bastidores, a Guix implementa a disciplina “gerenciamento de pacotes funcional” pioneira da Nix (*note Agradecimentos::). No Guix, o processo de compilação e instalação de pacotes é visto como uma _função_, no sentido matemático. Essa função recebe entradas, como scripts de compilação, um compilador e bibliotecas, e retorna um pacote instalado. Como uma função pura, seu resultado depende apenas de suas entradas – por exemplo, não pode fazer referência a um software ou scripts que não foram explicitamente passados como entradas. Uma função de compilação sempre produz o mesmo resultado ao passar por um determinado conjunto de entradas. Não pode alterar o ambiente do sistema em execução de qualquer forma; por exemplo, ele não pode criar, modificar ou excluir arquivos fora de seus diretórios de compilação e instalação. Isto é conseguido através da execução de processos de compilação em ambientes isolados (ou “containers”), onde somente suas entradas explícitas são visíveis. O resultado das funções de compilação do pacote é mantido (“cached”) no sistema de arquivos, em um diretório especial chamado “armazém” (*note O armazém::). Cada pacote é instalado em um diretório próprio no armazém – por padrão, em ‘/gnu/store’. O nome do diretório contém um hash de todas as entradas usadas para compilar esse pacote; Assim, a alteração uma entrada gera um nome de diretório diferente. Essa abordagem é a fundação para os principais recursos do Guix: suporte para atualização transacional de pacotes e reversão, instalação por usuário e coleta de lixo de pacotes (*note Recursos::).  File: guix.pt_BR.info, Node: Distribuição GNU, Prev: Gerenciando software do jeito do Guix, Up: Introdução 1.2 Distribuição GNU ==================== O Guix vem com uma distribuição do sistema GNU que consiste inteiramente de software livre(1). A distribuição pode ser instalada por conta própria (*note Instalação do sistema::), mas também é possível instalar o Guix como um gerenciador de pacotes em cima de um sistema GNU/Linux instalado (*note Instalação::). Quando precisamos distinguir entre os dois, nos referimos à distribuição independente como Guix System. A distribuição fornece pacotes GNU principais, como GNU libc, GCC e Binutils, além de muitos aplicativos GNU e não GNU. A lista completa de pacotes disponíveis pode ser acessada online (https://www.gnu.org/software/guix/packages) ou executando ‘guix package’ (*note Invocando guix package::): guix package --list-available Nosso objetivo é fornecer uma distribuição prática e 100% de software livre, baseada em Linux e outras variantes do GNU, com foco na promoção e forte integração de componentes do GNU e ênfase em programas e ferramentas que ajudam os usuários a exercer essa liberdade. Os pacotes estão atualmente disponíveis nas seguintes plataformas: ‘x86_64-linux’ Intel/AMD ‘x86_64’ architecture, Linux-Libre kernel. ‘i686-linux’ Intel 32-bit architecture (IA32), Linux-Libre kernel. ‘armhf-linux’ Arquitetura ARMv7-A com hard float, Thumb-2 e NEON, usando a interface binária de aplicativos EABI hard-float (ABI) e o kernel Linux-Libre. ‘aarch64-linux’ little-endian 64-bit ARMv8-A processors, Linux-Libre kernel. ‘i586-gnu’ GNU/Hurd (https://hurd.gnu.org) on the Intel 32-bit architecture (IA32). This configuration is experimental and under development. The easiest way for you to give it a try is by setting up an instance of ‘hurd-vm-service-type’ on your GNU/Linux machine (*note ‘hurd-vm-service-type’: transparent-emulation-qemu.). *Note Contribuindo::, on how to help! ‘mips64el-linux (unsupported)’ little-endian 64-bit MIPS processors, specifically the Loongson series, n32 ABI, and Linux-Libre kernel. This configuration is no longer fully supported; in particular, there is no ongoing work to ensure that this architecture still works. Should someone decide they wish to revive this architecture then the code is still available. ‘powerpc-linux (unsupported)’ big-endian 32-bit PowerPC processors, specifically the PowerPC G4 with AltiVec support, and Linux-Libre kernel. This configuration is not fully supported and there is no ongoing work to ensure this architecture works. ‘powerpc64le-linux’ little-endian 64-bit Power ISA processors, Linux-Libre kernel. This includes POWER9 systems such as the RYF Talos II mainboard (https://www.fsf.org/news/talos-ii-mainboard-and-talos-ii-lite-mainboard-now-fsf-certified-to-respect-your-freedom). This platform is available as a "technology preview": although it is supported, substitutes are not yet available from the build farm (*note Substitutos::), and some packages may fail to build (*note Tracking Bugs and Patches::). That said, the Guix community is actively working on improving this support, and now is a great time to try it and get involved! ‘riscv64-linux’ little-endian 64-bit RISC-V processors, specifically RV64GC, and Linux-Libre kernel. This platform is available as a "technology preview": although it is supported, substitutes are not yet available from the build farm (*note Substitutos::), and some packages may fail to build (*note Tracking Bugs and Patches::). That said, the Guix community is actively working on improving this support, and now is a great time to try it and get involved! Com o Guix System, você _declara_ todos os aspectos da configuração do sistema operacional, e o Guix cuida de instanciar a configuração de maneira transacional, reproduzível e sem estado (*note Configuração do sistema::). O Guix System usa o kernel Linux-libre, o sistema de inicialização Shepherd (*note (shepherd)Introduction::), os conhecidos utilitários do GNU e cadeia de ferramentas, bem como o ambiente gráfico ou os serviços de sistema do sua escolha. Guix System is available on all the above platforms except ‘mips64el-linux’, ‘powerpc-linux’, ‘powerpc64le-linux’ and ‘riscv64-linux’. Para obter informações sobre como portar para outras arquiteturas ou kernels, *note Portando::. A construção desta distribuição é um esforço cooperativo e você está convidado a participar! *Note Contribuindo::, para obter informações sobre como você pode ajudar. ---------- Footnotes ---------- (1) O termo “free” em “free software“ se refere à liberdade fornecida aos usuários desse software (https://www.gnu.org/philosophy/free-sw.html). A ambiguidade no termo em inglês não ocorre na tradução para português “livre“.  File: guix.pt_BR.info, Node: Instalação, Next: Instalação do sistema, Prev: Introdução, Up: Top 2 Instalação ************ Nota: Recomendamos o uso deste script de instalação do shell (https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh) para instalar o Guix sobre o sistema GNU/Linux que você esteja usando, posteriormente denominado “distro alheia”.(1) O script automatiza o download, a instalação e a configuração inicial do Guix. Ele deve ser executado como usuário root. Quando instalado sobre uma distro alheia. GNU Guix complementa as ferramentas disponíveis sem interferência. Seus dados residem exclusivamente em dois diretórios, geralmente ‘/gnu/store’ e ‘/var/guix’; outros arquivos no seu sistema, como ‘/etc’, são deixados intactos. Uma vez instalado, o Guix pode ser atualizado executando ‘guix pull’ (*note Invocando guix pull::). Se você preferir executar as etapas de instalação manualmente ou desejar ajustá-las, poderá achar úteis as seguintes subseções. Eles descrevem os requisitos de software do Guix, bem como instalá-lo manualmente e se preparar para usá-lo. * Menu: * Instalação de binários:: Faça o Guix funcionar rapidamente! * Requisitos:: Software necessário para compilar e executar o Guix. * Executando a suíte de testes:: Testando o Guix. * Configurando o daemon:: Preparando o ambiente do daemon de compilação. * Invocando guix-daemon:: Executando o daemon de compilação. * Configuração de aplicativo:: Configuração específica de aplicativo. * Upgrading Guix:: Upgrading Guix and its build daemon. ---------- Footnotes ---------- (1) Esta seção trata da instalação do gerenciador de pacotes, que pode ser feita sobre um sistema GNU/Linux atualmente em uso. Se, em vez disso, você deseja instalar o sistema operacional GNU completo, *note Instalação do sistema::.  File: guix.pt_BR.info, Node: Instalação de binários, Next: Requisitos, Up: Instalação 2.1 Instalação de binários ========================== Esta seção descreve como instalar o Guix em um sistema arbitrário a partir de um tarball independente que fornece binários para o Guix e para todas as suas dependências. Isso geralmente é mais rápido do que instalar do código-fonte, o que é descrito nas próximas seções. O único requisito é ter o GNU tar e Xz. Nota: We recommend the use of this shell installer script (https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh). The script automates the download, installation, and initial configuration steps described below. It should be run as the root user. As root, you can thus run this: cd /tmp wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh chmod +x guix-install.sh ./guix-install.sh If you’re running Debian or a derivative such as Ubuntu, you can instead install the package (it might be a version older than 1.4.0 but you can update it afterwards by running ‘guix pull’): sudo apt install guix Likewise on openSUSE: sudo zypper install guix When you’re done, *note Configuração de aplicativo:: for extra configuration you might need, and *note Primeiros passos:: for your first steps! A instalação segue as seguintes linhas: 1. Download the binary tarball from ‘https://ftp.gnu.org/gnu/guix/guix-binary-1.4.0.x86_64-linux.tar.xz’, where ‘x86_64-linux’ can be replaced with ‘i686-linux’ for an ‘i686’ (32-bits) machine already running the kernel Linux, and so on (*note Distribuição GNU::). Certifique-se de baixar o arquivo ‘.sig’ associado e verificar a autenticidade do tarball, seguindo estas linhas: $ wget https://ftp.gnu.org/gnu/guix/guix-binary-1.4.0.x86_64-linux.tar.xz.sig $ gpg --verify guix-binary-1.4.0.x86_64-linux.tar.xz.sig Se esse comando falhar porque você não possui a chave pública requerida, execute este comando para importá-lo: $ wget 'https://sv.gnu.org/people/viewgpg.php?user_id=15145' \ -qO - | gpg --import - e execute novamente o comando ‘gpg --verify’. Take note that a warning like “This key is not certified with a trusted signature!” is normal. 2. Agora, você precisa se tornar o usuário ‘root’. Dependendo de sua distribuição, você pode ter que executar ‘su -’ ou ‘sudo -i’. Como ‘root’, execute: # cd /tmp # tar --warning=no-timestamp -xf \ /path/to/guix-binary-1.4.0.x86_64-linux.tar.xz # mv var/guix /var/ && mv gnu / This creates ‘/gnu/store’ (*note O armazém::) and ‘/var/guix’. The latter contains a ready-to-use profile for ‘root’ (see next step). _Não_ descompacte o tarball em um sistema Guix funcional, pois isso substituiria seus próprios arquivos essenciais. The ‘--warning=no-timestamp’ option makes sure GNU tar does not emit warnings about “implausibly old time stamps” (such warnings were triggered by GNU tar 1.26 and older; recent versions are fine). They stem from the fact that all the files in the archive have their modification time set to 1 (which means January 1st, 1970). This is done on purpose to make sure the archive content is independent of its creation time, thus making it reproducible. 3. Torne o perfil disponível sob ‘~root/.config/guix/current’, que é onde ‘guix pull’ vai instalar atualizações (*note Invocando guix pull::): # mkdir -p ~root/.config/guix # ln -sf /var/guix/profiles/per-user/root/current-guix \ ~root/.config/guix/current Source ‘etc/profile’ to augment ‘PATH’ and other relevant environment variables: # GUIX_PROFILE="`echo ~root`/.config/guix/current" ; \ source $GUIX_PROFILE/etc/profile 4. Crie o grupo e contas de usuário para compilar usuários conforme explicado abaixo (*note Configuração do ambiente de compilação::). 5. Execute o daemon e configure-o para iniciar automaticamente na inicialização do sistema. Se sua distro hospedeira usa o sistema init systemd, isso pode ser obtido com estes comandos: # cp ~root/.config/guix/current/lib/systemd/system/gnu-store.mount \ ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \ /etc/systemd/system/ # systemctl enable --now gnu-store.mount guix-daemon You may also want to arrange for ‘guix gc’ to run periodically: # cp ~root/.config/guix/current/lib/systemd/system/guix-gc.service \ ~root/.config/guix/current/lib/systemd/system/guix-gc.timer \ /etc/systemd/system/ # systemctl enable --now guix-gc.timer You may want to edit ‘guix-gc.service’ to adjust the command line options to fit your needs (*note Invocando guix gc::). Se sua distro hospedeira usa o sistema init Upstart: # initctl reload-configuration # cp ~root/.config/guix/current/lib/upstart/system/guix-daemon.conf \ /etc/init/ # start guix-daemon Caso contrário, você ainda pode iniciar o daemon manualmente com: # ~root/.config/guix/current/bin/guix-daemon \ --build-users-group=guixbuild 6. Disponibilize o comando ‘guix’ para outros usuários na máquina, por exemplo, com: # mkdir -p /usr/local/bin # cd /usr/local/bin # ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix Também é uma boa ideia disponibilizar a versão Info deste manual: # mkdir -p /usr/local/share/info # cd /usr/local/share/info # for i in /var/guix/profiles/per-user/root/current-guix/share/info/* ; do ln -s $i ; done That way, assuming ‘/usr/local/share/info’ is in the search path, running ‘info guix’ will open this manual (*note (texinfo)Other Info Directories::, for more details on changing the Info search path). 7. To use substitutes from ‘ci.guix.gnu.org’, ‘bordeaux.guix.gnu.org’ or a mirror (*note Substitutos::), authorize them: # guix archive --authorize < \ ~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub # guix archive --authorize < \ ~root/.config/guix/current/share/guix/bordeaux.guix.gnu.org.pub Nota: If you do not enable substitutes, Guix will end up building _everything_ from source on your machine, making each installation and upgrade very expensive. *Note Confiança em binários::, for a discussion of reasons why one might want do disable substitutes. 8. Cada usuário pode precisar executar algumas etapas adicionais para tornar seu ambiente Guix pronto para uso, *note Configuração de aplicativo::. Voilà, a instalação está completa! Você pode confirmar que o Guix está funcionando instalando um pacote de amostra no perfil raiz: # guix install hello O tarball da instalação binária pode ser (re)produzido e verificado simplesmente executando o seguinte comando na árvore de código-fonte do Guix: make guix-binary.SYSTEM.tar.xz ... que, por sua vez, executa: guix pack -s SYSTEM --localstatedir \ --profile-name=current-guix guix *Note Invocando guix pack::, para mais informações sobre essa ferramenta útil.  File: guix.pt_BR.info, Node: Requisitos, Next: Executando a suíte de testes, Prev: Instalação de binários, Up: Instalação 2.2 Requisitos ============== Esta seção lista os requisitos ao compilar o Guix a partir do fonte. O procedimento de compilação do Guix é o mesmo que para outros softwares GNU, e não é coberto aqui. Por favor, veja os arquivos ‘README’ e ‘INSTALL’ na árvore fonte do Guix para detalhes adicionais. O GNU Guix está disponível para download em seu site em . GNU Guix depende dos seguintes pacotes: • GNU Guile (https://gnu.org/software/guile/), version 3.0.x, version 3.0.3 or later; • Guile-Gcrypt (https://notabug.org/cwebber/guile-gcrypt), versão 0.1.0 ou posterior; • Guile-GnuTLS (https://gitlab.com/gnutls/guile/) (*note how to install the GnuTLS bindings for Guile: (gnutls-guile)Guile Preparations.)(1); • Guile-SQLite3 (https://notabug.org/guile-sqlite3/guile-sqlite3), versão 0.1.0 ou posterior; • Guile-zlib (https://notabug.org/guile-zlib/guile-zlib), version 0.1.0 or later; • Guile-lzlib (https://notabug.org/guile-lzlib/guile-lzlib); • Guile-Avahi (https://www.nongnu.org/guile-avahi/); • Guile-Git (https://gitlab.com/guile-git/guile-git), version 0.5.0 or later; • Guile-JSON (https://savannah.nongnu.org/projects/guile-json/) 4.3.0 or later; • GNU Make (https://www.gnu.org/software/make/). As seguintes dependências são opcionais: • Support for build offloading (*note Configuração de descarregamento de daemon::) and ‘guix copy’ (*note Invocando guix copy::) depends on Guile-SSH (https://github.com/artyom-poptsov/guile-ssh), version 0.13.0 or later. • Guile-zstd (https://notabug.org/guile-zstd/guile-zstd), for zstd compression and decompression in ‘guix publish’ and for substitutes (*note Invocando guix publish::). • Guile-Semver (https://ngyro.com/software/guile-semver.html) for the ‘crate’ importer (*note Invocando guix import::). • Guile-Lib (https://www.nongnu.org/guile-lib/doc/ref/htmlprag/) for the ‘go’ importer (*note Invocando guix import::) and for some of the “updaters” (*note Invocando guix refresh::). • Quando libbz2 (http://www.bzip.org) está disponível, ‘guix-daemon’ pode usá-lo para comprimir logs de compilação. Unless ‘--disable-daemon’ was passed to ‘configure’, the following packages are also needed: • GNU libgcrypt (https://gnupg.org/); • SQLite 3 (https://sqlite.org); • GCC’s g++ (https://gcc.gnu.org), com suporte ao padrão C++11. When configuring Guix on a system that already has a Guix installation, be sure to specify the same state directory as the existing installation using the ‘--localstatedir’ option of the ‘configure’ script (*note ‘localstatedir’: (standards)Directory Variables.). Usually, this LOCALSTATEDIR option is set to the value ‘/var’. The ‘configure’ script protects against unintended misconfiguration of LOCALSTATEDIR so you do not inadvertently corrupt your store (*note O armazém::). ---------- Footnotes ---------- (1) The Guile bindings to GnuTLS (https://gnutls.org/) were distributed as part of GnuTLS until version 3.7.8 included.  File: guix.pt_BR.info, Node: Executando a suíte de testes, Next: Configurando o daemon, Prev: Requisitos, Up: Instalação 2.3 Executando a suíte de testes ================================ Depois que um ‘configure’ e ‘make’ bem-sucedido forem executados, é uma boa ideia executar o conjunto de testes. Ele pode ajudar a detectar problemas com a configuração ou o ambiente, ou com bugs no próprio Guix – e realmente, relatar falhas de teste é uma boa maneira de ajudar a melhorar o software. Para executar o conjunto de testes, digite: make check Os casos de teste podem ser executados em paralelo: você pode usar a opção ‘-j’ do GNU make para acelerar as coisas. A primeira execução pode levar alguns minutos em uma máquina recente; as execuções subsequentes serão mais rápidas porque o armazém criado para fins de teste já terá vários itens no cache. Também é possível executar um subconjunto dos testes definindo a variável makefile ‘TESTS’ como neste exemplo: make check TESTS="tests/store.scm tests/cpio.scm" Por padrão, os resultados dos testes são exibidos em um nível de arquivo. Para ver os detalhes de cada caso de teste individual, é possível definir a variável makefile ‘SCM_LOG_DRIVER_FLAGS’ como neste exemplo: make check TESTS="tests/base64.scm" SCM_LOG_DRIVER_FLAGS="--brief=no" The underlying SRFI 64 custom Automake test driver used for the ’check’ test suite (located at ‘build-aux/test-driver.scm’) also allows selecting which test cases to run at a finer level, via its ‘--select’ and ‘--exclude’ options. Here’s an example, to run all the test cases from the ‘tests/packages.scm’ test file whose names start with “transaction-upgrade-entry”: export SCM_LOG_DRIVER_FLAGS="--select=^transaction-upgrade-entry" make check TESTS="tests/packages.scm" Those wishing to inspect the results of failed tests directly from the command line can add the ‘--errors-only=yes’ option to the ‘SCM_LOG_DRIVER_FLAGS’ makefile variable and set the ‘VERBOSE’ Automake makefile variable, as in: make check SCM_LOG_DRIVER_FLAGS="--brief=no --errors-only=yes" VERBOSE=1 The ‘--show-duration=yes’ option can be used to print the duration of the individual test cases, when used in combination with ‘--brief=no’: make check SCM_LOG_DRIVER_FLAGS="--brief=no --show-duration=yes" *Note (automake)Parallel Test Harness:: for more information about the Automake Parallel Test Harness. Em caso de falha, envie um e-mail para e anexe o arquivo ‘test-suite.log’. Por favor, especifique a versão do Guix que está sendo usada, bem como os números de versão das dependências (*note Requisitos::) em sua mensagem. O Guix também vem com um conjunto de testes de sistema completo que testa instâncias completas do Guix System. Ele só pode ser executado em sistemas nos quais o Guix já está instalado, usando: make check-system ou, novamente, definindo ‘TESTS’ para selecionar um subconjunto de testes a serem executados: make check-system TESTS="basic mcron" Esses testes de sistema são definidos nos módulos ‘(gnu tests ...)’. Eles trabalham executando os sistemas operacionais em teste com instrumentação leve em uma máquina virtual (VM). Eles podem ser computacionalmente intensivos ou bastante baratos, dependendo se os substitutos estão disponíveis para suas dependências (*note Substitutos::). Alguns deles exigem muito espaço de armazenamento para armazenar imagens de VM. Novamente, em caso de falhas nos testes, por favor envie todos os detalhes.  File: guix.pt_BR.info, Node: Configurando o daemon, Next: Invocando guix-daemon, Prev: Executando a suíte de testes, Up: Instalação 2.4 Configurando o daemon ========================= Operações como compilar um pacote ou executar o coletor de lixo são todas executadas por um processo especializado, o “build daemon”, em nome dos clientes. Apenas o daemon pode acessar o armazém e seu banco de dados associado. Assim, qualquer operação que manipule o armazém passa pelo daemon. Por exemplo, ferramentas de linha de comando como ‘guix package’ e ‘guix build’ se comunicam com o daemon (via chamadas de procedimento remoto) para instruir o que fazer. As seções a seguir explicam como preparar o ambiente do daemon de compilação. Veja também *note Substitutos::, para informações sobre como permitir que o daemon baixe binários pré-compilados. * Menu: * Configuração do ambiente de compilação:: Preparando o ambiente de compilação isolado. * Configuração de descarregamento de daemon:: Descarregando compilações para máquinas remotas. * Suporte a SELinux:: Usando um política SELinux para o daemon.  File: guix.pt_BR.info, Node: Configuração do ambiente de compilação, Next: Configuração de descarregamento de daemon, Up: Configurando o daemon 2.4.1 Configuração do ambiente de compilação -------------------------------------------- Em uma configuração multiusuário padrão, o Guix e seu daemon – o programa ‘guix-daemon’ – são instalados pelo administrador do sistema; ‘/gnu/store’ é de propriedade de ‘root’ e ‘guix-daemon’ é executado como ‘root’. Usuários desprivilegiados podem usar ferramentas Guix para criar pacotes ou acessar o armazém, e o daemon fará isso em seu nome, garantindo que o armazém seja mantido em um estado consistente e permitindo que pacotes construídos sejam compartilhados entre os usuários. Quando ‘guix-daemon’ é executado como ‘root’, você pode não querer que os próprios processos de compilação de pacotes também sejam executados como ‘root’, por razões óbvias de segurança. Para evitar isso, um conjunto especial de “usuários de compilação” deve ser criado para uso pelos processos de construção iniciados pelo daemon. Esses usuários de compilação não precisam ter um shell e um diretório inicial: eles serão usados apenas quando o daemon der um privilégio ‘root’ nos processos de compilação. Ter vários desses usuários permite que o daemon ative processos de compilação distintos sob UIDs separados, o que garante que eles não interfiram uns com os outros - um recurso essencial, pois as compilações são consideradas funções puras (*note Introdução::). Em um sistema GNU/Linux, um conjunto de usuários de construção pode ser criado assim (usando a sintaxe Bash e os comandos ‘shadow’): # groupadd --system guixbuild # for i in $(seq -w 1 10); do useradd -g guixbuild -G guixbuild \ -d /var/empty -s $(which nologin) \ -c "Guix build user $i" --system \ guixbuilder$i; done O número de usuários de compilação determina quantos trabalhos de compilação podem ser executados em paralelo, conforme especificado pela opção ‘--max-jobs’ (*note ‘--max-jobs’: Invocando guix-daemon.). Para usar ‘guix system vm’ e comandos relacionados, você pode precisar adicionar os usuários de compilação ao grupo ‘kvm’ para que eles possam acessar ‘/dev/kvm’, usando ‘-G guixbuild,kvm’ em vez de ‘-G guixbuild’ (*note Invocando guix system::). The ‘guix-daemon’ program may then be run as ‘root’ with the following command(1): # guix-daemon --build-users-group=guixbuild Dessa forma, o daemon inicia os processos de compilação em um chroot, sob um dos usuários ‘guixbuilder’. No GNU/Linux, por padrão, o ambiente chroot contém nada além de: • um diretório ‘/dev’ mínimo, criado principalmente independentemente do ‘/dev’ do hospedeiro(2); • o diretório ‘/proc’; mostra apenas os processos do contêiner desde que um espaço de nome PID separado é usado; • ‘/etc/passwd’ com uma entrada para o usuário atual e uma entrada para o usuário ‘nobody’; • ‘/etc/group’ com uma entrada para o grupo de usuários; • ‘/etc/hosts’ com uma entrada que mapeia ‘localhost’ para ‘127.0.0.1’; • um diretório ‘/tmp’ com permissão de escrita. The chroot does not contain a ‘/home’ directory, and the ‘HOME’ environment variable is set to the non-existent ‘/homeless-shelter’. This helps to highlight inappropriate uses of ‘HOME’ in the build scripts of packages. You can influence the directory where the daemon stores build trees via the ‘TMPDIR’ environment variable. However, the build tree within the chroot is always called ‘/tmp/guix-build-NAME.drv-0’, where NAME is the derivation name—e.g., ‘coreutils-8.24’. This way, the value of ‘TMPDIR’ does not leak inside build environments, which avoids discrepancies in cases where build processes capture the name of their build tree. The daemon also honors the ‘http_proxy’ and ‘https_proxy’ environment variables for HTTP and HTTPS downloads it performs, be it for fixed-output derivations (*note Derivações::) or for substitutes (*note Substitutos::). If you are installing Guix as an unprivileged user, it is still possible to run ‘guix-daemon’ provided you pass ‘--disable-chroot’. However, build processes will not be isolated from one another, and not from the rest of the system. Thus, build processes may interfere with each other, and may access programs, libraries, and other files available on the system—making it much harder to view them as _pure_ functions. ---------- Footnotes ---------- (1) If your machine uses the systemd init system, copying the ‘PREFIX/lib/systemd/system/guix-daemon.service’ file to ‘/etc/systemd/system’ will ensure that ‘guix-daemon’ is automatically started. Similarly, if your machine uses the Upstart init system, copy the ‘PREFIX/lib/upstart/system/guix-daemon.conf’ file to ‘/etc/init’. (2) “Principalmente” porque enquanto o conjunto de arquivos que aparece no ‘/dev’ do chroot é corrigido, a maioria desses arquivos só pode ser criada se o hospedeiro os possuir.  File: guix.pt_BR.info, Node: Configuração de descarregamento de daemon, Next: Suporte a SELinux, Prev: Configuração do ambiente de compilação, Up: Configurando o daemon 2.4.2 Usando o recurso de descarregamento ----------------------------------------- When desired, the build daemon can “offload” derivation builds to other machines running Guix, using the ‘offload’ “build hook”(1). When that feature is enabled, a list of user-specified build machines is read from ‘/etc/guix/machines.scm’; every time a build is requested, for instance via ‘guix build’, the daemon attempts to offload it to one of the machines that satisfy the constraints of the derivation, in particular its system types—e.g., ‘x86_64-linux’. A single machine can have multiple system types, either because its architecture natively supports it, via emulation (*note Transparent Emulation with QEMU: transparent-emulation-qemu.), or both. Missing prerequisites for the build are copied over SSH to the target machine, which then proceeds with the build; upon success the output(s) of the build are copied back to the initial machine. The offload facility comes with a basic scheduler that attempts to select the best machine. The best machine is chosen among the available machines based on criteria such as: 1. The availability of a build slot. A build machine can have as many build slots (connections) as the value of the ‘parallel-builds’ field of its ‘build-machine’ object. 2. Its relative speed, as defined via the ‘speed’ field of its ‘build-machine’ object. 3. Its load. The normalized machine load must be lower than a threshold value, configurable via the ‘overload-threshold’ field of its ‘build-machine’ object. 4. Disk space availability. More than a 100 MiB must be available. O arquivo ‘/etc/guix/machines.scm’ geralmente se parece com isso: (list (build-machine (name "eightysix.example.org") (systems (list "x86_64-linux" "i686-linux")) (host-key "ssh-ed25519 AAAAC3Nza...") (user "bob") (speed 2.)) ;incredibly fast! (build-machine (name "armeight.example.org") (systems (list "aarch64-linux")) (host-key "ssh-rsa AAAAB3Nza...") (user "alice") ;; Remember 'guix offload' is spawned by ;; 'guix-daemon' as root. (private-key "/root/.ssh/identity-for-guix"))) In the example above we specify a list of two build machines, one for the ‘x86_64’ and ‘i686’ architectures and one for the ‘aarch64’ architecture. De fato, esse arquivo é – não surpreendentemente! – um arquivo de esquema que é avaliado quando o hook ‘offload’ é iniciado. Seu valor de retorno deve ser uma lista de objetos de ‘build-machine’. Embora este exemplo mostre uma lista fixa de máquinas de compilação, pode-se imaginar, digamos, usando DNS-SD para retornar uma lista de possíveis máquinas de compilação descobertas na rede local (*note Guile-Avahi: (guile-avahi)Introdução.). O tipo de dados de ‘build-machine’ está detalhado abaixo. -- build-machine: Data Type Esse tipo de dados representa máquinas de compilação nas quais o daemon pode descarregar compilações. Os campos importantes são: ‘name’ O nome de host da máquina remota. ‘systems’ The system types the remote machine supports—e.g., ‘(list "x86_64-linux" "i686-linux")’. ‘user’ A conta de usuário a ser usada ao conectar-se à máquina remota por SSH. Observe que o par de chaves SSH deve _não_ protegido por senha, para permitir logins não interativos. ‘host-key’ Essa deve ser a SSH “chave pública do host” da máquina no formato OpenSSH. Isso é usado para autenticar a máquina quando nos conectamos a ela. É uma string longa que se parece com isso: ssh-ed25519 AAAAC3NzaC...mde+UhL hint@example.org Se a máquina estiver executando o daemon OpenSSH, ‘sshd’, a chave do host poderá ser encontrada em um arquivo como ‘/etc/ssh/ssh_host_ed25519_key.pub’. Se a máquina estiver executando o daemon SSH do GNU lsh, ‘lshd’, a chave do host estará em ‘/etc/lsh/host-key.pub’ ou em um arquivo semelhante. Ele pode ser convertido para o formato OpenSSH usando o ‘lsh-export-key’ (*note (lsh)Converting keys::): $ lsh-export-key --openssh < /etc/lsh/host-key.pub ssh-rsa AAAAB3NzaC1yc2EAAAAEOp8FoQAAAQEAs1eB46LV... Vários campos opcionais podem ser especificados: ‘port’ (padrão: ‘22’) O número da porta para o servidor SSH na máquina. ‘private-key’ (padrão: ‘~root/.ssh/id_rsa’) O arquivo de chave privada SSH a ser usado ao conectar-se à máquina, no formato OpenSSH. Esta chave não deve ser protegida com uma senha. Observe que o valor padrão é a chave privada _da usuário root_. Verifique se ele existe se você usar o padrão. ‘compression’ (padrão: ‘"zlib@openssh.com,zlib"’) ‘compression-level’ (padrão: ‘3’) Os métodos de compactação no nível SSH e o nível de compactação solicitado. Observe que o descarregamento depende da compactação SSH para reduzir o uso da largura de banda ao transferir arquivos de e para máquinas de compilação. ‘daemon-socket’ (padrão: ‘"/var/guix/daemon-socket/socket"’) O nome do arquivo do soquete do domínio Unix ‘guix-daemon’ está escutando nessa máquina. ‘overload-threshold’ (default: ‘0.8’) The load threshold above which a potential offload machine is disregarded by the offload scheduler. The value roughly translates to the total processor usage of the build machine, ranging from 0.0 (0%) to 1.0 (100%). It can also be disabled by setting ‘overload-threshold’ to ‘#f’. ‘parallel-builds’ (padrão: ‘1’) O número de compilações que podem ser executadas paralelamente na máquina. ‘speed’ (padrão: ‘1.0’) Um “fator de velocidade relativo”. O agendador de descarregamento tenderá a preferir máquinas com um fator de velocidade mais alto. ‘features’ (padrão: ‘'()’) Uma lista de strgins que denotam recursos específicos suportados pela máquina. Um exemplo é ‘"kvm"’ para máquinas que possuem os módulos KVM Linux e o suporte de hardware correspondente. As derivações podem solicitar recursos pelo nome e serão agendadas nas máquinas de compilação correspondentes. O comando ‘guix’ deve estar no caminho de pesquisa nas máquinas de compilação. Você pode verificar se este é o caso executando: ssh build-machine guix repl --version Há uma última coisa a fazer quando o ‘machines.scm’ está em vigor. Como explicado acima, ao descarregar, os arquivos são transferidos entre os armazéns das máquinas. Para que isso funcione, primeiro você precisa gerar um par de chaves em cada máquina para permitir que o daemon exporte arquivos assinados de arquivos do armazém (*note Invocando guix archive::): # guix archive --generate-key Cada máquina de construção deve autorizar a chave da máquina principal para que ela aceite itens do armazém que recebe do mestre: # guix archive --authorize < master-public-key.txt Da mesma forma, a máquina principal deve autorizar a chave de cada máquina de compilação. Todo esse barulho com as chaves está aqui para expressar relações de confiança mútua de pares entre a máquina mestre e as de compilação. Concretamente, quando o mestre recebe arquivos de uma máquina de compilação (e vice-versa), seu daemon de compilação pode garantir que eles sejam genuínos, não tenham sido violados e que sejam assinados por uma chave autorizada. Para testar se sua configuração está operacional, execute este comando no nó principal: # guix offload test This will attempt to connect to each of the build machines specified in ‘/etc/guix/machines.scm’, make sure Guix is available on each machine, attempt to export to the machine and import from it, and report any error in the process. Se você quiser testar um arquivo de máquina diferente, basta especificá-lo na linha de comando: # guix offload test machines-qualif.scm Por fim, você pode testar o subconjunto das máquinas cujo nome corresponde a uma expressão regular como esta: # guix offload test machines.scm '\.gnu\.org$' Para exibir o carregamento atual de todos os hosts de compilação, execute este comando no nó principal: # guix offload status ---------- Footnotes ---------- (1) This feature is available only when Guile-SSH (https://github.com/artyom-poptsov/guile-ssh) is present.  File: guix.pt_BR.info, Node: Suporte a SELinux, Prev: Configuração de descarregamento de daemon, Up: Configurando o daemon 2.4.3 Suporte a SELinux ----------------------- O Guix inclui um arquivo de políticas do SELinux em ‘etc/guix-daemon.cil’ que pode ser instalado em um sistema em que o SELinux está ativado, para rotular os arquivos do Guix e especificar o comportamento esperado do daemon. Como o Guix System não fornece uma política básica do SELinux, a política do daemon não pode ser usada no Guix System. 2.4.3.1 Instalando a política do SELinux ........................................ Para instalar a política, execute esse comando como root: semodule -i etc/guix-daemon.cil Em seguida, altere o rótulo do sistema de arquivos com ‘restorecon’ ou por um mecanismo diferente fornecido pelo seu sistema. Depois que a política é instalada, o sistema de arquivos foi rotulado novamente e o daemon foi reiniciado, ele deve estar em execução no contexto ‘guix_daemon_t’. Você pode confirmar isso com o seguinte comando: ps -Zax | grep guix-daemon Monitore os arquivos de log do SELinux enquanto executa um comando como ‘guix build hello’ para se convencer de que o SELinux permite todas as operações necessárias. 2.4.3.2 Limitações .................. Esta política não é perfeita. Aqui está uma lista de limitações ou peculiaridades que devem ser consideradas ao implementar a política SELinux fornecida para o daemon Guix. 1. ‘guix_daemon_socket_t’ isn’t actually used. None of the socket operations involve contexts that have anything to do with ‘guix_daemon_socket_t’. It doesn’t hurt to have this unused label, but it would be preferable to define socket rules for only this label. 2. ‘guix gc’ não pode acessar links arbitrários para perfis. Por design, o rótulo do arquivo do destino de um link simbólico é independente do rótulo do arquivo do próprio link. Embora todos os perfis em $localstatedir estejam rotulados, os links para esses perfis herdam o rótulo do diretório em que estão. Para os links no diretório inicial do usuário, será ‘user_home_t’. Mas, para links do diretório inicial do usuário raiz, ou ‘/tmp’, ou do diretório de trabalho do servidor HTTP etc., isso não funcionará. ‘guix gc’ seria impedido de ler e seguir esses links. 3. O recurso do daemon de escutar conexões TCP pode não funcionar mais. Isso pode exigir regras extras, porque o SELinux trata os soquetes de rede de maneira diferente dos arquivos. 4. Atualmente, todos os arquivos com um nome correspondente à expressão regular ‘/gnu/store/.+-(guix-.+|profile)/bin/guix-daemon’ recebem o rótulo ‘guix_daemon_exec_t’; isso significa que _qualquer_ arquivo com esse nome em qualquer perfil poderá ser executado no domínio de ‘guix_daemon_t’. Isto não é o ideal. Um invasor pode criar um pacote que forneça esse executável e convencer um usuário a instalar e executá-lo, o que o eleva ao domínio de ‘guix_daemon_t’. Nesse ponto, o SELinux não poderia impedir o acesso a arquivos permitidos para processos nesse domínio. You will need to relabel the store directory after all upgrades to ‘guix-daemon’, such as after running ‘guix pull’. Assuming the store is in ‘/gnu’, you can do this with ‘restorecon -vR /gnu’, or by other means provided by your operating system. Poderíamos gerar uma política muito mais restritiva no momento da instalação, para que apenas o nome do arquivo _exato_ do executável ‘guix-daemon’ atualmente instalado seja rotulado com ‘guix_daemon_exec_t’, em vez de usar um amplo expressão regular. A desvantagem é que o root precisaria instalar ou atualizar a política no momento da instalação sempre que o pacote Guix que fornece o executável ‘guix-daemon’ em execução efetiva for atualizado.  File: guix.pt_BR.info, Node: Invocando guix-daemon, Next: Configuração de aplicativo, Prev: Configurando o daemon, Up: Instalação 2.5 Invocando ‘guix-daemon’ =========================== O programa ‘guix-daemon’ implementa todas as funcionalidades para acessar o armazém. Isso inclui iniciar processos de compilação, executar o coletor de lixo, consultar a disponibilidade de um resultado da compilação etc. É normalmente executado como ‘root’, assim: # guix-daemon --build-users-group=guixbuild This daemon can also be started following the systemd “socket activation” protocol (*note ‘make-systemd-constructor’: (shepherd)Service De- and Constructors.). Para detalhes sobre como configurá-lo, *note Configurando o daemon::. By default, ‘guix-daemon’ launches build processes under different UIDs, taken from the build group specified with ‘--build-users-group’. In addition, each build process is run in a chroot environment that only contains the subset of the store that the build process depends on, as specified by its derivation (*note derivation: Interface de programação.), plus a set of specific system directories. By default, the latter contains ‘/dev’ and ‘/dev/pts’. Furthermore, on GNU/Linux, the build environment is a “container”: in addition to having its own file system tree, it has a separate mount name space, its own PID name space, network name space, etc. This helps achieve reproducible builds (*note Recursos::). When the daemon performs a build on behalf of the user, it creates a build directory under ‘/tmp’ or under the directory specified by its ‘TMPDIR’ environment variable. This directory is shared with the container for the duration of the build, though within the container, the build tree is always called ‘/tmp/guix-build-NAME.drv-0’. The build directory is automatically deleted upon completion, unless the build failed and the client specified ‘--keep-failed’ (*note ‘--keep-failed’: Opções de compilação comum.). The daemon listens for connections and spawns one sub-process for each session started by a client (one of the ‘guix’ sub-commands). The ‘guix processes’ command allows you to get an overview of the activity on your system by viewing each of the active sessions and clients. *Note Invocando guix processes::, for more information. As seguintes opções de linha de comando são suportadas: ‘--build-users-group=GRUPO’ Obtém os usuários do GRUPO para executar os processos de compilação (*note usuários de compilação: Configurando o daemon.). ‘--no-substitutes’ Não use substitutos para compilar produtos. Ou seja, sempre crie coisas localmente, em vez de permitir downloads de binários pré-compilados (*note Substitutos::). When the daemon runs with ‘--no-substitutes’, clients can still explicitly enable substitution via the ‘set-build-options’ remote procedure call (*note O armazém::). ‘--substitute-urls=URLS’ Consider URLS the default whitespace-separated list of substitute source URLs. When this option is omitted, ‘https://ci.guix.gnu.org https://bordeaux.guix.gnu.org’ is used. Isso significa que os substitutos podem ser baixados de URLS, desde que assinados por uma assinatura confiável (*note Substitutos::). *Note Getting Substitutes from Other Servers::, for more information on how to configure the daemon to get substitutes from other servers. ‘--no-offload’ Do not use offload builds to other machines (*note Configuração de descarregamento de daemon::). That is, always build things locally instead of offloading builds to remote machines. ‘--cache-failures’ Armazena em cache as compilações que falharam. Por padrão, apenas compilações bem-sucedidas são armazenadas em cache. Quando essa opção é usada, o ‘guix gc --list-failures’ pode ser usado para consultar o conjunto de itens do armazém marcados como com falha; O ‘guix gc --clear-failures’ remove os itens do armazém do conjunto de falhas em cache. *Note Invocando guix gc::. ‘--cores=N’ ‘-c N’ Usa N núcleos de CPU para compilar cada derivação; ‘0’ significa todos disponíveis. The default value is ‘0’, but it may be overridden by clients, such as the ‘--cores’ option of ‘guix build’ (*note Invocando guix build::). The effect is to define the ‘NIX_BUILD_CORES’ environment variable in the build process, which can then use it to exploit internal parallelism—for instance, by running ‘make -j$NIX_BUILD_CORES’. ‘--max-jobs=N’ ‘-M N’ Permite no máximo N tarefas de compilação em paralelo. O valor padrão é ‘1’. Definir como ‘0’ significa que nenhuma compilação será executada localmente; em vez disso, o daemon descarregará as compilações (*note Configuração de descarregamento de daemon::) ou simplesmente falhará. ‘--max-silent-time=SEGUNDOS’ Quando o processo de compilação ou substituição permanecer em silêncio por mais de SEGUNDOS, encerra-o e relata uma falha de compilação. O valor padrão é ‘0’, que desativa o tempo limite. The value specified here can be overridden by clients (*note ‘--max-silent-time’: Opções de compilação comum.). ‘--timeout=SEGUNDOS’ Da mesma forma, quando o processo de compilação ou substituição durar mais que SEGUNDOS, encerra-o e relata uma falha de compilação. O valor padrão é ‘0’, que desativa o tempo limite. The value specified here can be overridden by clients (*note ‘--timeout’: Opções de compilação comum.). ‘--rounds=N’ Compila cada derivação N vezes seguidas e gera um erro se os resultados consecutivos da compilação não forem idênticos bit a bit. Observe que essa configuração pode ser substituída por clientes como ‘guix build’ (*note Invocando guix build::). Quando usado em conjunto com ‘--keep-failed’, uma saída de comparação é mantida no armazém, sob ‘/gnu/store/...-check’. Isso facilita procurar por diferenças entre os dois resultados. ‘--debug’ Produz uma saída de depuração. This is useful to debug daemon start-up issues, but then it may be overridden by clients, for example the ‘--verbosity’ option of ‘guix build’ (*note Invocando guix build::). ‘--chroot-directory=DIR’ adiciona DIR ao chroot de compilação. Isso pode alterar o resultado dos processos de compilação – por exemplo, se eles usam dependências opcionais encontradas em DIR quando estão disponíveis, e não o contrário. Por esse motivo, não é recomendável fazê-lo. Em vez disso, verifique se cada derivação declara todas as entradas necessárias. ‘--disable-chroot’ Desabilita compilações em chroot. O uso dessa opção não é recomendado, pois, novamente, isso permitiria que os processos de compilação obtivessem acesso a dependências não declaradas. Porém, é necessário quando o ‘guix-daemon’ está sendo executado em uma conta de usuário sem privilégios. ‘--log-compression=TIPO’ Compacta logs de compilação de aconrdo com TIPO, que pode ser um entre ‘gzip’, ‘bzip2’ e ‘none’. Unless ‘--lose-logs’ is used, all the build logs are kept in the LOCALSTATEDIR. To save space, the daemon automatically compresses them with gzip by default. ‘--discover[=yes|no]’ Whether to discover substitute servers on the local network using mDNS and DNS-SD. This feature is still experimental. However, here are a few considerations. 1. It might be faster/less expensive than fetching from remote servers; 2. There are no security risks, only genuine substitutes will be used (*note Autenticação de substituto::); 3. An attacker advertising ‘guix publish’ on your LAN cannot serve you malicious binaries, but they can learn what software you’re installing; 4. Servers may serve substitute over HTTP, unencrypted, so anyone on the LAN can see what software you’re installing. It is also possible to enable or disable substitute server discovery at run-time by running: herd discover guix-daemon on herd discover guix-daemon off ‘--disable-deduplication’ Desabilita “deduplicação” automática de arquivos no armazém. Por padrão, os arquivos adicionados ao armazém são automaticamente “deduplicados”: se um arquivo recém-adicionado for idêntico a outro encontrado no armazém, o daemon tornará o novo arquivo um link físico para o outro arquivo. Isso pode reduzir notavelmente o uso do disco, às custas de um leve aumento na carga de entrada/saída no final de um processo de criação. Esta opção desativa essa otimização. ‘--gc-keep-outputs[=yes|no]’ Diz se o coletor de lixo (GC) deve manter as saídas de derivações vivas. When set to ‘yes’, the GC will keep the outputs of any live derivation available in the store—the ‘.drv’ files. The default is ‘no’, meaning that derivation outputs are kept only if they are reachable from a GC root. *Note Invocando guix gc::, for more on GC roots. ‘--gc-keep-derivations[=yes|no]’ Diz se o coletor de lixo (GC) deve manter as derivações correspondentes às saídas vivas. When set to ‘yes’, as is the case by default, the GC keeps derivations—i.e., ‘.drv’ files—as long as at least one of their outputs is live. This allows users to keep track of the origins of items in their store. Setting it to ‘no’ saves a bit of disk space. In this way, setting ‘--gc-keep-derivations’ to ‘yes’ causes liveness to flow from outputs to derivations, and setting ‘--gc-keep-outputs’ to ‘yes’ causes liveness to flow from derivations to outputs. When both are set to ‘yes’, the effect is to keep all the build prerequisites (the sources, compiler, libraries, and other build-time tools) of live objects in the store, regardless of whether these prerequisites are reachable from a GC root. This is convenient for developers since it saves rebuilds or downloads. ‘--impersonate-linux-2.6’ On Linux-based systems, impersonate Linux 2.6. This means that the kernel’s ‘uname’ system call will report 2.6 as the release number. This might be helpful to build programs that (usually wrongfully) depend on the kernel version number. ‘--lose-logs’ Do not keep build logs. By default they are kept under ‘LOCALSTATEDIR/guix/log’. ‘--system=SYSTEM’ Assume SYSTEM as the current system type. By default it is the architecture/kernel pair found at configure time, such as ‘x86_64-linux’. ‘--listen=ENDPOINT’ Listen for connections on ENDPOINT. ENDPOINT is interpreted as the file name of a Unix-domain socket if it starts with ‘/’ (slash sign). Otherwise, ENDPOINT is interpreted as a host name or host name and port to listen to. Here are a few examples: ‘--listen=/gnu/var/daemon’ Listen for connections on the ‘/gnu/var/daemon’ Unix-domain socket, creating it if needed. ‘--listen=localhost’ Listen for TCP connections on the network interface corresponding to ‘localhost’, on port 44146. ‘--listen=128.0.0.42:1234’ Listen for TCP connections on the network interface corresponding to ‘128.0.0.42’, on port 1234. This option can be repeated multiple times, in which case ‘guix-daemon’ accepts connections on all the specified endpoints. Users can tell client commands what endpoint to connect to by setting the ‘GUIX_DAEMON_SOCKET’ environment variable (*note ‘GUIX_DAEMON_SOCKET’: O armazém.). Nota: The daemon protocol is _unauthenticated and unencrypted_. Using ‘--listen=HOST’ is suitable on local networks, such as clusters, where only trusted nodes may connect to the build daemon. In other cases where remote access to the daemon is needed, we recommend using Unix-domain sockets along with SSH. When ‘--listen’ is omitted, ‘guix-daemon’ listens for connections on the Unix-domain socket located at ‘LOCALSTATEDIR/guix/daemon-socket/socket’.  File: guix.pt_BR.info, Node: Configuração de aplicativo, Next: Upgrading Guix, Prev: Invocando guix-daemon, Up: Instalação 2.6 Configuração de aplicativo ============================== Ao usar Guix sobre uma distribuição GNU/Linux que não seja um Guix System — uma chamada “distro alheia” — algumas etapas adicionais são necessárias para colocar tudo no seu lugar. Aqui estão algumas delas. 2.6.1 Locales ------------- Packages installed via Guix will not use the locale data of the host system. Instead, you must first install one of the locale packages available with Guix and then define the ‘GUIX_LOCPATH’ environment variable: $ guix install glibc-locales $ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale Note that the ‘glibc-locales’ package contains data for all the locales supported by the GNU libc and weighs in at around 930 MiB(1). If you only need a few locales, you can define your custom locales package via the ‘make-glibc-utf8-locales’ procedure from the ‘(gnu packages base)’ module. The following example defines a package containing the various Canadian UTF-8 locales known to the GNU libc, that weighs around 14 MiB: (use-modules (gnu packages base)) (define my-glibc-locales (make-glibc-utf8-locales glibc #:locales (list "en_CA" "fr_CA" "ik_CA" "iu_CA" "shs_CA") #:name "glibc-canadian-utf8-locales")) The ‘GUIX_LOCPATH’ variable plays a role similar to ‘LOCPATH’ (*note ‘LOCPATH’: (libc)Locale Names.). There are two important differences though: 1. ‘GUIX_LOCPATH’ is honored only by the libc in Guix, and not by the libc provided by foreign distros. Thus, using ‘GUIX_LOCPATH’ allows you to make sure the programs of the foreign distro will not end up loading incompatible locale data. 2. libc suffixes each entry of ‘GUIX_LOCPATH’ with ‘/X.Y’, where ‘X.Y’ is the libc version—e.g., ‘2.22’. This means that, should your Guix profile contain a mixture of programs linked against different libc version, each libc version will only try to load locale data in the right format. This is important because the locale data format used by different libc versions may be incompatible. 2.6.2 Name Service Switch ------------------------- Ao usar o Guix em uma distro alheia, nós _recomendamos fortemente_ que o sistema use o “daemon de cache de serviço de nomes” da biblioteca C do GNU, ‘nscd’, que deve ouvir no soquete ‘/var/run/nscd/socket’. Caso não faça isso, os aplicativos instalados com Guix podem falhar em procurar nomes de máquina e contas de usuário, ou até mesmo travar. Os próximos parágrafos explicam o porquê. The GNU C library implements a “name service switch” (NSS), which is an extensible mechanism for “name lookups” in general: host name resolution, user accounts, and more (*note (libc)Name Service Switch::). Being extensible, the NSS supports “plugins”, which provide new name lookup implementations: for example, the ‘nss-mdns’ plugin allow resolution of ‘.local’ host names, the ‘nis’ plugin allows user account lookup using the Network information service (NIS), and so on. These extra “lookup services” are configured system-wide in ‘/etc/nsswitch.conf’, and all the programs running on the system honor those settings (*note (libc)NSS Configuration File::). When they perform a name lookup—for instance by calling the ‘getaddrinfo’ function in C—applications first try to connect to the nscd; on success, nscd performs name lookups on their behalf. If the nscd is not running, then they perform the name lookup by themselves, by loading the name lookup services into their own address space and running it. These name lookup services—the ‘libnss_*.so’ files—are ‘dlopen’’d, but they may come from the host system’s C library, rather than from the C library the application is linked against (the C library coming from Guix). And this is where the problem is: if your application is linked against Guix’s C library (say, glibc 2.24) and tries to load NSS plugins from another C library (say, ‘libnss_mdns.so’ for glibc 2.22), it will likely crash or have its name lookups fail unexpectedly. Running ‘nscd’ on the system, among other advantages, eliminates this binary incompatibility problem because those ‘libnss_*.so’ files are loaded in the ‘nscd’ process, not in applications themselves. 2.6.3 X11 Fonts --------------- The majority of graphical applications use Fontconfig to locate and load fonts and perform X11-client-side rendering. The ‘fontconfig’ package in Guix looks for fonts in ‘$HOME/.guix-profile’ by default. Thus, to allow graphical applications installed with Guix to display fonts, you have to install fonts with Guix as well. Essential font packages include ‘font-ghostscript’, ‘font-dejavu’, and ‘font-gnu-freefont’. Once you have installed or removed fonts, or when you notice an application that does not find fonts, you may need to install Fontconfig and to force an update of its font cache by running: guix install fontconfig fc-cache -rv To display text written in Chinese languages, Japanese, or Korean in graphical applications, consider installing ‘font-adobe-source-han-sans’ or ‘font-wqy-zenhei’. The former has multiple outputs, one per language family (*note Pacotes com múltiplas saídas::). For instance, the following command installs fonts for Chinese languages: guix install font-adobe-source-han-sans:cn Older programs such as ‘xterm’ do not use Fontconfig and instead rely on server-side font rendering. Such programs require to specify a full name of a font using XLFD (X Logical Font Description), like this: -*-dejavu sans-medium-r-normal-*-*-100-*-*-*-*-*-1 To be able to use such full names for the TrueType fonts installed in your Guix profile, you need to extend the font path of the X server: xset +fp $(dirname $(readlink -f ~/.guix-profile/share/fonts/truetype/fonts.dir)) After that, you can run ‘xlsfonts’ (from ‘xlsfonts’ package) to make sure your TrueType fonts are listed there. 2.6.4 Certificados X.509 ------------------------ The ‘nss-certs’ package provides X.509 certificates, which allow programs to authenticate Web servers accessed over HTTPS. Ao usar uma Guix em uma distro alheia, você pode instalar esse pacote e definir as variáveis de ambiente relevantes de forma que os pacotes saibam onde procurar por certificados. *Note Certificados X.509::, para informações detalhadas. 2.6.5 Emacs Packages -------------------- When you install Emacs packages with Guix, the Elisp files are placed under the ‘share/emacs/site-lisp/’ directory of the profile in which they are installed. The Elisp libraries are made available to Emacs through the ‘EMACSLOADPATH’ environment variable, which is set when installing Emacs itself. Additionally, autoload definitions are automatically evaluated at the initialization of Emacs, by the Guix-specific ‘guix-emacs-autoload-packages’ procedure. If, for some reason, you want to avoid auto-loading the Emacs packages installed with Guix, you can do so by running Emacs with the ‘--no-site-file’ option (*note (emacs)Init File::). Nota: Emacs can now compile packages natively. Under the default configuration, this means that Emacs packages will now be just-in-time (JIT) compiled as you use them, and the results stored in a subdirectory of your ‘user-emacs-directory’. Furthermore, the build system for Emacs packages transparently supports native compilation, but note, that ‘emacs-minimal’—the default Emacs for building packages—has been configured without native compilation. To natively compile your emacs packages ahead of time, use a transformation like ‘--with-input=emacs-minimal=emacs’. ---------- Footnotes ---------- (1) The size of the ‘glibc-locales’ package is reduced down to about 213 MiB with store deduplication and further down to about 67 MiB when using a zstd-compressed Btrfs file system.  File: guix.pt_BR.info, Node: Upgrading Guix, Prev: Configuração de aplicativo, Up: Instalação 2.7 Upgrading Guix ================== To upgrade Guix, run: guix pull *Note Invocando guix pull::, for more information. On a foreign distro, you can upgrade the build daemon by running: sudo -i guix pull followed by (assuming your distro uses the systemd service management tool): systemctl restart guix-daemon.service On Guix System, upgrading the daemon is achieved by reconfiguring the system (*note ‘guix system reconfigure’: Invocando guix system.).  File: guix.pt_BR.info, Node: Instalação do sistema, Next: System Troubleshooting Tips, Prev: Instalação, Up: Top 3 Instalação do sistema *********************** This section explains how to install Guix System on a machine. Guix, as a package manager, can also be installed on top of a running GNU/Linux system, *note Instalação::. Nota: You are reading this documentation with an Info reader. For details on how to use it, hit the key (“return” or “enter”) on the link that follows: *note Info reader: (info-stnd)Top. Hit ‘l’ afterwards to come back here. Alternatively, run ‘info info’ in another tty to keep the manual available. * Menu: * Limitações:: O que você pode esperar. * Considerações de hardware:: Hardware suportado. * Instalação em um pendrive e em DVD:: Preparando a mídia de instalação. * Preparando para instalação:: Rede, particionamento, etc. * Instalação gráfica guiada:: Instalação gráfica fácil. * Instalação manual:: Instalação manual para magos. * Após a instalação do sistema:: Quando a instalação conclui com sucesso. * Instalando Guix em um VM:: Parque de diversões do Guix System. * Compilando a imagem de instalação:: Como isso vem a ser.  File: guix.pt_BR.info, Node: Limitações, Next: Considerações de hardware, Up: Instalação do sistema 3.1 Limitações ============== We consider Guix System to be ready for a wide range of “desktop” and server use cases. The reliability guarantees it provides—transactional upgrades and rollbacks, reproducibility—make it a solid foundation. Nevertheless, before you proceed with the installation, be aware of the following noteworthy limitations applicable to version 1.4.0: • More and more system services are provided (*note Serviços::), but some may be missing. • GNOME, Xfce, LXDE, and Enlightenment are available (*note Serviços de desktop::), as well as a number of X11 window managers. However, KDE is currently missing. More than a disclaimer, this is an invitation to report issues (and success stories!), and to join us in improving it. *Note Contribuindo::, for more info.  File: guix.pt_BR.info, Node: Considerações de hardware, Next: Instalação em um pendrive e em DVD, Prev: Limitações, Up: Instalação do sistema 3.2 Considerações de hardware ============================= GNU Guix focuses on respecting the user’s computing freedom. It builds around the kernel Linux-libre, which means that only hardware for which free software drivers and firmware exist is supported. Nowadays, a wide range of off-the-shelf hardware is supported on GNU/Linux-libre—from keyboards to graphics cards to scanners and Ethernet controllers. Unfortunately, there are still areas where hardware vendors deny users control over their own computing, and such hardware is not supported on Guix System. One of the main areas where free drivers or firmware are lacking is WiFi devices. WiFi devices known to work include those using Atheros chips (AR9271 and AR7010), which corresponds to the ‘ath9k’ Linux-libre driver, and those using Broadcom/AirForce chips (BCM43xx with Wireless-Core Revision 5), which corresponds to the ‘b43-open’ Linux-libre driver. Free firmware exists for both and is available out-of-the-box on Guix System, as part of ‘%base-firmware’ (*note ‘firmware’: Referência do operating-system.). The installer warns you early on if it detects devices that are known _not_ to work due to the lack of free firmware or free drivers. The Free Software Foundation (https://www.fsf.org/) runs “Respects Your Freedom” (https://www.fsf.org/ryf) (RYF), a certification program for hardware products that respect your freedom and your privacy and ensure that you have control over your device. We encourage you to check the list of RYF-certified devices. Another useful resource is the H-Node (https://www.h-node.org/) web site. It contains a catalog of hardware devices with information about their support in GNU/Linux.  File: guix.pt_BR.info, Node: Instalação em um pendrive e em DVD, Next: Preparando para instalação, Prev: Considerações de hardware, Up: Instalação do sistema 3.3 Instalação em um pendrive e em DVD ====================================== An ISO-9660 installation image that can be written to a USB stick or burnt to a DVD can be downloaded from ‘https://ftp.gnu.org/gnu/guix/guix-system-install-1.4.0.x86_64-linux.iso’, where you can replace ‘x86_64-linux’ with one of: ‘x86_64-linux’ for a GNU/Linux system on Intel/AMD-compatible 64-bit CPUs; ‘i686-linux’ for a 32-bit GNU/Linux system on Intel-compatible CPUs. Make sure to download the associated ‘.sig’ file and to verify the authenticity of the image against it, along these lines: $ wget https://ftp.gnu.org/gnu/guix/guix-system-install-1.4.0.x86_64-linux.iso.sig $ gpg --verify guix-system-install-1.4.0.x86_64-linux.iso.sig Se esse comando falhar porque você não possui a chave pública requerida, execute este comando para importá-lo: $ wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 \ -qO - | gpg --import - e execute novamente o comando ‘gpg --verify’. Take note that a warning like “This key is not certified with a trusted signature!” is normal. This image contains the tools necessary for an installation. It is meant to be copied _as is_ to a large-enough USB stick or DVD. Copying to a USB Stick ---------------------- Insert a USB stick of 1 GiB or more into your machine, and determine its device name. Assuming that the USB stick is known as ‘/dev/sdX’, copy the image with: dd if=guix-system-install-1.4.0.x86_64-linux.iso of=/dev/sdX status=progress sync Access to ‘/dev/sdX’ usually requires root privileges. Burning on a DVD ---------------- Insert a blank DVD into your machine, and determine its device name. Assuming that the DVD drive is known as ‘/dev/srX’, copy the image with: growisofs -dvd-compat -Z /dev/srX=guix-system-install-1.4.0.x86_64-linux.iso Access to ‘/dev/srX’ usually requires root privileges. Booting ------- Once this is done, you should be able to reboot the system and boot from the USB stick or DVD. The latter usually requires you to get in the BIOS or UEFI boot menu, where you can choose to boot from the USB stick. In order to boot from Libreboot, switch to the command mode by pressing the ‘c’ key and type ‘search_grub usb’. *Note Instalando Guix em um VM::, if, instead, you would like to install Guix System in a virtual machine (VM).  File: guix.pt_BR.info, Node: Preparando para instalação, Next: Instalação gráfica guiada, Prev: Instalação em um pendrive e em DVD, Up: Instalação do sistema 3.4 Preparando para instalação ============================== Once you have booted, you can use the guided graphical installer, which makes it easy to get started (*note Instalação gráfica guiada::). Alternatively, if you are already familiar with GNU/Linux and if you want more control than what the graphical installer provides, you can choose the “manual” installation process (*note Instalação manual::). The graphical installer is available on TTY1. You can obtain root shells on TTYs 3 to 6 by hitting ‘ctrl-alt-f3’, ‘ctrl-alt-f4’, etc. TTY2 shows this documentation and you can reach it with ‘ctrl-alt-f2’. Documentation is browsable using the Info reader commands (*note (info-stnd)Top::). The installation system runs the GPM mouse daemon, which allows you to select text with the left mouse button and to paste it with the middle button. Nota: Installation requires access to the Internet so that any missing dependencies of your system configuration can be downloaded. See the “Networking” section below.  File: guix.pt_BR.info, Node: Instalação gráfica guiada, Next: Instalação manual, Prev: Preparando para instalação, Up: Instalação do sistema 3.5 Instalação gráfica guiada ============================= The graphical installer is a text-based user interface. It will guide you, with dialog boxes, through the steps needed to install GNU Guix System. The first dialog boxes allow you to set up the system as you use it during the installation: you can choose the language, keyboard layout, and set up networking, which will be used during the installation. The image below shows the networking dialog. [image src="images/installer-network.png" alt="networking setup with the graphical installer"] Later steps allow you to partition your hard disk, as shown in the image below, to choose whether or not to use encrypted file systems, to enter the host name and root password, and to create an additional account, among other things. [image src="images/installer-partitions.png" alt="partitioning with the graphical installer"] Note that, at any time, the installer allows you to exit the current installation step and resume at a previous step, as show in the image below. [image src="images/installer-resume.png" alt="resuming the installation process"] Once you’re done, the installer produces an operating system configuration and displays it (*note Usando o sistema de configuração::). At that point you can hit “OK” and installation will proceed. On success, you can reboot into the new system and enjoy. *Note Após a instalação do sistema::, for what’s next!  File: guix.pt_BR.info, Node: Instalação manual, Next: Após a instalação do sistema, Prev: Instalação gráfica guiada, Up: Instalação do sistema 3.6 Instalação manual ===================== This section describes how you would “manually” install GNU Guix System on your machine. This option requires familiarity with GNU/Linux, with the shell, and with common administration tools. If you think this is not for you, consider using the guided graphical installer (*note Instalação gráfica guiada::). The installation system provides root shells on TTYs 3 to 6; press ‘ctrl-alt-f3’, ‘ctrl-alt-f4’, and so on to reach them. It includes many common tools needed to install the system, but is also a full-blown Guix System. This means that you can install additional packages, should you need it, using ‘guix package’ (*note Invocando guix package::). * Menu: * Disposição de teclado e rede e particionamento:: Configuração inicial. * Prosseguindo com a instalação:: Instalando.  File: guix.pt_BR.info, Node: Disposição de teclado e rede e particionamento, Next: Prosseguindo com a instalação, Up: Instalação manual 3.6.1 Keyboard Layout, Networking, and Partitioning --------------------------------------------------- Before you can install the system, you may want to adjust the keyboard layout, set up networking, and partition your target hard disk. This section will guide you through this. 3.6.1.1 Disposição do teclado ............................. The installation image uses the US qwerty keyboard layout. If you want to change it, you can use the ‘loadkeys’ command. For example, the following command selects the Dvorak keyboard layout: loadkeys dvorak See the files under ‘/run/current-system/profile/share/keymaps’ for a list of available keyboard layouts. Run ‘man loadkeys’ for more information. 3.6.1.2 Rede ............ Run the following command to see what your network interfaces are called: ifconfig -a ... or, using the GNU/Linux-specific ‘ip’ command: ip address Wired interfaces have a name starting with ‘e’; for example, the interface corresponding to the first on-board Ethernet controller is called ‘eno1’. Wireless interfaces have a name starting with ‘w’, like ‘w1p2s0’. Conexão cabeada To configure a wired network run the following command, substituting INTERFACE with the name of the wired interface you want to use. ifconfig INTERFACE up ... or, using the GNU/Linux-specific ‘ip’ command: ip link set INTERFACE up Wireless connection To configure wireless networking, you can create a configuration file for the ‘wpa_supplicant’ configuration tool (its location is not important) using one of the available text editors such as ‘nano’: nano wpa_supplicant.conf As an example, the following stanza can go to this file and will work for many wireless networks, provided you give the actual SSID and passphrase for the network you are connecting to: network={ ssid="MY-SSID" key_mgmt=WPA-PSK psk="the network's secret passphrase" } Start the wireless service and run it in the background with the following command (substitute INTERFACE with the name of the network interface you want to use): wpa_supplicant -c wpa_supplicant.conf -i INTERFACE -B Run ‘man wpa_supplicant’ for more information. At this point, you need to acquire an IP address. On a network where IP addresses are automatically assigned via DHCP, you can run: dhclient -v INTERFACE Try to ping a server to see if networking is up and running: ping -c 3 gnu.org Setting up network access is almost always a requirement because the image does not contain all the software and tools that may be needed. If you need HTTP and HTTPS access to go through a proxy, run the following command: herd set-http-proxy guix-daemon URL where URL is the proxy URL, for example ‘http://example.org:8118’. If you want to, you can continue the installation remotely by starting an SSH server: herd start ssh-daemon Make sure to either set a password with ‘passwd’, or configure OpenSSH public key authentication before logging in. 3.6.1.3 Disk Partitioning ......................... Unless this has already been done, the next step is to partition, and then format the target partition(s). The installation image includes several partitioning tools, including Parted (*note (parted)Overview::), ‘fdisk’, and ‘cfdisk’. Run it and set up your disk with the partition layout you want: cfdisk If your disk uses the GUID Partition Table (GPT) format and you plan to install BIOS-based GRUB (which is the default), make sure a BIOS Boot Partition is available (*note (grub)BIOS installation::). If you instead wish to use EFI-based GRUB, a FAT32 “EFI System Partition” (ESP) is required. This partition can be mounted at ‘/boot/efi’ for instance and must have the ‘esp’ flag set. E.g., for ‘parted’: parted /dev/sda set 1 esp on Nota: Unsure whether to use EFI- or BIOS-based GRUB? If the directory ‘/sys/firmware/efi’ exists in the installation image, then you should probably perform an EFI installation, using ‘grub-efi-bootloader’. Otherwise you should use the BIOS-based GRUB, known as ‘grub-bootloader’. *Note Configuração do carregador de inicialização::, for more info on bootloaders. Once you are done partitioning the target hard disk drive, you have to create a file system on the relevant partition(s)(1). For the ESP, if you have one and assuming it is ‘/dev/sda1’, run: mkfs.fat -F32 /dev/sda1 For the root file system, ext4 is the most widely used format. Other file systems, such as Btrfs, support compression, which is reported to nicely complement file deduplication that the daemon performs independently of the file system (*note deduplication: Invocando guix-daemon.). Preferably, assign file systems a label so that you can easily and reliably refer to them in ‘file-system’ declarations (*note Sistemas de arquivos::). This is typically done using the ‘-L’ option of ‘mkfs.ext4’ and related commands. So, assuming the target root partition lives at ‘/dev/sda2’, a file system with the label ‘my-root’ can be created with: mkfs.ext4 -L my-root /dev/sda2 If you are instead planning to encrypt the root partition, you can use the Cryptsetup/LUKS utilities to do that (see ‘man cryptsetup’ for more information). Warning: Note that GRUB can unlock LUKS2 devices since version 2.06, but only supports the PBKDF2 key derivation function, which is not the default for ‘cryptsetup luksFormat’. You can check which key derivation function is being used by a device by running ‘cryptsetup luksDump DEVICE’, and looking for the PBKDF field of your keyslots. Assuming you want to store the root partition on ‘/dev/sda2’, the command sequence to format it as a LUKS2 partition would be along these lines: cryptsetup luksFormat --type luks2 --pbkdf pbkdf2 /dev/sda2 cryptsetup open /dev/sda2 my-partition mkfs.ext4 -L my-root /dev/mapper/my-partition Once that is done, mount the target file system under ‘/mnt’ with a command like (again, assuming ‘my-root’ is the label of the root file system): mount LABEL=my-root /mnt Also mount any other file systems you would like to use on the target system relative to this path. If you have opted for ‘/boot/efi’ as an EFI mount point for example, mount it at ‘/mnt/boot/efi’ now so it is found by ‘guix system init’ afterwards. Finally, if you plan to use one or more swap partitions (*note Swap Space::), make sure to initialize them with ‘mkswap’. Assuming you have one swap partition on ‘/dev/sda3’, you would run: mkswap /dev/sda3 swapon /dev/sda3 Alternatively, you may use a swap file. For example, assuming that in the new system you want to use the file ‘/swapfile’ as a swap file, you would run(2): # This is 10 GiB of swap space. Adjust "count" to change the size. dd if=/dev/zero of=/mnt/swapfile bs=1MiB count=10240 # For security, make the file readable and writable only by root. chmod 600 /mnt/swapfile mkswap /mnt/swapfile swapon /mnt/swapfile Note that if you have encrypted the root partition and created a swap file in its file system as described above, then the encryption also protects the swap file, just like any other file in that file system. ---------- Footnotes ---------- (1) Currently Guix System only supports ext4, btrfs, JFS, F2FS, and XFS file systems. In particular, code that reads file system UUIDs and labels only works for these file system types. (2) This example will work for many types of file systems (e.g., ext4). However, for copy-on-write file systems (e.g., btrfs), the required steps may be different. For details, see the manual pages for ‘mkswap’ and ‘swapon’.  File: guix.pt_BR.info, Node: Prosseguindo com a instalação, Prev: Disposição de teclado e rede e particionamento, Up: Instalação manual 3.6.2 Prosseguindo com a instalação ----------------------------------- With the target partitions ready and the target root mounted on ‘/mnt’, we’re ready to go. First, run: herd start cow-store /mnt This makes ‘/gnu/store’ copy-on-write, such that packages added to it during the installation phase are written to the target disk on ‘/mnt’ rather than kept in memory. This is necessary because the first phase of the ‘guix system init’ command (see below) entails downloads or builds to ‘/gnu/store’ which, initially, is an in-memory file system. Next, you have to edit a file and provide the declaration of the operating system to be installed. To that end, the installation system comes with three text editors. We recommend GNU nano (*note (nano)Top::), which supports syntax highlighting and parentheses matching; other editors include mg (an Emacs clone), and nvi (a clone of the original BSD ‘vi’ editor). We strongly recommend storing that file on the target root file system, say, as ‘/mnt/etc/config.scm’. Failing to do that, you will have lost your configuration file once you have rebooted into the newly-installed system. *Note Usando o sistema de configuração::, for an overview of the configuration file. The example configurations discussed in that section are available under ‘/etc/configuration’ in the installation image. Thus, to get started with a system configuration providing a graphical display server (a “desktop” system), you can run something along these lines: # mkdir /mnt/etc # cp /etc/configuration/desktop.scm /mnt/etc/config.scm # nano /mnt/etc/config.scm You should pay attention to what your configuration file contains, and in particular: • Make sure the ‘bootloader-configuration’ form refers to the targets you want to install GRUB on. It should mention ‘grub-bootloader’ if you are installing GRUB in the legacy way, or ‘grub-efi-bootloader’ for newer UEFI systems. For legacy systems, the ‘targets’ field contain the names of the devices, like ‘(list "/dev/sda")’; for UEFI systems it names the paths to mounted EFI partitions, like ‘(list "/boot/efi")’; do make sure the paths are currently mounted and a ‘file-system’ entry is specified in your configuration. • Be sure that your file system labels match the value of their respective ‘device’ fields in your ‘file-system’ configuration, assuming your ‘file-system’ configuration uses the ‘file-system-label’ procedure in its ‘device’ field. • If there are encrypted or RAID partitions, make sure to add a ‘mapped-devices’ field to describe them (*note Dispositivos mapeados::). Once you are done preparing the configuration file, the new system must be initialized (remember that the target root file system is mounted under ‘/mnt’): guix system init /mnt/etc/config.scm /mnt This copies all the necessary files and installs GRUB on ‘/dev/sdX’, unless you pass the ‘--no-bootloader’ option. For more information, *note Invocando guix system::. This command may trigger downloads or builds of missing packages, which can take some time. Após a conclusão desse comando – e esperamos que com sucesso! – você pode executar o comando ‘reboot’ e inicializar no novo sistema. A senha ‘root’ no novo sistema está inicialmente vazia; as senhas de outros usuários precisam ser inicializadas executando o comando ‘passwd’ como ‘root’, a menos que sua configuração especifique o contrário (*note senhas de contas de usuário: user-account-password.). *Note Após a instalação do sistema::, para o que vem a seguir!  File: guix.pt_BR.info, Node: Após a instalação do sistema, Next: Instalando Guix em um VM, Prev: Instalação manual, Up: Instalação do sistema 3.7 Após a instalação do sistema ================================ Success, you’ve now booted into Guix System! From then on, you can update the system whenever you want by running, say: guix pull sudo guix system reconfigure /etc/config.scm This builds a new system generation with the latest packages and services (*note Invocando guix system::). We recommend doing that regularly so that your system includes the latest security updates (*note Atualizações de segurança::). Nota: Note that ‘sudo guix’ runs your user’s ‘guix’ command and _not_ root’s, because ‘sudo’ leaves ‘PATH’ unchanged. To explicitly run root’s ‘guix’, type ‘sudo -i guix ...’. The difference matters here, because ‘guix pull’ updates the ‘guix’ command and package definitions only for the user it is run as. This means that if you choose to use ‘guix system reconfigure’ in root’s login shell, you’ll need to ‘guix pull’ separately. Now, *note Primeiros passos::, and join us on ‘#guix’ on the Libera Chat IRC network or on to share your experience!  File: guix.pt_BR.info, Node: Instalando Guix em um VM, Next: Compilando a imagem de instalação, Prev: Após a instalação do sistema, Up: Instalação do sistema 3.8 Installing Guix in a Virtual Machine ======================================== If you’d like to install Guix System in a virtual machine (VM) or on a virtual private server (VPS) rather than on your beloved machine, this section is for you. To boot a QEMU (https://qemu.org/) VM for installing Guix System in a disk image, follow these steps: 1. First, retrieve and decompress the Guix system installation image as described previously (*note Instalação em um pendrive e em DVD::). 2. Create a disk image that will hold the installed system. To make a qcow2-formatted disk image, use the ‘qemu-img’ command: qemu-img create -f qcow2 guix-system.img 50G The resulting file will be much smaller than 50 GB (typically less than 1 MB), but it will grow as the virtualized storage device is filled up. 3. Boot the USB installation image in an VM: qemu-system-x86_64 -m 1024 -smp 1 -enable-kvm \ -nic user,model=virtio-net-pci -boot menu=on,order=d \ -drive file=guix-system.img \ -drive media=cdrom,file=guix-system-install-1.4.0.SYSTEM.iso ‘-enable-kvm’ is optional, but significantly improves performance, *note Executando Guix em uma VM::. 4. You’re now root in the VM, proceed with the installation process. *Note Preparando para instalação::, and follow the instructions. Once installation is complete, you can boot the system that’s on your ‘guix-system.img’ image. *Note Executando Guix em uma VM::, for how to do that.  File: guix.pt_BR.info, Node: Compilando a imagem de instalação, Prev: Instalando Guix em um VM, Up: Instalação do sistema 3.9 Compilando a imagem de instalação ===================================== The installation image described above was built using the ‘guix system’ command, specifically: guix system image -t iso9660 gnu/system/install.scm Have a look at ‘gnu/system/install.scm’ in the source tree, and see also *note Invocando guix system:: for more information about the installation image. 3.10 Building the Installation Image for ARM Boards =================================================== Many ARM boards require a specific variant of the U-Boot (https://www.denx.de/wiki/U-Boot/) bootloader. If you build a disk image and the bootloader is not available otherwise (on another boot drive etc), it’s advisable to build an image that includes the bootloader, specifically: guix system image --system=armhf-linux -e '((@ (gnu system install) os-with-u-boot) (@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")' ‘A20-OLinuXino-Lime2’ is the name of the board. If you specify an invalid board, a list of possible boards will be printed.  File: guix.pt_BR.info, Node: System Troubleshooting Tips, Next: Primeiros passos, Prev: Instalação do sistema, Up: Top 4 System Troubleshooting Tips ***************************** Guix System allows rebooting into a previous generation should the last one be malfunctioning, which makes it quite robust against being broken irreversibly. This feature depends on GRUB being correctly functioning though, which means that if for whatever reasons your GRUB installation becomes corrupted during a system reconfiguration, you may not be able to easily boot into a previous generation. A technique that can be used in this case is to chroot into your broken system and reconfigure it from there. Such technique is explained below. * Menu: * Chrooting into an existing system::  File: guix.pt_BR.info, Node: Chrooting into an existing system, Up: System Troubleshooting Tips 4.1 Chrooting into an existing system ===================================== This section details how to chroot to an already installed Guix System with the aim of reconfiguring it, for example to fix a broken GRUB installation. The process is similar to how it would be done on other GNU/Linux systems, but there are some Guix System particularities such as the daemon and profiles that make it worthy of explaining here. 1. Obtain a bootable image of Guix System. It is recommended the latest development snapshot so the kernel and the tools used are at least as as new as those of your installed system; it can be retrieved from the https://ci.guix.gnu.org (https://ci.guix.gnu.org/search/latest/ISO-9660?query=spec:images+status:success+system:x86_64-linux+image.iso) URL. Follow the *note Instalação em um pendrive e em DVD:: section for copying it to a bootable media. 2. Boot the image, and proceed with the graphical text-based installer until your network is configured. Alternatively, you could configure the network manually by following the *note manual-installation-networking:: section. If you get the error ‘RTNETLINK answers: Operation not possible due to RF-kill’, try ‘rfkill list’ followed by ‘rfkill unblock 0’, where ‘0’ is your device identifier (ID). 3. Switch to a virtual console (tty) if you haven’t already by pressing simultaneously the ‘Control + Alt + F4’ keys. Mount your file system at ‘/mnt’. Assuming your root partition is ‘/dev/sda2’, you would do: mount /dev/sda2 /mnt 4. Mount special block devices and Linux-specific directories: mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys mount --bind /dev /mnt/dev If your system is EFI-based, you must also mount the ESP partition. Assuming it is ‘/dev/sda1’, you can do so with: mount /dev/sda1 /mnt/boot/efi 5. Enter your system via chroot: chroot /mnt /bin/sh 6. Source the system profile as well as your USER profile to setup the environment, where USER is the user name used for the Guix System you are attempting to repair: source /var/guix/profiles/system/profile/etc/profile source /home/USER/.guix-profile/etc/profile To ensure you are working with the Guix revision you normally would as your normal user, also source your current Guix profile: source /home/USER/.config/guix/current/etc/profile 7. Start a minimal ‘guix-daemon’ in the background: guix-daemon --build-users-group=guixbuild --disable-chroot & 8. Edit your Guix System configuration if needed, then reconfigure with: guix system reconfigure your-config.scm 9. Finally, you should be good to reboot the system to test your fix.  File: guix.pt_BR.info, Node: Primeiros passos, Next: Gerenciamento de pacote, Prev: System Troubleshooting Tips, Up: Top 5 Primeiros passos ****************** Presumably, you’ve reached this section because either you have installed Guix on top of another distribution (*note Instalação::), or you’ve installed the standalone Guix System (*note Instalação do sistema::). It’s time for you to get started using Guix and this section aims to help you do that and give you a feel of what it’s like. Guix is about installing software, so probably the first thing you’ll want to do is to actually look for software. Let’s say you’re looking for a text editor, you can run: guix search text editor This command shows you a number of matching “packages”, each time showing the package’s name, version, a description, and additional info. Once you’ve found out the one you want to use, let’s say Emacs (ah ha!), you can go ahead and install it (run this command as a regular user, _no need for root privileges_!): guix install emacs You’ve installed your first package, congrats! The package is now visible in your default “profile”, ‘$HOME/.guix-profile’—a profile is a directory containing installed packages. In the process, you’ve probably noticed that Guix downloaded pre-built binaries; or, if you explicitly chose to _not_ use pre-built binaries, then probably Guix is still building software (*note Substitutos::, for more info). Unless you’re using Guix System, the ‘guix install’ command must have printed this hint: hint: Consider setting the necessary environment variables by running: GUIX_PROFILE="$HOME/.guix-profile" . "$GUIX_PROFILE/etc/profile" Alternately, see `guix package --search-paths -p "$HOME/.guix-profile"'. Indeed, you must now tell your shell where ‘emacs’ and other programs installed with Guix are to be found. Pasting the two lines above will do just that: it will add ‘$HOME/.guix-profile/bin’—which is where the installed package is—to the ‘PATH’ environment variable. You can paste these two lines in your shell so they take effect right away, but more importantly you should add them to ‘~/.bash_profile’ (or equivalent file if you do not use Bash) so that environment variables are set next time you spawn a shell. You only need to do this once and other search paths environment variables will be taken care of similarly—e.g., if you eventually install ‘python’ and Python libraries, ‘GUIX_PYTHONPATH’ will be defined. You can go on installing packages at your will. To list installed packages, run: guix package --list-installed To remove a package, you would unsurprisingly run ‘guix remove’. A distinguishing feature is the ability to “roll back” any operation you made—installation, removal, upgrade—by simply typing: guix package --roll-back This is because each operation is in fact a “transaction” that creates a new “generation”. These generations and the difference between them can be displayed by running: guix package --list-generations Now you know the basics of package management! Going further: *Note Gerenciamento de pacote::, for more about package management. You may like “declarative” package management with ‘guix package --manifest’, managing separate “profiles” with ‘--profile’, deleting old generations, collecting garbage, and other nifty features that will come in handy as you become more familiar with Guix. If you are a developer, *note Desenvolvimento:: for additional tools. And if you’re curious, *note Recursos::, to peek under the hood. Once you’ve installed a set of packages, you will want to periodically _upgrade_ them to the latest and greatest version. To do that, you will first pull the latest revision of Guix and its package collection: guix pull The end result is a new ‘guix’ command, under ‘~/.config/guix/current/bin’. Unless you’re on Guix System, the first time you run ‘guix pull’, be sure to follow the hint that the command prints and, similar to what we saw above, paste these two lines in your terminal and ‘.bash_profile’: GUIX_PROFILE="$HOME/.config/guix/current" . "$GUIX_PROFILE/etc/profile" You must also instruct your shell to point to this new ‘guix’: hash guix At this point, you’re running a brand new Guix. You can thus go ahead and actually upgrade all the packages you previously installed: guix upgrade As you run this command, you will see that binaries are downloaded (or perhaps some packages are built), and eventually you end up with the upgraded packages. Should one of these upgraded packages not be to your liking, remember you can always roll back! You can display the exact revision of Guix you’re currently using by running: guix describe The information it displays is _all it takes to reproduce the exact same Guix_, be it at a different point in time or on a different machine. Going further: *Note Invocando guix pull::, for more information. *Note Canais::, on how to specify additional “channels” to pull packages from, how to replicate Guix, and more. You may also find ‘time-machine’ handy (*note Invoking guix time-machine::). If you installed Guix System, one of the first things you’ll want to do is to upgrade your system. Once you’ve run ‘guix pull’ to get the latest Guix, you can upgrade the system like this: sudo guix system reconfigure /etc/config.scm Upon completion, the system runs the latest versions of its software packages. When you eventually reboot, you’ll notice a sub-menu in the bootloader that reads “Old system generations”: it’s what allows you to boot _an older generation of your system_, should the latest generation be “broken” or otherwise unsatisfying. Just like for packages, you can always _roll back_ to a previous generation _of the whole system_: sudo guix system roll-back There are many things you’ll probably want to tweak on your system: adding new user accounts, adding new system services, fiddling with the configuration of those services, etc. The system configuration is _entirely_ described in the ‘/etc/config.scm’ file. *Note Usando o sistema de configuração::, to learn how to change it. Now you know enough to get started! Resources: The rest of this manual provides a reference for all things Guix. Here are some additional resources you may find useful: • *Note (guix-cookbook)Top::, for a list of “how-to” style of recipes for a variety of applications. • The GNU Guix Reference Card (https://guix.gnu.org/guix-refcard.pdf) lists in two pages most of the commands and options you’ll ever need. • The web site contains instructional videos (https://guix.gnu.org/en/videos/) covering topics such as everyday use of Guix, how to get help, and how to become a contributor. • *Note Documentação::, to learn how to access documentation on your computer. We hope you will enjoy Guix as much as the community enjoys building it!  File: guix.pt_BR.info, Node: Gerenciamento de pacote, Next: Canais, Prev: Primeiros passos, Up: Top 6 Gerenciamento de pacote ************************* The purpose of GNU Guix is to allow users to easily install, upgrade, and remove software packages, without having to know about their build procedures or dependencies. Guix also goes beyond this obvious set of features. This chapter describes the main features of Guix, as well as the package management tools it provides. Along with the command-line interface described below (*note ‘guix package’: Invocando guix package.), you may also use the Emacs-Guix interface (*note (emacs-guix)Top::), after installing ‘emacs-guix’ package (run ‘M-x guix-help’ command to start with it): guix install emacs-guix * Menu: * Recursos:: Como o Guix vai iluminar a sua vida. * Invocando guix package:: Instalação de pacote, remoção, etc. * Substitutos:: Baixando binários pré-compilados. * Pacotes com múltiplas saídas:: Um único pacote de fontes, várias saídas. * Invocando guix gc:: Executando o coletor de lixo. * Invocando guix pull:: Obtendo o Guix mais recente e distribuição. * Invoking guix time-machine:: Running an older revision of Guix. * Inferiores:: Interagindo com outra revisão do Guix. * Invocando guix describe:: Exibe informações sobre sua revisão do Guix. * Invocando guix archive:: Exportando e importando arquivos do armazém.  File: guix.pt_BR.info, Node: Recursos, Next: Invocando guix package, Up: Gerenciamento de pacote 6.1 Recursos ============ Here we assume you’ve already made your first steps with Guix (*note Primeiros passos::) and would like to get an overview about what’s going on under the hood. When using Guix, each package ends up in the “package store”, in its own directory—something that resembles ‘/gnu/store/xxx-package-1.2’, where ‘xxx’ is a base32 string. Instead of referring to these directories, users have their own “profile”, which points to the packages that they actually want to use. These profiles are stored within each user’s home directory, at ‘$HOME/.guix-profile’. For example, ‘alice’ installs GCC 4.7.2. As a result, ‘/home/alice/.guix-profile/bin/gcc’ points to ‘/gnu/store/...-gcc-4.7.2/bin/gcc’. Now, on the same machine, ‘bob’ had already installed GCC 4.8.0. The profile of ‘bob’ simply continues to point to ‘/gnu/store/...-gcc-4.8.0/bin/gcc’—i.e., both versions of GCC coexist on the same system without any interference. The ‘guix package’ command is the central tool to manage packages (*note Invocando guix package::). It operates on the per-user profiles, and can be used _with normal user privileges_. The command provides the obvious install, remove, and upgrade operations. Each invocation is actually a _transaction_: either the specified operation succeeds, or nothing happens. Thus, if the ‘guix package’ process is terminated during the transaction, or if a power outage occurs during the transaction, then the user’s profile remains in its previous state, and remains usable. In addition, any package transaction may be _rolled back_. So, if, for example, an upgrade installs a new version of a package that turns out to have a serious bug, users may roll back to the previous instance of their profile, which was known to work well. Similarly, the global system configuration on Guix is subject to transactional upgrades and roll-back (*note Usando o sistema de configuração::). All packages in the package store may be _garbage-collected_. Guix can determine which packages are still referenced by user profiles, and remove those that are provably no longer referenced (*note Invocando guix gc::). Users may also explicitly remove old generations of their profile so that the packages they refer to can be collected. Guix takes a “purely functional” approach to package management, as described in the introduction (*note Introdução::). Each ‘/gnu/store’ package directory name contains a hash of all the inputs that were used to build that package—compiler, libraries, build scripts, etc. This direct correspondence allows users to make sure a given package installation matches the current state of their distribution. It also helps maximize “build reproducibility”: thanks to the isolated build environments that are used, a given build is likely to yield bit-identical files when performed on different machines (*note container: Invocando guix-daemon.). This foundation allows Guix to support “transparent binary/source deployment”. When a pre-built binary for a ‘/gnu/store’ item is available from an external source—a “substitute”, Guix just downloads it and unpacks it; otherwise, it builds the package from source, locally (*note Substitutos::). Because build results are usually bit-for-bit reproducible, users do not have to trust servers that provide substitutes: they can force a local build and _challenge_ providers (*note Invocando guix challenge::). Control over the build environment is a feature that is also useful for developers. The ‘guix shell’ command allows developers of a package to quickly set up the right development environment for their package, without having to manually install the dependencies of the package into their profile (*note Invoking guix shell::). All of Guix and its package definitions is version-controlled, and ‘guix pull’ allows you to “travel in time” on the history of Guix itself (*note Invocando guix pull::). This makes it possible to replicate a Guix instance on a different machine or at a later point in time, which in turn allows you to _replicate complete software environments_, while retaining precise “provenance tracking” of the software.  File: guix.pt_BR.info, Node: Invocando guix package, Next: Substitutos, Prev: Recursos, Up: Gerenciamento de pacote 6.2 Invocando ‘guix package’ ============================ The ‘guix package’ command is the tool that allows users to install, upgrade, and remove packages, as well as rolling back to previous configurations. These operations work on a user “profile”—a directory of installed packages. Each user has a default profile in ‘$HOME/.guix-profile’. The command operates only on the user’s own profile, and works with normal user privileges (*note Recursos::). Its syntax is: guix package OPÇÕES Primarily, OPTIONS specifies the operations to be performed during the transaction. Upon completion, a new profile is created, but previous “generations” of the profile remain available, should the user want to roll back. For example, to remove ‘lua’ and install ‘guile’ and ‘guile-cairo’ in a single transaction: guix package -r lua -i guile guile-cairo For your convenience, we also provide the following aliases: • ‘guix search’ is an alias for ‘guix package -s’, • ‘guix install’ is an alias for ‘guix package -i’, • ‘guix remove’ is an alias for ‘guix package -r’, • ‘guix upgrade’ is an alias for ‘guix package -u’, • and ‘guix show’ is an alias for ‘guix package --show=’. These aliases are less expressive than ‘guix package’ and provide fewer options, so in some cases you’ll probably want to use ‘guix package’ directly. ‘guix package’ also supports a “declarative approach” whereby the user specifies the exact set of packages to be available and passes it via the ‘--manifest’ option (*note ‘--manifest’: profile-manifest.). For each user, a symlink to the user’s default profile is automatically created in ‘$HOME/.guix-profile’. This symlink always points to the current generation of the user’s default profile. Thus, users can add ‘$HOME/.guix-profile/bin’ to their ‘PATH’ environment variable, and so on. If you are not using Guix System, consider adding the following lines to your ‘~/.bash_profile’ (*note (bash)Bash Startup Files::) so that newly-spawned shells get all the right environment variable definitions: GUIX_PROFILE="$HOME/.guix-profile" ; \ source "$GUIX_PROFILE/etc/profile" In a multi-user setup, user profiles are stored in a place registered as a “garbage-collector root”, which ‘$HOME/.guix-profile’ points to (*note Invocando guix gc::). That directory is normally ‘LOCALSTATEDIR/guix/profiles/per-user/USER’, where LOCALSTATEDIR is the value passed to ‘configure’ as ‘--localstatedir’, and USER is the user name. The ‘per-user’ directory is created when ‘guix-daemon’ is started, and the USER sub-directory is created by ‘guix package’. The OPTIONS can be among the following: ‘--install=PACKAGE ...’ ‘-i PACKAGE ...’ Install the specified PACKAGEs. Each PACKAGE may specify a simple package name, such as ‘guile’, optionally followed by an at-sign and version number, such as ‘guile@3.0.7’ or simply ‘guile@3.0’. In the latter case, the newest version prefixed by ‘3.0’ is selected. If no version number is specified, the newest available version will be selected. In addition, such a PACKAGE specification may contain a colon, followed by the name of one of the outputs of the package, as in ‘gcc:doc’ or ‘binutils@2.22:lib’ (*note Pacotes com múltiplas saídas::). Packages with a corresponding name (and optionally version) are searched for among the GNU distribution modules (*note Módulos de pacote::). Alternatively, a PACKAGE can directly specify a store file name such as ‘/gnu/store/...-guile-3.0.7’, as produced by, e.g., ‘guix build’. Sometimes packages have “propagated inputs”: these are dependencies that automatically get installed along with the required package (*note ‘propagated-inputs’ in ‘package’ objects: package-propagated-inputs, for information about propagated inputs in package definitions). An example is the GNU MPC library: its C header files refer to those of the GNU MPFR library, which in turn refer to those of the GMP library. Thus, when installing MPC, the MPFR and GMP libraries also get installed in the profile; removing MPC also removes MPFR and GMP—unless they had also been explicitly installed by the user. Besides, packages sometimes rely on the definition of environment variables for their search paths (see explanation of ‘--search-paths’ below). Any missing or possibly incorrect environment variable definitions are reported here. ‘--install-from-expression=EXP’ ‘-e EXP’ Install the package EXP evaluates to. EXP must be a Scheme expression that evaluates to a ‘’ object. This option is notably useful to disambiguate between same-named variants of a package, with expressions such as ‘(@ (gnu packages base) guile-final)’. Note that this option installs the first output of the specified package, which may be insufficient when needing a specific output of a multiple-output package. ‘--install-from-file=FILE’ ‘-f ARQUIVO’ Install the package that the code within FILE evaluates to. As an example, FILE might contain a definition like this (*note Definindo pacotes::): (use-modules (guix) (guix build-system gnu) (guix licenses)) (package (name "hello") (version "2.10") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/hello/hello-" version ".tar.gz")) (sha256 (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) (synopsis "Hello, GNU world: An example GNU package") (description "Guess what GNU Hello prints!") (home-page "http://www.gnu.org/software/hello/") (license gpl3+)) Developers may find it useful to include such a ‘guix.scm’ file in the root of their project source tree that can be used to test development snapshots and create reproducible development environments (*note Invoking guix shell::). The FILE may also contain a JSON representation of one or more package definitions. Running ‘guix package -f’ on ‘hello.json’ with the following contents would result in installing the package ‘greeter’ after building ‘myhello’: [ { "name": "myhello", "version": "2.10", "source": "mirror://gnu/hello/hello-2.10.tar.gz", "build-system": "gnu", "arguments": { "tests?": false } "home-page": "https://www.gnu.org/software/hello/", "synopsis": "Hello, GNU world: An example GNU package", "description": "GNU Hello prints a greeting.", "license": "GPL-3.0+", "native-inputs": ["gettext"] }, { "name": "greeter", "version": "1.0", "source": "https://example.com/greeter-1.0.tar.gz", "build-system": "gnu", "arguments": { "test-target": "foo", "parallel-build?": false, }, "home-page": "https://example.com/", "synopsis": "Greeter using GNU Hello", "description": "This is a wrapper around GNU Hello.", "license": "GPL-3.0+", "inputs": ["myhello", "hello"] } ] ‘--remove=PACKAGE ...’ ‘-r PACOTE ...’ Remove the specified PACKAGEs. As for ‘--install’, each PACKAGE may specify a version number and/or output name in addition to the package name. For instance, ‘-r glibc:debug’ would remove the ‘debug’ output of ‘glibc’. ‘--upgrade[=REGEXP ...]’ ‘-u [REGEXP ...]’ Upgrade all the installed packages. If one or more REGEXPs are specified, upgrade only installed packages whose name matches a REGEXP. Also see the ‘--do-not-upgrade’ option below. Note that this upgrades package to the latest version of packages found in the distribution currently installed. To update your distribution, you should regularly run ‘guix pull’ (*note Invocando guix pull::). When upgrading, package transformations that were originally applied when creating the profile are automatically re-applied (*note Opções de transformação de pacote::). For example, assume you first installed Emacs from the tip of its development branch with: guix install emacs-next --with-branch=emacs-next=master Next time you run ‘guix upgrade’, Guix will again pull the tip of the Emacs development branch and build ‘emacs-next’ from that checkout. Note that transformation options such as ‘--with-branch’ and ‘--with-source’ depend on external state; it is up to you to ensure that they work as expected. You can also discard a transformations that apply to a package by running: guix install PACKAGE ‘--do-not-upgrade[=REGEXP ...]’ When used together with the ‘--upgrade’ option, do _not_ upgrade any packages whose name matches a REGEXP. For example, to upgrade all packages in the current profile except those containing the substring “emacs”: $ guix package --upgrade . --do-not-upgrade emacs ‘--manifest=ARQUIVO’ ‘-m ARQUIVO’ Create a new generation of the profile from the manifest object returned by the Scheme code in FILE. This option can be repeated several times, in which case the manifests are concatenated. This allows you to _declare_ the profile’s contents rather than constructing it through a sequence of ‘--install’ and similar commands. The advantage is that FILE can be put under version control, copied to different machines to reproduce the same profile, and so on. FILE must return a “manifest” object, which is roughly a list of packages: (use-package-modules guile emacs) (packages->manifest (list emacs guile-2.0 ;; Usa uma saída de pacote específica. (list guile-2.0 "debug"))) *Note Writing Manifests::, for information on how to write a manifest. *Note ‘--export-manifest’: export-manifest, to learn how to obtain a manifest file from an existing profile. ‘--roll-back’ Roll back to the previous “generation” of the profile—i.e., undo the last transaction. When combined with options such as ‘--install’, roll back occurs before any other actions. When rolling back from the first generation that actually contains installed packages, the profile is made to point to the “zeroth generation”, which contains no files apart from its own metadata. After having rolled back, installing, removing, or upgrading packages overwrites previous future generations. Thus, the history of the generations in a profile is always linear. ‘--switch-generation=PADRÃO’ ‘-S PADRÃO’ Switch to a particular generation defined by PATTERN. PATTERN may be either a generation number or a number prefixed with “+” or “-”. The latter means: move forward/backward by a specified number of generations. For example, if you want to return to the latest generation after ‘--roll-back’, use ‘--switch-generation=+1’. The difference between ‘--roll-back’ and ‘--switch-generation=-1’ is that ‘--switch-generation’ will not make a zeroth generation, so if a specified generation does not exist, the current generation will not be changed. ‘--search-paths[=TIPO]’ Report environment variable definitions, in Bash syntax, that may be needed in order to use the set of installed packages. These environment variables are used to specify “search paths” for files used by some of the installed packages. For example, GCC needs the ‘CPATH’ and ‘LIBRARY_PATH’ environment variables to be defined so it can look for headers and libraries in the user’s profile (*note (gcc)Environment Variables::). If GCC and, say, the C library are installed in the profile, then ‘--search-paths’ will suggest setting these variables to ‘PROFILE/include’ and ‘PROFILE/lib’, respectively (*note Search Paths::, for info on search path specifications associated with packages.) The typical use case is to define these environment variables in the shell: $ eval $(guix package --search-paths) KIND may be one of ‘exact’, ‘prefix’, or ‘suffix’, meaning that the returned environment variable definitions will either be exact settings, or prefixes or suffixes of the current value of these variables. When omitted, KIND defaults to ‘exact’. This option can also be used to compute the _combined_ search paths of several profiles. Consider this example: $ guix package -p foo -i guile $ guix package -p bar -i guile-json $ guix package -p foo -p bar --search-paths The last command above reports about the ‘GUILE_LOAD_PATH’ variable, even though, taken individually, neither ‘foo’ nor ‘bar’ would lead to that recommendation. ‘--profile=PERFIL’ ‘-p PERFIL’ Use PROFILE instead of the user’s default profile. PROFILE must be the name of a file that will be created upon completion. Concretely, PROFILE will be a mere symbolic link (“symlink”) pointing to the actual profile where packages are installed: $ guix install hello -p ~/code/my-profile ... $ ~/code/my-profile/bin/hello Hello, world! All it takes to get rid of the profile is to remove this symlink and its siblings that point to specific generations: $ rm ~/code/my-profile ~/code/my-profile-*-link ‘--list-profiles’ List all the user’s profiles: $ guix package --list-profiles /home/charlie/.guix-profile /home/charlie/code/my-profile /home/charlie/code/devel-profile /home/charlie/tmp/test When running as root, list all the profiles of all the users. ‘--allow-collisions’ Allow colliding packages in the new profile. Use at your own risk! By default, ‘guix package’ reports as an error “collisions” in the profile. Collisions happen when two or more different versions or variants of a given package end up in the profile. ‘--bootstrap’ Use the bootstrap Guile to build the profile. This option is only useful to distribution developers. In addition to these actions, ‘guix package’ supports the following options to query the current state of a profile, or the availability of packages: ‘--search=REGEXP’ ‘-s REGEXP’ List the available packages whose name, synopsis, or description matches REGEXP (in a case-insensitive fashion), sorted by relevance. Print all the metadata of matching packages in ‘recutils’ format (*note GNU recutils databases: (recutils)Top.). This allows specific fields to be extracted using the ‘recsel’ command, for instance: $ guix package -s malloc | recsel -p name,version,relevance name: jemalloc version: 4.5.0 relevance: 6 name: glibc version: 2.25 relevance: 1 name: libgc version: 7.6.0 relevance: 1 Similarly, to show the name of all the packages available under the terms of the GNU LGPL version 3: $ guix package -s "" | recsel -p name -e 'license ~ "LGPL 3"' name: elfutils name: gmp ... It is also possible to refine search results using several ‘-s’ flags to ‘guix package’, or several arguments to ‘guix search’. For example, the following command returns a list of board games (this time using the ‘guix search’ alias): $ guix search '\' game | recsel -p name name: gnubg ... If we were to omit ‘-s game’, we would also get software packages that deal with printed circuit boards; removing the angle brackets around ‘board’ would further add packages that have to do with keyboards. And now for a more elaborate example. The following command searches for cryptographic libraries, filters out Haskell, Perl, Python, and Ruby libraries, and prints the name and synopsis of the matching packages: $ guix search crypto library | \ recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis *Note (recutils)Selection Expressions::, for more information on “selection expressions” for ‘recsel -e’. ‘--show=PACKAGE’ Show details about PACKAGE, taken from the list of available packages, in ‘recutils’ format (*note GNU recutils databases: (recutils)Top.). $ guix package --show=guile | recsel -p name,version name: guile version: 3.0.5 name: guile version: 3.0.2 name: guile version: 2.2.7 ... You may also specify the full name of a package to only get details about a specific version of it (this time using the ‘guix show’ alias): $ guix show guile@3.0.5 | recsel -p name,version name: guile version: 3.0.5 ‘--list-installed[=REGEXP]’ ‘-I [REGEXP]’ List the currently installed packages in the specified profile, with the most recently installed packages shown last. When REGEXP is specified, list only installed packages whose name matches REGEXP. For each installed package, print the following items, separated by tabs: the package name, its version string, the part of the package that is installed (for instance, ‘out’ for the default output, ‘include’ for its headers, etc.), and the path of this package in the store. ‘--list-available[=REGEXP]’ ‘-A [REGEXP]’ List packages currently available in the distribution for this system (*note Distribuição GNU::). When REGEXP is specified, list only available packages whose name matches REGEXP. For each package, print the following items separated by tabs: its name, its version string, the parts of the package (*note Pacotes com múltiplas saídas::), and the source location of its definition. ‘--list-generations[=PADRÃO]’ ‘-l [PADRÃO]’ Return a list of generations along with their creation dates; for each generation, show the installed packages, with the most recently installed packages shown last. Note that the zeroth generation is never shown. For each installed package, print the following items, separated by tabs: the name of a package, its version string, the part of the package that is installed (*note Pacotes com múltiplas saídas::), and the location of this package in the store. When PATTERN is used, the command returns only matching generations. Valid patterns include: • _Integers and comma-separated integers_. Both patterns denote generation numbers. For instance, ‘--list-generations=1’ returns the first one. And ‘--list-generations=1,8,2’ outputs three generations in the specified order. Neither spaces nor trailing commas are allowed. • _Ranges_. ‘--list-generations=2..9’ prints the specified generations and everything in between. Note that the start of a range must be smaller than its end. It is also possible to omit the endpoint. For example, ‘--list-generations=2..’, returns all generations starting from the second one. • _Durations_. You can also get the last _N_ days, weeks, or months by passing an integer along with the first letter of the duration. For example, ‘--list-generations=20d’ lists generations that are up to 20 days old. ‘--delete-generations[=PATTERN]’ ‘-d [PATTERN]’ When PATTERN is omitted, delete all generations except the current one. This command accepts the same patterns as ‘--list-generations’. When PATTERN is specified, delete the matching generations. When PATTERN specifies a duration, generations _older_ than the specified duration match. For instance, ‘--delete-generations=1m’ deletes generations that are more than one month old. If the current generation matches, it is _not_ deleted. Also, the zeroth generation is never deleted. Note that deleting generations prevents rolling back to them. Consequently, this command must be used with care. ‘--export-manifest’ Write to standard output a manifest suitable for ‘--manifest’ corresponding to the chosen profile(s). This option is meant to help you migrate from the “imperative” operating mode—running ‘guix install’, ‘guix upgrade’, etc.—to the declarative mode that ‘--manifest’ offers. Be aware that the resulting manifest _approximates_ what your profile actually contains; for instance, depending on how your profile was created, it can refer to packages or package versions that are not exactly what you specified. Keep in mind that a manifest is purely symbolic: it only contains package names and possibly versions, and their meaning varies over time. If you wish to “pin” channels to the revisions that were used to build the profile(s), see ‘--export-channels’ below. ‘--export-channels’ Write to standard output the list of channels used by the chosen profile(s), in a format suitable for ‘guix pull --channels’ or ‘guix time-machine --channels’ (*note Canais::). Together with ‘--export-manifest’, this option provides information allowing you to replicate the current profile (*note Replicating Guix::). However, note that the output of this command _approximates_ what was actually used to build this profile. In particular, a single profile might have been built from several different revisions of the same channel. In that case, ‘--export-manifest’ chooses the last one and writes the list of other revisions in a comment. If you really need to pick packages from different channel revisions, you can use inferiors in your manifest to do so (*note Inferiores::). Together with ‘--export-manifest’, this is a good starting point if you are willing to migrate from the “imperative” model to the fully declarative model consisting of a manifest file along with a channels file pinning the exact channel revision(s) you want. Finally, since ‘guix package’ may actually start build processes, it supports all the common build options (*note Opções de compilação comum::). It also supports package transformation options, such as ‘--with-source’, and preserves them across upgrades (*note Opções de transformação de pacote::).  File: guix.pt_BR.info, Node: Substitutos, Next: Pacotes com múltiplas saídas, Prev: Invocando guix package, Up: Gerenciamento de pacote 6.3 Substitutos =============== Guix supports transparent source/binary deployment, which means that it can either build things locally, or download pre-built items from a server, or both. We call these pre-built items “substitutes”—they are substitutes for local build results. In many cases, downloading a substitute is much faster than building things locally. Substitutes can be anything resulting from a derivation build (*note Derivações::). Of course, in the common case, they are pre-built package binaries, but source tarballs, for instance, which also result from derivation builds, can be available as substitutes. * Menu: * Official Substitute Servers:: Uma fonte específica de substitutos. * Autorização de servidor substituto:: Como habilitar ou desabilitar substitutos. * Getting Substitutes from Other Servers:: Substitute diversity. * Autenticação de substituto:: Como Guix verifica substitutos. * Configurações de proxy:: Como obter substitutos via proxy. * Falha na substituição:: O que acontece quando a substituição falha. * Confiança em binários:: Como você pode confiar naquele blob binário?  File: guix.pt_BR.info, Node: Official Substitute Servers, Next: Autorização de servidor substituto, Up: Substitutos 6.3.1 Official Substitute Servers --------------------------------- ‘ci.guix.gnu.org’ and ‘bordeaux.guix.gnu.org’ are both front-ends to official build farms that build packages from Guix continuously for some architectures, and make them available as substitutes. These are the default source of substitutes; which can be overridden by passing the ‘--substitute-urls’ option either to ‘guix-daemon’ (*note ‘guix-daemon --substitute-urls’: daemon-substitute-urls.) or to client tools such as ‘guix package’ (*note client ‘--substitute-urls’ option: client-substitute-urls.). Substitute URLs can be either HTTP or HTTPS. HTTPS is recommended because communications are encrypted; conversely, using HTTP makes all communications visible to an eavesdropper, who could use the information gathered to determine, for instance, whether your system has unpatched security vulnerabilities. Substitutes from the official build farms are enabled by default when using Guix System (*note Distribuição GNU::). However, they are disabled by default when using Guix on a foreign distribution, unless you have explicitly enabled them via one of the recommended installation steps (*note Instalação::). The following paragraphs describe how to enable or disable substitutes for the official build farm; the same procedure can also be used to enable substitutes for any other substitute server.  File: guix.pt_BR.info, Node: Autorização de servidor substituto, Next: Getting Substitutes from Other Servers, Prev: Official Substitute Servers, Up: Substitutos 6.3.2 Autorização de servidor substituto ---------------------------------------- To allow Guix to download substitutes from ‘ci.guix.gnu.org’, ‘bordeaux.guix.gnu.org’ or a mirror, you must add the relevant public key to the access control list (ACL) of archive imports, using the ‘guix archive’ command (*note Invocando guix archive::). Doing so implies that you trust the substitute server to not be compromised and to serve genuine substitutes. Nota: If you are using Guix System, you can skip this section: Guix System authorizes substitutes from ‘ci.guix.gnu.org’ and ‘bordeaux.guix.gnu.org’ by default. The public keys for each of the project maintained substitute servers are installed along with Guix, in ‘PREFIX/share/guix/’, where PREFIX is the installation prefix of Guix. If you installed Guix from source, make sure you checked the GPG signature of ‘guix-1.4.0.tar.gz’, which contains this public key file. Then, you can run something like this: # guix archive --authorize < PREFIX/share/guix/ci.guix.gnu.org.pub # guix archive --authorize < PREFIX/share/guix/bordeaux.guix.gnu.org.pub Once this is in place, the output of a command like ‘guix build’ should change from something like: $ guix build emacs --dry-run The following derivations would be built: /gnu/store/yr7bnx8xwcayd6j95r2clmkdl1qh688w-emacs-24.3.drv /gnu/store/x8qsh1hlhgjx6cwsjyvybnfv2i37z23w-dbus-1.6.4.tar.gz.drv /gnu/store/1ixwp12fl950d15h2cj11c73733jay0z-alsa-lib-1.0.27.1.tar.bz2.drv /gnu/store/nlma1pw0p603fpfiqy7kn4zm105r5dmw-util-linux-2.21.drv ... to something like: $ guix build emacs --dry-run 112.3 MB would be downloaded: /gnu/store/pk3n22lbq6ydamyymqkkz7i69wiwjiwi-emacs-24.3 /gnu/store/2ygn4ncnhrpr61rssa6z0d9x22si0va3-libjpeg-8d /gnu/store/71yz6lgx4dazma9dwn2mcjxaah9w77jq-cairo-1.12.16 /gnu/store/7zdhgp0n1518lvfn8mb96sxqfmvqrl7v-libxrender-0.9.7 ... The text changed from “The following derivations would be built” to “112.3 MB would be downloaded”. This indicates that substitutes from the configured substitute servers are usable and will be downloaded, when possible, for future builds. The substitute mechanism can be disabled globally by running ‘guix-daemon’ with ‘--no-substitutes’ (*note Invocando guix-daemon::). It can also be disabled temporarily by passing the ‘--no-substitutes’ option to ‘guix package’, ‘guix build’, and other command-line tools.  File: guix.pt_BR.info, Node: Getting Substitutes from Other Servers, Next: Autenticação de substituto, Prev: Autorização de servidor substituto, Up: Substitutos 6.3.3 Getting Substitutes from Other Servers -------------------------------------------- Guix can look up and fetch substitutes from several servers. This is useful when you are using packages from additional channels for which the official server does not have substitutes but another server provides them. Another situation where this is useful is when you would prefer to download from your organization’s substitute server, resorting to the official server only as a fallback or dismissing it altogether. You can give Guix a list of substitute server URLs and it will check them in the specified order. You also need to explicitly authorize the public keys of substitute servers to instruct Guix to accept the substitutes they sign. On Guix System, this is achieved by modifying the configuration of the ‘guix’ service. Since the ‘guix’ service is part of the default lists of services, ‘%base-services’ and ‘%desktop-services’, you can use ‘modify-services’ to change its configuration and add the URLs and substitute keys that you want (*note ‘modify-services’: Referência de Service.). As an example, suppose you want to fetch substitutes from ‘guix.example.org’ and to authorize the signing key of that server, in addition to the default ‘ci.guix.gnu.org’ and ‘bordeaux.guix.gnu.org’. The resulting operating system configuration will look something like: (operating-system ;; ... (services ;; Assume we're starting from '%desktop-services'. Replace it ;; with the list of services you're actually using. (modify-services %desktop-services (guix-service-type config => (guix-configuration (inherit config) (substitute-urls (append (list "https://guix.example.org") %default-substitute-urls)) (authorized-keys (append (list (local-file "./key.pub")) %default-authorized-guix-keys))))))) This assumes that the file ‘key.pub’ contains the signing key of ‘guix.example.org’. With this change in place in your operating system configuration file (say ‘/etc/config.scm’), you can reconfigure and restart the ‘guix-daemon’ service or reboot so the changes take effect: $ sudo guix system reconfigure /etc/config.scm $ sudo herd restart guix-daemon If you’re running Guix on a “foreign distro”, you would instead take the following steps to get substitutes from additional servers: 1. Edit the service configuration file for ‘guix-daemon’; when using systemd, this is normally ‘/etc/systemd/system/guix-daemon.service’. Add the ‘--substitute-urls’ option on the ‘guix-daemon’ command line and list the URLs of interest (*note ‘guix-daemon --substitute-urls’: daemon-substitute-urls.): ... --substitute-urls='https://guix.example.org https://ci.guix.gnu.org https://bordeaux.guix.gnu.org' 2. Restart the daemon. For systemd, it goes like this: systemctl daemon-reload systemctl restart guix-daemon.service 3. Authorize the key of the new server (*note Invocando guix archive::): guix archive --authorize < key.pub Again this assumes ‘key.pub’ contains the public key that ‘guix.example.org’ uses to sign substitutes. Now you’re all set! Substitutes will be preferably taken from ‘https://guix.example.org’, using ‘ci.guix.gnu.org’ then ‘bordeaux.guix.gnu.org’ as fallback options. Of course you can list as many substitute servers as you like, with the caveat that substitute lookup can be slowed down if too many servers need to be contacted. Note that there are also situations where one may want to add the URL of a substitute server _without_ authorizing its key. *Note Autenticação de substituto::, to understand this fine point.  File: guix.pt_BR.info, Node: Autenticação de substituto, Next: Configurações de proxy, Prev: Getting Substitutes from Other Servers, Up: Substitutos 6.3.4 Autenticação de substituto -------------------------------- Guix detects and raises an error when attempting to use a substitute that has been tampered with. Likewise, it ignores substitutes that are not signed, or that are not signed by one of the keys listed in the ACL. There is one exception though: if an unauthorized server provides substitutes that are _bit-for-bit identical_ to those provided by an authorized server, then the unauthorized server becomes eligible for downloads. For example, assume we have chosen two substitute servers with this option: --substitute-urls="https://a.example.org https://b.example.org" If the ACL contains only the key for ‘b.example.org’, and if ‘a.example.org’ happens to serve the _exact same_ substitutes, then Guix will download substitutes from ‘a.example.org’ because it comes first in the list and can be considered a mirror of ‘b.example.org’. In practice, independent build machines usually produce the same binaries, thanks to bit-reproducible builds (see below). When using HTTPS, the server’s X.509 certificate is _not_ validated (in other words, the server is not authenticated), contrary to what HTTPS clients such as Web browsers usually do. This is because Guix authenticates substitute information itself, as explained above, which is what we care about (whereas X.509 certificates are about authenticating bindings between domain names and public keys).  File: guix.pt_BR.info, Node: Configurações de proxy, Next: Falha na substituição, Prev: Autenticação de substituto, Up: Substitutos 6.3.5 Configurações de proxy ---------------------------- Substitutes are downloaded over HTTP or HTTPS. The ‘http_proxy’ and ‘https_proxy’ environment variables can be set in the environment of ‘guix-daemon’ and are honored for downloads of substitutes. Note that the value of those environment variables in the environment where ‘guix build’, ‘guix package’, and other client commands are run has _absolutely no effect_.  File: guix.pt_BR.info, Node: Falha na substituição, Next: Confiança em binários, Prev: Configurações de proxy, Up: Substitutos 6.3.6 Falha na substituição --------------------------- Even when a substitute for a derivation is available, sometimes the substitution attempt will fail. This can happen for a variety of reasons: the substitute server might be offline, the substitute may recently have been deleted, the connection might have been interrupted, etc. When substitutes are enabled and a substitute for a derivation is available, but the substitution attempt fails, Guix will attempt to build the derivation locally depending on whether or not ‘--fallback’ was given (*note common build option ‘--fallback’: fallback-option.). Specifically, if ‘--fallback’ was omitted, then no local build will be performed, and the derivation is considered to have failed. However, if ‘--fallback’ was given, then Guix will attempt to build the derivation locally, and the success or failure of the derivation depends on the success or failure of the local build. Note that when substitutes are disabled or no substitute is available for the derivation in question, a local build will _always_ be performed, regardless of whether or not ‘--fallback’ was given. To get an idea of how many substitutes are available right now, you can try running the ‘guix weather’ command (*note Invocando guix weather::). This command provides statistics on the substitutes provided by a server.  File: guix.pt_BR.info, Node: Confiança em binários, Prev: Falha na substituição, Up: Substitutos 6.3.7 Confiança em binários --------------------------- Today, each individual’s control over their own computing is at the mercy of institutions, corporations, and groups with enough power and determination to subvert the computing infrastructure and exploit its weaknesses. While using substitutes can be convenient, we encourage users to also build on their own, or even run their own build farm, such that the project run substitute servers are less of an interesting target. One way to help is by publishing the software you build using ‘guix publish’ so that others have one more choice of server to download substitutes from (*note Invocando guix publish::). Guix has the foundations to maximize build reproducibility (*note Recursos::). In most cases, independent builds of a given package or derivation should yield bit-identical results. Thus, through a diverse set of independent package builds, we can strengthen the integrity of our systems. The ‘guix challenge’ command aims to help users assess substitute servers, and to assist developers in finding out about non-deterministic package builds (*note Invocando guix challenge::). Similarly, the ‘--check’ option of ‘guix build’ allows users to check whether previously-installed substitutes are genuine by rebuilding them locally (*note ‘guix build --check’: build-check.). In the future, we want Guix to have support to publish and retrieve binaries to/from other users, in a peer-to-peer fashion. If you would like to discuss this project, join us on .  File: guix.pt_BR.info, Node: Pacotes com múltiplas saídas, Next: Invocando guix gc, Prev: Substitutos, Up: Gerenciamento de pacote 6.4 Pacotes com múltiplas saídas ================================ Often, packages defined in Guix have a single “output”—i.e., the source package leads to exactly one directory in the store. When running ‘guix install glibc’, one installs the default output of the GNU libc package; the default output is called ‘out’, but its name can be omitted as shown in this command. In this particular case, the default output of ‘glibc’ contains all the C header files, shared libraries, static libraries, Info documentation, and other supporting files. Sometimes it is more appropriate to separate the various types of files produced from a single source package into separate outputs. For instance, the GLib C library (used by GTK+ and related packages) installs more than 20 MiB of reference documentation as HTML pages. To save space for users who do not need it, the documentation goes to a separate output, called ‘doc’. To install the main GLib output, which contains everything but the documentation, one would run: guix install glib The command to install its documentation is: guix install glib:doc Some packages install programs with different “dependency footprints”. For instance, the WordNet package installs both command-line tools and graphical user interfaces (GUIs). The former depend solely on the C library, whereas the latter depend on Tcl/Tk and the underlying X libraries. In this case, we leave the command-line tools in the default output, whereas the GUIs are in a separate output. This allows users who do not need the GUIs to save space. The ‘guix size’ command can help find out about such situations (*note Invocando guix size::). ‘guix graph’ can also be helpful (*note Invocando guix graph::). There are several such multiple-output packages in the GNU distribution. Other conventional output names include ‘lib’ for libraries and possibly header files, ‘bin’ for stand-alone programs, and ‘debug’ for debugging information (*note Instalando arquivos de depuração::). The outputs of a packages are listed in the third column of the output of ‘guix package --list-available’ (*note Invocando guix package::).  File: guix.pt_BR.info, Node: Invocando guix gc, Next: Invocando guix pull, Prev: Pacotes com múltiplas saídas, Up: Gerenciamento de pacote 6.5 Invocando ‘guix gc’ ======================= Packages that are installed, but not used, may be “garbage-collected”. The ‘guix gc’ command allows users to explicitly run the garbage collector to reclaim space from the ‘/gnu/store’ directory. It is the _only_ way to remove files from ‘/gnu/store’—removing files or directories manually may break it beyond repair! The garbage collector has a set of known “roots”: any file under ‘/gnu/store’ reachable from a root is considered “live” and cannot be deleted; any other file is considered “dead” and may be deleted. The set of garbage collector roots (“GC roots” for short) includes default user profiles; by default, the symlinks under ‘/var/guix/gcroots’ represent these GC roots. New GC roots can be added with ‘guix build --root’, for example (*note Invocando guix build::). The ‘guix gc --list-roots’ command lists them. Prior to running ‘guix gc --collect-garbage’ to make space, it is often useful to remove old generations from user profiles; that way, old package builds referenced by those generations can be reclaimed. This is achieved by running ‘guix package --delete-generations’ (*note Invocando guix package::). Our recommendation is to run a garbage collection periodically, or when you are short on disk space. For instance, to guarantee that at least 5 GB are available on your disk, simply run: guix gc -F 5G It is perfectly safe to run as a non-interactive periodic job (*note Execução de trabalho agendado::, for how to set up such a job). Running ‘guix gc’ with no arguments will collect as much garbage as it can, but that is often inconvenient: you may find yourself having to rebuild or re-download software that is “dead” from the GC viewpoint but that is necessary to build other pieces of software—e.g., the compiler tool chain. The ‘guix gc’ command has three modes of operation: it can be used to garbage-collect any dead files (the default), to delete specific files (the ‘--delete’ option), to print garbage-collector information, or for more advanced queries. The garbage collection options are as follows: ‘--collect-garbage[=MIN]’ ‘-C [MIN]’ Collect garbage—i.e., unreachable ‘/gnu/store’ files and sub-directories. This is the default operation when no option is specified. When MIN is given, stop once MIN bytes have been collected. MIN may be a number of bytes, or it may include a unit as a suffix, such as ‘MiB’ for mebibytes and ‘GB’ for gigabytes (*note size specifications: (coreutils)Block size.). When MIN is omitted, collect all the garbage. ‘--free-space=FREE’ ‘-F FREE’ Collect garbage until FREE space is available under ‘/gnu/store’, if possible; FREE denotes storage space, such as ‘500MiB’, as described above. When FREE or more is already available in ‘/gnu/store’, do nothing and exit immediately. ‘--delete-generations[=DURAÇÃO]’ ‘-d [DURATION]’ Before starting the garbage collection process, delete all the generations older than DURATION, for all the user profiles and home environment generations; when run as root, this applies to all the profiles _of all the users_. For example, this command deletes all the generations of all your profiles that are older than 2 months (except generations that are current), and then proceeds to free space until at least 10 GiB are available: guix gc -d 2m -F 10G ‘--delete’ ‘-D’ Attempt to delete all the store files and directories specified as arguments. This fails if some of the files are not in the store, or if they are still live. ‘--list-failures’ List store items corresponding to cached build failures. This prints nothing unless the daemon was started with ‘--cache-failures’ (*note ‘--cache-failures’: Invocando guix-daemon.). ‘--list-roots’ List the GC roots owned by the user; when run as root, list _all_ the GC roots. ‘--list-busy’ List store items in use by currently running processes. These store items are effectively considered GC roots: they cannot be deleted. ‘--clear-failures’ Remove the specified store items from the failed-build cache. Again, this option only makes sense when the daemon is started with ‘--cache-failures’. Otherwise, it does nothing. ‘--list-dead’ Show the list of dead files and directories still present in the store—i.e., files and directories no longer reachable from any root. ‘--list-live’ Show the list of live store files and directories. In addition, the references among existing store files can be queried: ‘--references’ ‘--referrers’ List the references (respectively, the referrers) of store files given as arguments. ‘--requisites’ ‘-R’ List the requisites of the store files passed as arguments. Requisites include the store files themselves, their references, and the references of these, recursively. In other words, the returned list is the “transitive closure” of the store files. *Note Invocando guix size::, for a tool to profile the size of the closure of an element. *Note Invocando guix graph::, for a tool to visualize the graph of references. ‘--derivers’ Return the derivation(s) leading to the given store items (*note Derivações::). For example, this command: guix gc --derivers $(guix package -I ^emacs$ | cut -f4) returns the ‘.drv’ file(s) leading to the ‘emacs’ package installed in your profile. Note that there may be zero matching ‘.drv’ files, for instance because these files have been garbage-collected. There can also be more than one matching ‘.drv’ due to fixed-output derivations. Lastly, the following options allow you to check the integrity of the store and to control disk usage. ‘--verify[=OPTIONS]’ Verify the integrity of the store. By default, make sure that all the store items marked as valid in the database of the daemon actually exist in ‘/gnu/store’. When provided, OPTIONS must be a comma-separated list containing one or more of ‘contents’ and ‘repair’. When passing ‘--verify=contents’, the daemon computes the content hash of each store item and compares it against its hash in the database. Hash mismatches are reported as data corruptions. Because it traverses _all the files in the store_, this command can take a long time, especially on systems with a slow disk drive. Using ‘--verify=repair’ or ‘--verify=contents,repair’ causes the daemon to try to repair corrupt store items by fetching substitutes for them (*note Substitutos::). Because repairing is not atomic, and thus potentially dangerous, it is available only to the system administrator. A lightweight alternative, when you know exactly which items in the store are corrupt, is ‘guix build --repair’ (*note Invocando guix build::). ‘--optimize’ Optimize the store by hard-linking identical files—this is “deduplication”. The daemon performs deduplication after each successful build or archive import, unless it was started with ‘--disable-deduplication’ (*note ‘--disable-deduplication’: Invocando guix-daemon.). Thus, this option is primarily useful when the daemon was running with ‘--disable-deduplication’. ‘--vacuum-database’ Guix uses an sqlite database to keep track of the items in (*note O armazém::). Over time it is possible that the database may grow to a large size and become fragmented. As a result, one may wish to clear the freed space and join the partially used pages in the database left behind from removed packages or after running the garbage collector. Running ‘sudo guix gc --vacuum-database’ will lock the database and ‘VACUUM’ the store, defragmenting the database and purging freed pages, unlocking the database when it finishes.  File: guix.pt_BR.info, Node: Invocando guix pull, Next: Invoking guix time-machine, Prev: Invocando guix gc, Up: Gerenciamento de pacote 6.6 Invocando ‘guix pull’ ========================= Packages are installed or upgraded to the latest version available in the distribution currently available on your local machine. To update that distribution, along with the Guix tools, you must run ‘guix pull’: the command downloads the latest Guix source code and package descriptions, and deploys it. Source code is downloaded from a Git (https://git-scm.com/book/en/) repository, by default the official GNU Guix repository, though this can be customized. ‘guix pull’ ensures that the code it downloads is _authentic_ by verifying that commits are signed by Guix developers. Specifically, ‘guix pull’ downloads code from the “channels” (*note Canais::) specified by one of the followings, in this order: 1. the ‘--channels’ option; 2. the user’s ‘~/.config/guix/channels.scm’ file; 3. the system-wide ‘/etc/guix/channels.scm’ file; 4. the built-in default channels specified in the ‘%default-channels’ variable. On completion, ‘guix package’ will use packages and package versions from this just-retrieved copy of Guix. Not only that, but all the Guix commands and Scheme modules will also be taken from that latest version. New ‘guix’ sub-commands added by the update also become available. Any user can update their Guix copy using ‘guix pull’, and the effect is limited to the user who ran ‘guix pull’. For instance, when user ‘root’ runs ‘guix pull’, this has no effect on the version of Guix that user ‘alice’ sees, and vice versa. The result of running ‘guix pull’ is a “profile” available under ‘~/.config/guix/current’ containing the latest Guix. Thus, make sure to add it to the beginning of your search path so that you use the latest version, and similarly for the Info manual (*note Documentação::): export PATH="$HOME/.config/guix/current/bin:$PATH" export INFOPATH="$HOME/.config/guix/current/share/info:$INFOPATH" The ‘--list-generations’ or ‘-l’ option lists past generations produced by ‘guix pull’, along with details about their provenance: $ guix pull -l Generation 1 Jun 10 2018 00:18:18 guix 65956ad repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: 65956ad3526ba09e1f7a40722c96c6ef7c0936fe Generation 2 Jun 11 2018 11:02:49 guix e0cc7f6 repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: e0cc7f669bec22c37481dd03a7941c7d11a64f1d Generation 3 Jun 13 2018 23:31:07 (current) guix 844cc1c repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: 844cc1c8f394f03b404c5bb3aee086922373490c *Note ‘guix describe’: Invocando guix describe, for other ways to describe the current status of Guix. This ‘~/.config/guix/current’ profile works exactly like the profiles created by ‘guix package’ (*note Invocando guix package::). That is, you can list generations, roll back to the previous generation—i.e., the previous Guix—and so on: $ guix pull --roll-back switched from generation 3 to 2 $ guix pull --delete-generations=1 deleting /var/guix/profiles/per-user/charlie/current-guix-1-link You can also use ‘guix package’ (*note Invocando guix package::) to manage the profile by naming it explicitly: $ guix package -p ~/.config/guix/current --roll-back switched from generation 3 to 2 $ guix package -p ~/.config/guix/current --delete-generations=1 deleting /var/guix/profiles/per-user/charlie/current-guix-1-link The ‘guix pull’ command is usually invoked with no arguments, but it supports the following options: ‘--url=URL’ ‘--commit=COMMIT’ ‘--branch=RAMO’ Download code for the ‘guix’ channel from the specified URL, at the given COMMIT (a valid Git commit ID represented as a hexadecimal string or the name of a tag), or BRANCH. These options are provided for convenience, but you can also specify your configuration in the ‘~/.config/guix/channels.scm’ file or using the ‘--channels’ option (see below). ‘--channels=FILE’ ‘-C ARQUIVO’ Read the list of channels from FILE instead of ‘~/.config/guix/channels.scm’ or ‘/etc/guix/channels.scm’. FILE must contain Scheme code that evaluates to a list of channel objects. *Note Canais::, for more information. ‘--news’ ‘-N’ Display news written by channel authors for their users for changes made since the previous generation (*note Writing Channel News: Canais.). When ‘--details’ is passed, additionally display new and upgraded packages. You can view that information for previous generations with ‘guix pull -l’. ‘--list-generations[=PADRÃO]’ ‘-l [PADRÃO]’ List all the generations of ‘~/.config/guix/current’ or, if PATTERN is provided, the subset of generations that match PATTERN. The syntax of PATTERN is the same as with ‘guix package --list-generations’ (*note Invocando guix package::). By default, this prints information about the channels used in each revision as well as the corresponding news entries. If you pass ‘--details’, it will also print the list of packages added and upgraded in each generation compared to the previous one. ‘--details’ Instruct ‘--list-generations’ or ‘--news’ to display more information about the differences between subsequent generations—see above. ‘--roll-back’ Roll back to the previous “generation” of ‘~/.config/guix/current’—i.e., undo the last transaction. ‘--switch-generation=PADRÃO’ ‘-S PADRÃO’ Switch to a particular generation defined by PATTERN. PATTERN may be either a generation number or a number prefixed with “+” or “-”. The latter means: move forward/backward by a specified number of generations. For example, if you want to return to the latest generation after ‘--roll-back’, use ‘--switch-generation=+1’. ‘--delete-generations[=PATTERN]’ ‘-d [PATTERN]’ When PATTERN is omitted, delete all generations except the current one. This command accepts the same patterns as ‘--list-generations’. When PATTERN is specified, delete the matching generations. When PATTERN specifies a duration, generations _older_ than the specified duration match. For instance, ‘--delete-generations=1m’ deletes generations that are more than one month old. If the current generation matches, it is _not_ deleted. Note that deleting generations prevents rolling back to them. Consequently, this command must be used with care. *Note Invocando guix describe::, for a way to display information about the current generation only. ‘--profile=PERFIL’ ‘-p PERFIL’ Use PROFILE instead of ‘~/.config/guix/current’. ‘--dry-run’ ‘-n’ Show which channel commit(s) would be used and what would be built or substituted but do not actually do it. ‘--allow-downgrades’ Allow pulling older or unrelated revisions of channels than those currently in use. By default, ‘guix pull’ protects against so-called “downgrade attacks” whereby the Git repository of a channel would be reset to an earlier or unrelated revision of itself, potentially leading you to install older, known-vulnerable versions of software packages. Nota: Make sure you understand its security implications before using ‘--allow-downgrades’. ‘--disable-authentication’ Allow pulling channel code without authenticating it. By default, ‘guix pull’ authenticates code downloaded from channels by verifying that its commits are signed by authorized developers, and raises an error if this is not the case. This option instructs it to not perform any such verification. Nota: Make sure you understand its security implications before using ‘--disable-authentication’. ‘--system=SYSTEM’ ‘-s SISTEMA’ Attempt to build for SYSTEM—e.g., ‘i686-linux’—instead of the system type of the build host. ‘--bootstrap’ Use the bootstrap Guile to build the latest Guix. This option is only useful to Guix developers. The “channel” mechanism allows you to instruct ‘guix pull’ which repository and branch to pull from, as well as _additional_ repositories containing package modules that should be deployed. *Note Canais::, for more information. In addition, ‘guix pull’ supports all the common build options (*note Opções de compilação comum::).  File: guix.pt_BR.info, Node: Invoking guix time-machine, Next: Inferiores, Prev: Invocando guix pull, Up: Gerenciamento de pacote 6.7 Invoking ‘guix time-machine’ ================================ The ‘guix time-machine’ command provides access to other revisions of Guix, for example to install older versions of packages, or to reproduce a computation in an identical environment. The revision of Guix to be used is defined by a commit or by a channel description file created by ‘guix describe’ (*note Invocando guix describe::). Let’s assume that you want to travel to those days of November 2020 when version 1.2.0 of Guix was released and, once you’re there, run the ‘guile’ of that time: guix time-machine --commit=v1.2.0 -- \ environment -C --ad-hoc guile -- guile The command above fetches Guix 1.2.0 and runs its ‘guix environment’ command to spawn an environment in a container running ‘guile’ (‘guix environment’ has since been subsumed by ‘guix shell’; *note Invoking guix shell::). It’s like driving a DeLorean(1)! The first ‘guix time-machine’ invocation can be expensive: it may have to download or even build a large number of packages; the result is cached though and subsequent commands targeting the same commit are almost instantaneous. Nota: The history of Guix is immutable and ‘guix time-machine’ provides the exact same software as they are in a specific Guix revision. Naturally, no security fixes are provided for old versions of Guix or its channels. A careless use of ‘guix time-machine’ opens the door to security vulnerabilities. *Note ‘--allow-downgrades’: Invocando guix pull. The general syntax is: guix time-machine OPTIONS... -- COMMAND ARG... where COMMAND and ARG... are passed unmodified to the ‘guix’ command of the specified revision. The OPTIONS that define this revision are the same as for ‘guix pull’ (*note Invocando guix pull::): ‘--url=URL’ ‘--commit=COMMIT’ ‘--branch=RAMO’ Use the ‘guix’ channel from the specified URL, at the given COMMIT (a valid Git commit ID represented as a hexadecimal string or the name of a tag), or BRANCH. ‘--channels=FILE’ ‘-C ARQUIVO’ Read the list of channels from FILE. FILE must contain Scheme code that evaluates to a list of channel objects. *Note Canais:: for more information. As for ‘guix pull’, the absence of any options means that the latest commit on the master branch will be used. The command guix time-machine -- build hello will thus build the package ‘hello’ as defined in the master branch, which is in general a newer revision of Guix than you have installed. Time travel works in both directions! Note that ‘guix time-machine’ can trigger builds of channels and their dependencies, and these are controlled by the standard build options (*note Opções de compilação comum::). ---------- Footnotes ---------- (1) If you don’t know what a DeLorean is, consider traveling back to the 1980’s.  File: guix.pt_BR.info, Node: Inferiores, Next: Invocando guix describe, Prev: Invoking guix time-machine, Up: Gerenciamento de pacote 6.8 Inferiores ============== Nota: The functionality described here is a “technology preview” as of version 1.4.0. As such, the interface is subject to change. Sometimes you might need to mix packages from the revision of Guix you’re currently running with packages available in a different revision of Guix. Guix “inferiors” allow you to achieve that by composing different Guix revisions in arbitrary ways. Technically, an “inferior” is essentially a separate Guix process connected to your main Guix process through a REPL (*note Invocando guix repl::). The ‘(guix inferior)’ module allows you to create inferiors and to communicate with them. It also provides a high-level interface to browse and manipulate the packages that an inferior provides—“inferior packages”. When combined with channels (*note Canais::), inferiors provide a simple way to interact with a separate revision of Guix. For example, let’s assume you want to install in your profile the current ‘guile’ package, along with the ‘guile-json’ as it existed in an older revision of Guix—perhaps because the newer ‘guile-json’ has an incompatible API and you want to run your code against the old API. To do that, you could write a manifest for use by ‘guix package --manifest’ (*note Writing Manifests::); in that manifest, you would create an inferior for that old Guix revision you care about, and you would look up the ‘guile-json’ package in the inferior: (use-modules (guix inferior) (guix channels) (srfi srfi-1)) ;for 'first' (define channels ;; This is the old revision from which we want to ;; extract guile-json. (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit "65956ad3526ba09e1f7a40722c96c6ef7c0936fe")))) (define inferior ;; An inferior representing the above revision. (inferior-for-channels channels)) ;; Now create a manifest with the current "guile" package ;; and the old "guile-json" package. (packages->manifest (list (first (lookup-inferior-packages inferior "guile-json")) (specification->package "guile"))) On its first run, ‘guix package --manifest’ might have to build the channel you specified before it can create the inferior; subsequent runs will be much faster because the Guix revision will be cached. The ‘(guix inferior)’ module provides the following procedures to open an inferior: -- Scheme Procedure: inferior-for-channels CHANNELS [#:cache-directory] [#:ttl] Return an inferior for CHANNELS, a list of channels. Use the cache at CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds. This procedure opens a new connection to the build daemon. As a side effect, this procedure may build or substitute binaries for CHANNELS, which can take time. -- Scheme Procedure: open-inferior DIRECTORY [#:command "bin/guix"] Open the inferior Guix in DIRECTORY, running ‘DIRECTORY/COMMAND repl’ or equivalent. Return ‘#f’ if the inferior could not be launched. The procedures listed below allow you to obtain and manipulate inferior packages. -- Scheme Procedure: inferior-packages INFERIOR Return the list of packages known to INFERIOR. -- Scheme Procedure: lookup-inferior-packages INFERIOR NAME [VERSION] Return the sorted list of inferior packages matching NAME in INFERIOR, with highest version numbers first. If VERSION is true, return only packages with a version number prefixed by VERSION. -- Scheme Procedure: inferior-package? OBJ Return true if OBJ is an inferior package. -- Scheme Procedure: inferior-package-name PACKAGE -- Scheme Procedure: inferior-package-version PACKAGE -- Scheme Procedure: inferior-package-synopsis PACKAGE -- Scheme Procedure: inferior-package-description PACKAGE -- Scheme Procedure: inferior-package-home-page PACKAGE -- Scheme Procedure: inferior-package-location PACKAGE -- Scheme Procedure: inferior-package-inputs PACKAGE -- Scheme Procedure: inferior-package-native-inputs PACKAGE -- Scheme Procedure: inferior-package-propagated-inputs PACKAGE -- Scheme Procedure: inferior-package-transitive-propagated-inputs PACKAGE -- Scheme Procedure: inferior-package-native-search-paths PACKAGE -- Scheme Procedure: inferior-package-transitive-native-search-paths PACKAGE -- Scheme Procedure: inferior-package-search-paths PACKAGE These procedures are the counterpart of package record accessors (*note Referência do package::). Most of them work by querying the inferior PACKAGE comes from, so the inferior must still be live when you call these procedures. Inferior packages can be used transparently like any other package or file-like object in G-expressions (*note Expressões-G::). They are also transparently handled by the ‘packages->manifest’ procedure, which is commonly used in manifests (*note the ‘--manifest’ option of ‘guix package’: Invocando guix package.). Thus you can insert an inferior package pretty much anywhere you would insert a regular package: in manifests, in the ‘packages’ field of your ‘operating-system’ declaration, and so on.  File: guix.pt_BR.info, Node: Invocando guix describe, Next: Invocando guix archive, Prev: Inferiores, Up: Gerenciamento de pacote 6.9 Invocando ‘guix describe’ ============================= Often you may want to answer questions like: “Which revision of Guix am I using?” or “Which channels am I using?” This is useful information in many situations: if you want to _replicate_ an environment on a different machine or user account, if you want to report a bug or to determine what change in the channels you are using caused it, or if you want to record your system state for reproducibility purposes. The ‘guix describe’ command answers these questions. When run from a ‘guix pull’ed ‘guix’, ‘guix describe’ displays the channel(s) that it was built from, including their repository URL and commit IDs (*note Canais::): $ guix describe Generation 10 Sep 03 2018 17:32:44 (current) guix e0fa68c repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: e0fa68c7718fffd33d81af415279d6ddb518f727 If you’re familiar with the Git version control system, this is similar in spirit to ‘git describe’; the output is also similar to that of ‘guix pull --list-generations’, but limited to the current generation (*note the ‘--list-generations’ option: Invocando guix pull.). Because the Git commit ID shown above unambiguously refers to a snapshot of Guix, this information is all it takes to describe the revision of Guix you’re using, and also to replicate it. To make it easier to replicate Guix, ‘guix describe’ can also be asked to return a list of channels instead of the human-readable description above: $ guix describe -f channels (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit "e0fa68c7718fffd33d81af415279d6ddb518f727") (introduction (make-channel-introduction "9edb3f66fd807b096b48283debdcddccfea34bad" (openpgp-fingerprint "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))) You can save this to a file and feed it to ‘guix pull -C’ on some other machine or at a later point in time, which will instantiate _this exact Guix revision_ (*note the ‘-C’ option: Invocando guix pull.). From there on, since you’re able to deploy the same revision of Guix, you can just as well _replicate a complete software environment_. We humbly think that this is _awesome_, and we hope you’ll like it too! The details of the options supported by ‘guix describe’ are as follows: ‘--format=FORMAT’ ‘-f FORMAT’ Produce output in the specified FORMAT, one of: ‘human’ produce human-readable output; ‘channels’ produce a list of channel specifications that can be passed to ‘guix pull -C’ or installed as ‘~/.config/guix/channels.scm’ (*note Invocando guix pull::); ‘channels-sans-intro’ like ‘channels’, but omit the ‘introduction’ field; use it to produce a channel specification suitable for Guix version 1.1.0 or earlier—the ‘introduction’ field has to do with channel authentication (*note Channel Authentication: Canais.) and is not supported by these older versions; ‘json’ produce a list of channel specifications in JSON format; ‘recutils’ produce a list of channel specifications in Recutils format. ‘--list-formats’ Display available formats for ‘--format’ option. ‘--profile=PERFIL’ ‘-p PERFIL’ Display information about PROFILE.  File: guix.pt_BR.info, Node: Invocando guix archive, Prev: Invocando guix describe, Up: Gerenciamento de pacote 6.10 Invocando ‘guix archive’ ============================= The ‘guix archive’ command allows users to “export” files from the store into a single archive, and to later “import” them on a machine that runs Guix. In particular, it allows store files to be transferred from one machine to the store on another machine. Nota: If you’re looking for a way to produce archives in a format suitable for tools other than Guix, *note Invocando guix pack::. To export store files as an archive to standard output, run: guix archive --export OPTIONS SPECIFICATIONS... SPECIFICATIONS may be either store file names or package specifications, as for ‘guix package’ (*note Invocando guix package::). For instance, the following command creates an archive containing the ‘gui’ output of the ‘git’ package and the main output of ‘emacs’: guix archive --export git:gui /gnu/store/...-emacs-24.3 > great.nar If the specified packages are not built yet, ‘guix archive’ automatically builds them. The build process may be controlled with the common build options (*note Opções de compilação comum::). To transfer the ‘emacs’ package to a machine connected over SSH, one would run: guix archive --export -r emacs | ssh the-machine guix archive --import Similarly, a complete user profile may be transferred from one machine to another like this: guix archive --export -r $(readlink -f ~/.guix-profile) | \ ssh the-machine guix archive --import However, note that, in both examples, all of ‘emacs’ and the profile as well as all of their dependencies are transferred (due to ‘-r’), regardless of what is already available in the store on the target machine. The ‘--missing’ option can help figure out which items are missing from the target store. The ‘guix copy’ command simplifies and optimizes this whole process, so this is probably what you should use in this case (*note Invocando guix copy::). Each store item is written in the “normalized archive” or “nar” format (described below), and the output of ‘guix archive --export’ (and input of ‘guix archive --import’) is a “nar bundle”. The nar format is comparable in spirit to ‘tar’, but with differences that make it more appropriate for our purposes. First, rather than recording all Unix metadata for each file, the nar format only mentions the file type (regular, directory, or symbolic link); Unix permissions and owner/group are dismissed. Second, the order in which directory entries are stored always follows the order of file names according to the C locale collation order. This makes archive production fully deterministic. That nar bundle format is essentially the concatenation of zero or more nars along with metadata for each store item it contains: its file name, references, corresponding derivation, and a digital signature. When exporting, the daemon digitally signs the contents of the archive, and that digital signature is appended. When importing, the daemon verifies the signature and rejects the import in case of an invalid signature or if the signing key is not authorized. The main options are: ‘--export’ Export the specified store files or packages (see below). Write the resulting archive to the standard output. Dependencies are _not_ included in the output, unless ‘--recursive’ is passed. ‘-r’ ‘--recursive’ When combined with ‘--export’, this instructs ‘guix archive’ to include dependencies of the given items in the archive. Thus, the resulting archive is self-contained: it contains the closure of the exported store items. ‘--import’ Read an archive from the standard input, and import the files listed therein into the store. Abort if the archive has an invalid digital signature, or if it is signed by a public key not among the authorized keys (see ‘--authorize’ below). ‘--missing’ Read a list of store file names from the standard input, one per line, and write on the standard output the subset of these files missing from the store. ‘--generate-key[=PARAMETERS]’ Generate a new key pair for the daemon. This is a prerequisite before archives can be exported with ‘--export’. This operation is usually instantaneous but it can take time if the system’s entropy pool needs to be refilled. On Guix System, ‘guix-service-type’ takes care of generating this key pair the first boot. The generated key pair is typically stored under ‘/etc/guix’, in ‘signing-key.pub’ (public key) and ‘signing-key.sec’ (private key, which must be kept secret). When PARAMETERS is omitted, an ECDSA key using the Ed25519 curve is generated, or, for Libgcrypt versions before 1.6.0, it is a 4096-bit RSA key. Alternatively, PARAMETERS can specify ‘genkey’ parameters suitable for Libgcrypt (*note ‘gcry_pk_genkey’: (gcrypt)General public-key related Functions.). ‘--authorize’ Authorize imports signed by the public key passed on standard input. The public key must be in “s-expression advanced format”—i.e., the same format as the ‘signing-key.pub’ file. The list of authorized keys is kept in the human-editable file ‘/etc/guix/acl’. The file contains “advanced-format s-expressions” (https://people.csail.mit.edu/rivest/Sexp.txt) and is structured as an access-control list in the Simple Public-Key Infrastructure (SPKI) (https://theworld.com/~cme/spki.txt). ‘--extract=DIRECTORY’ ‘-x DIRECTORY’ Read a single-item archive as served by substitute servers (*note Substitutos::) and extract it to DIRECTORY. This is a low-level operation needed in only very narrow use cases; see below. For example, the following command extracts the substitute for Emacs served by ‘ci.guix.gnu.org’ to ‘/tmp/emacs’: $ wget -O - \ https://ci.guix.gnu.org/nar/gzip/...-emacs-24.5 \ | gunzip | guix archive -x /tmp/emacs Single-item archives are different from multiple-item archives produced by ‘guix archive --export’; they contain a single store item, and they do _not_ embed a signature. Thus this operation does _no_ signature verification and its output should be considered unsafe. The primary purpose of this operation is to facilitate inspection of archive contents coming from possibly untrusted substitute servers (*note Invocando guix challenge::). ‘--list’ ‘-t’ Read a single-item archive as served by substitute servers (*note Substitutos::) and print the list of files it contains, as in this example: $ wget -O - \ https://ci.guix.gnu.org/nar/lzip/...-emacs-26.3 \ | lzip -d | guix archive -t  File: guix.pt_BR.info, Node: Canais, Next: Desenvolvimento, Prev: Gerenciamento de pacote, Up: Top 7 Canais ******** Guix and its package collection are updated by running ‘guix pull’ (*note Invocando guix pull::). By default ‘guix pull’ downloads and deploys Guix itself from the official GNU Guix repository. This can be customized by defining “channels” in the ‘~/.config/guix/channels.scm’ file. A channel specifies a URL and branch of a Git repository to be deployed, and ‘guix pull’ can be instructed to pull from one or more channels. In other words, channels can be used to _customize_ and to _extend_ Guix, as we will see below. Guix is able to take into account security concerns and deal with authenticated updates. * Menu: * Specifying Additional Channels:: Extending the package collection. * Using a Custom Guix Channel:: Using a customized Guix. * Replicating Guix:: Running the _exact same_ Guix. * Channel Authentication:: How Guix verifies what it fetches. * Channels with Substitutes:: Using channels with available substitutes. * Creating a Channel:: How to write your custom channel. * Package Modules in a Sub-directory:: Specifying the channel’s package modules location. * Declaring Channel Dependencies:: How to depend on other channels. * Specifying Channel Authorizations:: Defining channel authors authorizations. * Primary URL:: Distinguishing mirror to original. * Writing Channel News:: Communicating information to channel’s users.  File: guix.pt_BR.info, Node: Specifying Additional Channels, Next: Using a Custom Guix Channel, Up: Canais 7.1 Specifying Additional Channels ================================== You can specify _additional channels_ to pull from. To use a channel, write ‘~/.config/guix/channels.scm’ to instruct ‘guix pull’ to pull from it _in addition_ to the default Guix channel(s): ;; Add variant packages to those Guix provides. (cons (channel (name 'variant-packages) (url "https://example.org/variant-packages.git")) %default-channels) Note that the snippet above is (as always!) Scheme code; we use ‘cons’ to add a channel the list of channels that the variable ‘%default-channels’ is bound to (*note ‘cons’ and lists: (guile)Pairs.). With this file in place, ‘guix pull’ builds not only Guix but also the package modules from your own repository. The result in ‘~/.config/guix/current’ is the union of Guix with your own package modules: $ guix describe Generation 19 Aug 27 2018 16:20:48 guix d894ab8 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: d894ab8e9bfabcefa6c49d9ba2e834dd5a73a300 variant-packages dd3df5e repository URL: https://example.org/variant-packages.git branch: master commit: dd3df5e2c8818760a8fc0bd699e55d3b69fef2bb The output of ‘guix describe’ above shows that we’re now running Generation 19 and that it includes both Guix and packages from the ‘variant-personal-packages’ channel (*note Invocando guix describe::).  File: guix.pt_BR.info, Node: Using a Custom Guix Channel, Next: Replicating Guix, Prev: Specifying Additional Channels, Up: Canais 7.2 Using a Custom Guix Channel =============================== The channel called ‘guix’ specifies where Guix itself—its command-line tools as well as its package collection—should be downloaded. For instance, suppose you want to update from another copy of the Guix repository at ‘example.org’, and specifically the ‘super-hacks’ branch, you can write in ‘~/.config/guix/channels.scm’ this specification: ;; Tell 'guix pull' to use another repo. (list (channel (name 'guix) (url "https://example.org/another-guix.git") (branch "super-hacks"))) From there on, ‘guix pull’ will fetch code from the ‘super-hacks’ branch of the repository at ‘example.org’. The authentication concern is addressed below (*note Channel Authentication::).  File: guix.pt_BR.info, Node: Replicating Guix, Next: Channel Authentication, Prev: Using a Custom Guix Channel, Up: Canais 7.3 Replicating Guix ==================== The ‘guix describe’ command shows precisely which commits were used to build the instance of Guix we’re using (*note Invocando guix describe::). We can replicate this instance on another machine or at a different point in time by providing a channel specification “pinned” to these commits that looks like this: ;; Deploy specific commits of my channels of interest. (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit "6298c3ffd9654d3231a6f25390b056483e8f407c")) (channel (name 'variant-packages) (url "https://example.org/variant-packages.git") (commit "dd3df5e2c8818760a8fc0bd699e55d3b69fef2bb"))) To obtain this pinned channel specification, the easiest way is to run ‘guix describe’ and to save its output in the ‘channels’ format in a file, like so: guix describe -f channels > channels.scm The resulting ‘channels.scm’ file can be passed to the ‘-C’ option of ‘guix pull’ (*note Invocando guix pull::) or ‘guix time-machine’ (*note Invoking guix time-machine::), as in this example: guix time-machine -C channels.scm -- shell python -- python3 Given the ‘channels.scm’ file, the command above will always fetch the _exact same Guix instance_, then use that instance to run the exact same Python (*note Invoking guix shell::). On any machine, at any time, it ends up running the exact same binaries, bit for bit. Pinned channels address a problem similar to “lock files” as implemented by some deployment tools—they let you pin and reproduce a set of packages. In the case of Guix though, you are effectively pinning the entire package set as defined at the given channel commits; in fact, you are pinning all of Guix, including its core modules and command-line tools. You’re also getting strong guarantees that you are, indeed, obtaining the exact same software. This gives you super powers, allowing you to track the provenance of binary artifacts with very fine grain, and to reproduce software environments at will—some sort of “meta reproducibility” capabilities, if you will. *Note Inferiores::, for another way to take advantage of these super powers.  File: guix.pt_BR.info, Node: Channel Authentication, Next: Channels with Substitutes, Prev: Replicating Guix, Up: Canais 7.4 Channel Authentication ========================== The ‘guix pull’ and ‘guix time-machine’ commands “authenticate” the code retrieved from channels: they make sure each commit that is fetched is signed by an authorized developer. The goal is to protect from unauthorized modifications to the channel that would lead users to run malicious code. As a user, you must provide a “channel introduction” in your channels file so that Guix knows how to authenticate its first commit. A channel specification, including its introduction, looks something along these lines: (channel (name 'some-channel) (url "https://example.org/some-channel.git") (introduction (make-channel-introduction "6f0d8cc0d88abb59c324b2990bfee2876016bb86" (openpgp-fingerprint "CABB A931 C0FF EEC6 900D 0CFB 090B 1199 3D9A EBB5")))) The specification above shows the name and URL of the channel. The call to ‘make-channel-introduction’ above specifies that authentication of this channel starts at commit ‘6f0d8cc...’, which is signed by the OpenPGP key with fingerprint ‘CABB A931...’. For the main channel, called ‘guix’, you automatically get that information from your Guix installation. For other channels, include the channel introduction provided by the channel authors in your ‘channels.scm’ file. Make sure you retrieve the channel introduction from a trusted source since that is the root of your trust. If you’re curious about the authentication mechanics, read on!  File: guix.pt_BR.info, Node: Channels with Substitutes, Next: Creating a Channel, Prev: Channel Authentication, Up: Canais 7.5 Channels with Substitutes ============================= When running ‘guix pull’, Guix will first compile the definitions of every available package. This is an expensive operation for which substitutes (*note Substitutos::) may be available. The following snippet in ‘channels.scm’ will ensure that ‘guix pull’ uses the latest commit with available substitutes for the package definitions: this is done by querying the continuous integration server at . (use-modules (guix ci)) (list (channel-with-substitutes-available %default-guix-channel "https://ci.guix.gnu.org")) Note that this does not mean that all the packages that you will install after running ‘guix pull’ will have available substitutes. It only ensures that ‘guix pull’ will not try to compile package definitions. This is particularly useful when using machines with limited resources.  File: guix.pt_BR.info, Node: Creating a Channel, Next: Package Modules in a Sub-directory, Prev: Channels with Substitutes, Up: Canais 7.6 Creating a Channel ====================== Let’s say you have a bunch of custom package variants or personal packages that you think would make little sense to contribute to the Guix project, but would like to have these packages transparently available to you at the command line. You would first write modules containing those package definitions (*note Módulos de pacote::), maintain them in a Git repository, and then you and anyone else can use it as an additional channel to get packages from. Neat, no? Warning: Before you, dear user, shout—“woow this is _soooo coool_!”—and publish your personal channel to the world, we would like to share a few words of caution: • Before publishing a channel, please consider contributing your package definitions to Guix proper (*note Contribuindo::). Guix as a project is open to free software of all sorts, and packages in Guix proper are readily available to all Guix users and benefit from the project’s quality assurance process. • When you maintain package definitions outside Guix, we, Guix developers, consider that _the compatibility burden is on you_. Remember that package modules and package definitions are just Scheme code that uses various programming interfaces (APIs). We want to remain free to change these APIs to keep improving Guix, possibly in ways that break your channel. We never change APIs gratuitously, but we will _not_ commit to freezing APIs either. • Corollary: if you’re using an external channel and that channel breaks, please _report the issue to the channel authors_, not to the Guix project. You’ve been warned! Having said this, we believe external channels are a practical way to exert your freedom to augment Guix’ package collection and to share your improvements, which are basic tenets of free software (https://www.gnu.org/philosophy/free-sw.html). Please email us at if you’d like to discuss this. To create a channel, create a Git repository containing your own package modules and make it available. The repository can contain anything, but a useful channel will contain Guile modules that export packages. Once you start using a channel, Guix will behave as if the root directory of that channel’s Git repository has been added to the Guile load path (*note (guile)Load Paths::). For example, if your channel contains a file at ‘my-packages/my-tools.scm’ that defines a Guile module, then the module will be available under the name ‘(my-packages my-tools)’, and you will be able to use it like any other module (*note (guile)Módulos::). As a channel author, consider bundling authentication material with your channel so that users can authenticate it. *Note Channel Authentication::, and *note Specifying Channel Authorizations::, for info on how to do it.  File: guix.pt_BR.info, Node: Package Modules in a Sub-directory, Next: Declaring Channel Dependencies, Prev: Creating a Channel, Up: Canais 7.7 Package Modules in a Sub-directory ====================================== As a channel author, you may want to keep your channel modules in a sub-directory. If your modules are in the sub-directory ‘guix’, you must add a meta-data file ‘.guix-channel’ that contains: (channel (version 0) (directory "guix"))  File: guix.pt_BR.info, Node: Declaring Channel Dependencies, Next: Specifying Channel Authorizations, Prev: Package Modules in a Sub-directory, Up: Canais 7.8 Declaring Channel Dependencies ================================== Channel authors may decide to augment a package collection provided by other channels. They can declare their channel to be dependent on other channels in a meta-data file ‘.guix-channel’, which is to be placed in the root of the channel repository. The meta-data file should contain a simple S-expression like this: (channel (version 0) (dependencies (channel (name some-collection) (url "https://example.org/first-collection.git") ;; The 'introduction' bit below is optional: you would ;; provide it for dependencies that can be authenticated. (introduction (channel-introduction (version 0) (commit "a8883b58dc82e167c96506cf05095f37c2c2c6cd") (signer "CABB A931 C0FF EEC6 900D 0CFB 090B 1199 3D9A EBB5")))) (channel (name some-other-collection) (url "https://example.org/second-collection.git") (branch "testing")))) In the above example this channel is declared to depend on two other channels, which will both be fetched automatically. The modules provided by the channel will be compiled in an environment where the modules of all these declared channels are available. For the sake of reliability and maintainability, you should avoid dependencies on channels that you don’t control, and you should aim to keep the number of dependencies to a minimum.  File: guix.pt_BR.info, Node: Specifying Channel Authorizations, Next: Primary URL, Prev: Declaring Channel Dependencies, Up: Canais 7.9 Specifying Channel Authorizations ===================================== As we saw above, Guix ensures the source code it pulls from channels comes from authorized developers. As a channel author, you need to specify the list of authorized developers in the ‘.guix-authorizations’ file in the channel’s Git repository. The authentication rule is simple: each commit must be signed by a key listed in the ‘.guix-authorizations’ file of its parent commit(s)(1) The ‘.guix-authorizations’ file looks like this: ;; Example '.guix-authorizations' file. (authorizations (version 0) ;current file format version (("AD17 A21E F8AE D8F1 CC02 DBD9 F8AE D8F1 765C 61E3" (name "alice")) ("2A39 3FFF 68F4 EF7A 3D29 12AF 68F4 EF7A 22FB B2D5" (name "bob")) ("CABB A931 C0FF EEC6 900D 0CFB 090B 1199 3D9A EBB5" (name "charlie")))) Each fingerprint is followed by optional key/value pairs, as in the example above. Currently these key/value pairs are ignored. This authentication rule creates a chicken-and-egg issue: how do we authenticate the first commit? Related to that: how do we deal with channels whose repository history contains unsigned commits and lack ‘.guix-authorizations’? And how do we fork existing channels? Channel introductions answer these questions by describing the first commit of a channel that should be authenticated. The first time a channel is fetched with ‘guix pull’ or ‘guix time-machine’, the command looks up the introductory commit and verifies that it is signed by the specified OpenPGP key. From then on, it authenticates commits according to the rule above. Authentication fails if the target commit is neither a descendant nor an ancestor of the introductory commit. Additionally, your channel must provide all the OpenPGP keys that were ever mentioned in ‘.guix-authorizations’, stored as ‘.key’ files, which can be either binary or “ASCII-armored”. By default, those ‘.key’ files are searched for in the branch named ‘keyring’ but you can specify a different branch name in ‘.guix-channel’ like so: (channel (version 0) (keyring-reference "my-keyring-branch")) To summarize, as the author of a channel, there are three things you have to do to allow users to authenticate your code: 1. Export the OpenPGP keys of past and present committers with ‘gpg --export’ and store them in ‘.key’ files, by default in a branch named ‘keyring’ (we recommend making it an “orphan branch”). 2. Introduce an initial ‘.guix-authorizations’ in the channel’s repository. Do that in a signed commit (*note Commit Access::, for information on how to sign Git commits.) 3. Advertise the channel introduction, for instance on your channel’s web page. The channel introduction, as we saw above, is the commit/key pair—i.e., the commit that introduced ‘.guix-authorizations’, and the fingerprint of the OpenPGP used to sign it. Before pushing to your public Git repository, you can run ‘guix git-authenticate’ to verify that you did sign all the commits you are about to push with an authorized key: guix git authenticate COMMIT SIGNER where COMMIT and SIGNER are your channel introduction. *Note Invoking guix git authenticate::, for details. Publishing a signed channel requires discipline: any mistake, such as an unsigned commit or a commit signed by an unauthorized key, will prevent users from pulling from your channel—well, that’s the whole point of authentication! Pay attention to merges in particular: merge commits are considered authentic if and only if they are signed by a key present in the ‘.guix-authorizations’ file of _both_ branches. ---------- Footnotes ---------- (1) Git commits form a “directed acyclic graph” (DAG). Each commit can have zero or more parents; “regular” commits have one parent and merge commits have two parent commits. Read Git for Computer Scientists (https://eagain.net/articles/git-for-computer-scientists/) for a great overview.  File: guix.pt_BR.info, Node: Primary URL, Next: Writing Channel News, Prev: Specifying Channel Authorizations, Up: Canais 7.10 Primary URL ================ Channel authors can indicate the primary URL of their channel’s Git repository in the ‘.guix-channel’ file, like so: (channel (version 0) (url "https://example.org/guix.git")) This allows ‘guix pull’ to determine whether it is pulling code from a mirror of the channel; when that is the case, it warns the user that the mirror might be stale and displays the primary URL. That way, users cannot be tricked into fetching code from a stale mirror that does not receive security updates. This feature only makes sense for authenticated repositories, such as the official ‘guix’ channel, for which ‘guix pull’ ensures the code it fetches is authentic.  File: guix.pt_BR.info, Node: Writing Channel News, Prev: Primary URL, Up: Canais 7.11 Writing Channel News ========================= Channel authors may occasionally want to communicate to their users information about important changes in the channel. You’d send them all an email, but that’s not convenient. Instead, channels can provide a “news file”; when the channel users run ‘guix pull’, that news file is automatically read and ‘guix pull --news’ can display the announcements that correspond to the new commits that have been pulled, if any. To do that, channel authors must first declare the name of the news file in their ‘.guix-channel’ file: (channel (version 0) (news-file "etc/news.txt")) The news file itself, ‘etc/news.txt’ in this example, must look something like this: (channel-news (version 0) (entry (tag "the-bug-fix") (title (en "Fixed terrible bug") (fr "Oh la la")) (body (en "@emph{Good news}! It's fixed!") (eo "Certe ĝi pli bone funkcias nun!"))) (entry (commit "bdcabe815cd28144a2d2b4bc3c5057b051fa9906") (title (en "Added a great package") (ca "Què vol dir guix?")) (body (en "Don't miss the @code{hello} package!")))) While the news file is using the Scheme syntax, avoid naming it with a ‘.scm’ extension or else it will get picked up when building the channel and yield an error since it is not a valid module. Alternatively, you can move the channel module to a subdirectory and store the news file in another directory. The file consists of a list of “news entries”. Each entry is associated with a commit or tag: it describes changes made in this commit, possibly in preceding commits as well. Users see entries only the first time they obtain the commit the entry refers to. The ‘title’ field should be a one-line summary while ‘body’ can be arbitrarily long, and both can contain Texinfo markup (*note (texinfo)Overview::). Both the title and body are a list of language tag/message tuples, which allows ‘guix pull’ to display news in the language that corresponds to the user’s locale. If you want to translate news using a gettext-based workflow, you can extract translatable strings with ‘xgettext’ (*note (gettext)xgettext Invocation::). For example, assuming you write news entries in English first, the command below creates a PO file containing the strings to translate: xgettext -o news.po -l scheme -ken etc/news.txt To sum up, yes, you could use your channel as a blog. But beware, this is _not quite_ what your users might expect.  File: guix.pt_BR.info, Node: Desenvolvimento, Next: Interface de programação, Prev: Canais, Up: Top 8 Desenvolvimento ***************** If you are a software developer, Guix provides tools that you should find helpful—independently of the language you’re developing in. This is what this chapter is about. The ‘guix shell’ command provides a convenient way to set up one-off software environments, be it for development purposes or to run a command without installing it in your profile. The ‘guix pack’ command allows you to create “application bundles” that can be easily distributed to users who do not run Guix. * Menu: * Invoking guix shell:: Spawning one-off software environments. * Invocando guix environment:: Configurando ambientes de desenvolvimento. * Invocando guix pack:: Criando pacotes de software. * The GCC toolchain:: Working with languages supported by GCC. * Invoking guix git authenticate:: Authenticating Git repositories.  File: guix.pt_BR.info, Node: Invoking guix shell, Next: Invocando guix environment, Up: Desenvolvimento 8.1 Invoking ‘guix shell’ ========================= The purpose of ‘guix shell’ is to make it easy to create one-off software environments, without changing one’s profile. It is typically used to create development environments; it is also a convenient way to run applications without “polluting” your profile. Nota: The ‘guix shell’ command was recently introduced to supersede ‘guix environment’ (*note Invocando guix environment::). If you are familiar with ‘guix environment’, you will notice that it is similar but also—we hope!—more convenient. The general syntax is: guix shell [OPTIONS] [PACKAGE...] The following example creates an environment containing Python and NumPy, building or downloading any missing package, and runs the ‘python3’ command in that environment: guix shell python python-numpy -- python3 Development environments can be created as in the example below, which spawns an interactive shell containing all the dependencies and environment variables needed to work on Inkscape: guix shell --development inkscape Exiting the shell places the user back in the original environment before ‘guix shell’ was invoked. The next garbage collection (*note Invocando guix gc::) may clean up packages that were installed in the environment and that are no longer used outside of it. As an added convenience, ‘guix shell’ will try to do what you mean when it is invoked interactively without any other arguments as in: guix shell If it finds a ‘manifest.scm’ in the current working directory or any of its parents, it uses this manifest as though it was given via ‘--manifest’. Likewise, if it finds a ‘guix.scm’ in the same directories, it uses it to build a development profile as though both ‘--development’ and ‘--file’ were present. In either case, the file will only be loaded if the directory it resides in is listed in ‘~/.config/guix/shell-authorized-directories’. This provides an easy way to define, share, and enter development environments. By default, the shell session or command runs in an _augmented_ environment, where the new packages are added to search path environment variables such as ‘PATH’. You can, instead, choose to create an _isolated_ environment containing nothing but the packages you asked for. Passing the ‘--pure’ option clears environment variable definitions found in the parent environment(1); passing ‘--container’ goes one step further by spawning a “container” isolated from the rest of the system: guix shell --container emacs gcc-toolchain The command above spawns an interactive shell in a container where nothing but ‘emacs’, ‘gcc-toolchain’, and their dependencies is available. The container lacks network access and shares no files other than the current working directory with the surrounding environment. This is useful to prevent access to system-wide resources such as ‘/usr/bin’ on foreign distros. This ‘--container’ option can also prove useful if you wish to run a security-sensitive application, such as a web browser, in an isolated environment. For example, the command below launches Ungoogled-Chromium in an isolated environment, this time sharing network access with the host and preserving its ‘DISPLAY’ environment variable, but without even sharing the current directory: guix shell --container --network --no-cwd ungoogled-chromium \ --preserve='^DISPLAY$' -- chromium ‘guix shell’ defines the ‘GUIX_ENVIRONMENT’ variable in the shell it spawns; its value is the file name of the profile of this environment. This allows users to, say, define a specific prompt for development environments in their ‘.bashrc’ (*note (bash)Bash Startup Files::): if [ -n "$GUIX_ENVIRONMENT" ] then export PS1="\u@\h \w [dev]\$ " fi ... or to browse the profile: $ ls "$GUIX_ENVIRONMENT/bin" The available options are summarized below. ‘--check’ Set up the environment and check whether the shell would clobber environment variables. It’s a good idea to use this option the first time you run ‘guix shell’ for an interactive session to make sure your setup is correct. For example, if the shell modifies the ‘PATH’ environment variable, report it since you would get a different environment than what you asked for. Such problems usually indicate that the shell startup files are unexpectedly modifying those environment variables. For example, if you are using Bash, make sure that environment variables are set or modified in ‘~/.bash_profile’ and _not_ in ‘~/.bashrc’—the former is sourced only by log-in shells. *Note (bash)Bash Startup Files::, for details on Bash start-up files. ‘--development’ ‘-D’ Cause ‘guix shell’ to include in the environment the dependencies of the following package rather than the package itself. This can be combined with other packages. For instance, the command below starts an interactive shell containing the build-time dependencies of GNU Guile, plus Autoconf, Automake, and Libtool: guix shell -D guile autoconf automake libtool ‘--expression=EXPR’ ‘-e EXPR’ Create an environment for the package or list of packages that EXPR evaluates to. For example, running: guix shell -D -e '(@ (gnu packages maths) petsc-openmpi)' starts a shell with the environment for this specific variant of the PETSc package. Running: guix shell -e '(@ (gnu) %base-packages)' starts a shell with all the base system packages available. The above commands only use the default output of the given packages. To select other outputs, two element tuples can be specified: guix shell -e '(list (@ (gnu packages bash) bash) "include")' *Note ‘package->development-manifest’: package-development-manifest, for information on how to write a manifest for the development environment of a package. ‘--file=FILE’ ‘-f ARQUIVO’ Create an environment containing the package or list of packages that the code within FILE evaluates to. As an example, FILE might contain a definition like this (*note Definindo pacotes::): (use-modules (guix) (gnu packages gdb) (gnu packages autotools) (gnu packages texinfo)) ;; Augment the package definition of GDB with the build tools ;; needed when developing GDB (and which are not needed when ;; simply installing it.) (package (inherit gdb) (native-inputs (modify-inputs (package-native-inputs gdb) (prepend autoconf-2.64 automake texinfo)))) With the file above, you can enter a development environment for GDB by running: guix shell -D -f gdb-devel.scm ‘--manifest=ARQUIVO’ ‘-m ARQUIVO’ Create an environment for the packages contained in the manifest object returned by the Scheme code in FILE. This option can be repeated several times, in which case the manifests are concatenated. This is similar to the same-named option in ‘guix package’ (*note ‘--manifest’: profile-manifest.) and uses the same manifest files. *Note Writing Manifests::, for information on how to write a manifest. See ‘--export-manifest’ below on how to obtain a first manifest. ‘--export-manifest’ Write to standard output a manifest suitable for ‘--manifest’ corresponding to given command-line options. This is a way to “convert” command-line arguments into a manifest. For example, imagine you are tired of typing long lines and would like to get a manifest equivalent to this command line: guix shell -D guile git emacs emacs-geiser emacs-geiser-guile Just add ‘--export-manifest’ to the command line above: guix shell --export-manifest \ -D guile git emacs emacs-geiser emacs-geiser-guile ... and you get a manifest along these lines: (concatenate-manifests (list (specifications->manifest (list "git" "emacs" "emacs-geiser" "emacs-geiser-guile")) (package->development-manifest (specification->package "guile")))) You can store it into a file, say ‘manifest.scm’, and from there pass it to ‘guix shell’ or indeed pretty much any ‘guix’ command: guix shell -m manifest.scm Voilà, you’ve converted a long command line into a manifest! That conversion process honors package transformation options (*note Opções de transformação de pacote::) so it should be lossless. ‘--profile=PERFIL’ ‘-p PERFIL’ Create an environment containing the packages installed in PROFILE. Use ‘guix package’ (*note Invocando guix package::) to create and manage profiles. ‘--pure’ Unset existing environment variables when building the new environment, except those specified with ‘--preserve’ (see below). This has the effect of creating an environment in which search paths only contain package inputs. ‘--preserve=REGEXP’ ‘-E REGEXP’ When used alongside ‘--pure’, preserve the environment variables matching REGEXP—in other words, put them on a “white list” of environment variables that must be preserved. This option can be repeated several times. guix shell --pure --preserve=^SLURM openmpi ... \ -- mpirun ... This example runs ‘mpirun’ in a context where the only environment variables defined are ‘PATH’, environment variables whose name starts with ‘SLURM’, as well as the usual “precious” variables (‘HOME’, ‘USER’, etc.). ‘--search-paths’ Display the environment variable definitions that make up the environment. ‘--system=SYSTEM’ ‘-s SISTEMA’ Attempt to build for SYSTEM—e.g., ‘i686-linux’. ‘--container’ ‘-C’ Run COMMAND within an isolated container. The current working directory outside the container is mapped inside the container. Additionally, unless overridden with ‘--user’, a dummy home directory is created that matches the current user’s home directory, and ‘/etc/passwd’ is configured accordingly. The spawned process runs as the current user outside the container. Inside the container, it has the same UID and GID as the current user, unless ‘--user’ is passed (see below). ‘--network’ ‘-N’ For containers, share the network namespace with the host system. Containers created without this flag only have access to the loopback device. ‘--link-profile’ ‘-P’ For containers, link the environment profile to ‘~/.guix-profile’ within the container and set ‘GUIX_ENVIRONMENT’ to that. This is equivalent to making ‘~/.guix-profile’ a symlink to the actual profile within the container. Linking will fail and abort the environment if the directory already exists, which will certainly be the case if ‘guix shell’ was invoked in the user’s home directory. Certain packages are configured to look in ‘~/.guix-profile’ for configuration files and data;(2) ‘--link-profile’ allows these programs to behave as expected within the environment. ‘--user=USER’ ‘-u USUÁRIO’ For containers, use the username USER in place of the current user. The generated ‘/etc/passwd’ entry within the container will contain the name USER, the home directory will be ‘/home/USER’, and no user GECOS data will be copied. Furthermore, the UID and GID inside the container are 1000. USER need not exist on the system. Additionally, any shared or exposed path (see ‘--share’ and ‘--expose’ respectively) whose target is within the current user’s home directory will be remapped relative to ‘/home/USER’; this includes the automatic mapping of the current working directory. # will expose paths as /home/foo/wd, /home/foo/test, and /home/foo/target cd $HOME/wd guix shell --container --user=foo \ --expose=$HOME/test \ --expose=/tmp/target=$HOME/target While this will limit the leaking of user identity through home paths and each of the user fields, this is only one useful component of a broader privacy/anonymity solution—not one in and of itself. ‘--no-cwd’ For containers, the default behavior is to share the current working directory with the isolated container and immediately change to that directory within the container. If this is undesirable, ‘--no-cwd’ will cause the current working directory to _not_ be automatically shared and will change to the user’s home directory within the container instead. See also ‘--user’. ‘--expose=FONTE[=ALVO]’ ‘--share=FONTE[=ALVO]’ For containers, ‘--expose’ (resp. ‘--share’) exposes the file system SOURCE from the host system as the read-only (resp. writable) file system TARGET within the container. If TARGET is not specified, SOURCE is used as the target mount point in the container. The example below spawns a Guile REPL in a container in which the user’s home directory is accessible read-only via the ‘/exchange’ directory: guix shell --container --expose=$HOME=/exchange guile -- guile ‘--symlink=SPEC’ ‘-S SPEC’ For containers, create the symbolic links specified by SPEC, as documented in *note pack-symlink-option::. ‘--emulate-fhs’ ‘-F’ When used with ‘--container’, emulate a Filesystem Hierarchy Standard (FHS) (https://refspecs.linuxfoundation.org/fhs.shtml) configuration within the container, providing ‘/bin’, ‘/lib’, and other directories and files specified by the FHS. As Guix deviates from the FHS specification, this option sets up the container to more closely mimic that of other GNU/Linux distributions. This is useful for reproducing other development environments, testing, and using programs which expect the FHS specification to be followed. With this option, the container will include a version of glibc that will read ‘/etc/ld.so.cache’ within the container for the shared library cache (contrary to glibc in regular Guix usage) and set up the expected FHS directories: ‘/bin’, ‘/etc’, ‘/lib’, and ‘/usr’ from the container’s profile. ‘--rebuild-cache’ In most cases, ‘guix shell’ caches the environment so that subsequent uses are instantaneous. Least-recently used cache entries are periodically removed. The cache is also invalidated, when using ‘--file’ or ‘--manifest’, anytime the corresponding file is modified. The ‘--rebuild-cache’ forces the cached environment to be refreshed. This is useful when using ‘--file’ or ‘--manifest’ and the ‘guix.scm’ or ‘manifest.scm’ file has external dependencies, or if its behavior depends, say, on environment variables. ‘--root=ARQUIVO’ ‘-r ARQUIVO’ Make FILE a symlink to the profile for this environment, and register it as a garbage collector root. This is useful if you want to protect your environment from garbage collection, to make it “persistent”. When this option is omitted, ‘guix shell’ caches profiles so that subsequent uses of the same environment are instantaneous—this is comparable to using ‘--root’ except that ‘guix shell’ takes care of periodically removing the least-recently used garbage collector roots. In some cases, ‘guix shell’ does not cache profiles—e.g., if transformation options such as ‘--with-latest’ are used. In those cases, the environment is protected from garbage collection only for the duration of the ‘guix shell’ session. This means that next time you recreate the same environment, you could have to rebuild or re-download packages. *Note Invocando guix gc::, for more on GC roots. ‘guix shell’ also supports all of the common build options that ‘guix build’ supports (*note Opções de compilação comum::) as well as package transformation options (*note Opções de transformação de pacote::). ---------- Footnotes ---------- (1) Be sure to use the ‘--check’ option the first time you use ‘guix shell’ interactively to make sure the shell does not undo the effect of ‘--pure’. (2) For example, the ‘fontconfig’ package inspects ‘~/.guix-profile/share/fonts’ for additional fonts.  File: guix.pt_BR.info, Node: Invocando guix environment, Next: Invocando guix pack, Prev: Invoking guix shell, Up: Desenvolvimento 8.2 Invocando ‘guix environment’ ================================ The purpose of ‘guix environment’ is to assist in creating development environments. Deprecation warning: The ‘guix environment’ command is deprecated in favor of ‘guix shell’, which performs similar functions but is more convenient to use. *Note Invoking guix shell::. Being deprecated, ‘guix environment’ is slated for eventual removal, but the Guix project is committed to keeping it until May 1st, 2023. Please get in touch with us at if you would like to discuss it. The general syntax is: guix environment OPTIONS PACKAGE... The following example spawns a new shell set up for the development of GNU Guile: guix environment guile If the needed dependencies are not built yet, ‘guix environment’ automatically builds them. The environment of the new shell is an augmented version of the environment that ‘guix environment’ was run in. It contains the necessary search paths for building the given package added to the existing environment variables. To create a “pure” environment, in which the original environment variables have been unset, use the ‘--pure’ option(1). Exiting from a Guix environment is the same as exiting from the shell, and will place the user back in the old environment before ‘guix environment’ was invoked. The next garbage collection (*note Invocando guix gc::) will clean up packages that were installed from within the environment and are no longer used outside of it. ‘guix environment’ defines the ‘GUIX_ENVIRONMENT’ variable in the shell it spawns; its value is the file name of the profile of this environment. This allows users to, say, define a specific prompt for development environments in their ‘.bashrc’ (*note (bash)Bash Startup Files::): if [ -n "$GUIX_ENVIRONMENT" ] then export PS1="\u@\h \w [dev]\$ " fi ... or to browse the profile: $ ls "$GUIX_ENVIRONMENT/bin" Additionally, more than one package may be specified, in which case the union of the inputs for the given packages are used. For example, the command below spawns a shell where all of the dependencies of both Guile and Emacs are available: guix environment guile emacs Sometimes an interactive shell session is not desired. An arbitrary command may be invoked by placing the ‘--’ token to separate the command from the rest of the arguments: guix environment guile -- make -j4 In other situations, it is more convenient to specify the list of packages needed in the environment. For example, the following command runs ‘python’ from an environment containing Python 3 and NumPy: guix environment --ad-hoc python-numpy python -- python3 Furthermore, one might want the dependencies of a package and also some additional packages that are not build-time or runtime dependencies, but are useful when developing nonetheless. Because of this, the ‘--ad-hoc’ flag is positional. Packages appearing before ‘--ad-hoc’ are interpreted as packages whose dependencies will be added to the environment. Packages appearing after are interpreted as packages that will be added to the environment directly. For example, the following command creates a Guix development environment that additionally includes Git and strace: guix environment --pure guix --ad-hoc git strace Sometimes it is desirable to isolate the environment as much as possible, for maximal purity and reproducibility. In particular, when using Guix on a host distro that is not Guix System, it is desirable to prevent access to ‘/usr/bin’ and other system-wide resources from the development environment. For example, the following command spawns a Guile REPL in a “container” where only the store and the current working directory are mounted: guix environment --ad-hoc --container guile -- guile Nota: The ‘--container’ option requires Linux-libre 3.19 or newer. Another typical use case for containers is to run security-sensitive applications such as a web browser. To run Eolie, we must expose and share some files and directories; we include ‘nss-certs’ and expose ‘/etc/ssl/certs/’ for HTTPS authentication; finally we preserve the ‘DISPLAY’ environment variable since containerized graphical applications won’t display without it. guix environment --preserve='^DISPLAY$' --container --network \ --expose=/etc/machine-id \ --expose=/etc/ssl/certs/ \ --share=$HOME/.local/share/eolie/=$HOME/.local/share/eolie/ \ --ad-hoc eolie nss-certs dbus -- eolie The available options are summarized below. ‘--check’ Set up the environment and check whether the shell would clobber environment variables. *Note ‘--check’: Invoking guix shell, for more info. ‘--root=ARQUIVO’ ‘-r ARQUIVO’ Make FILE a symlink to the profile for this environment, and register it as a garbage collector root. This is useful if you want to protect your environment from garbage collection, to make it “persistent”. When this option is omitted, the environment is protected from garbage collection only for the duration of the ‘guix environment’ session. This means that next time you recreate the same environment, you could have to rebuild or re-download packages. *Note Invocando guix gc::, for more on GC roots. ‘--expression=EXPR’ ‘-e EXPR’ Create an environment for the package or list of packages that EXPR evaluates to. For example, running: guix environment -e '(@ (gnu packages maths) petsc-openmpi)' starts a shell with the environment for this specific variant of the PETSc package. Running: guix environment --ad-hoc -e '(@ (gnu) %base-packages)' starts a shell with all the base system packages available. The above commands only use the default output of the given packages. To select other outputs, two element tuples can be specified: guix environment --ad-hoc -e '(list (@ (gnu packages bash) bash) "include")' ‘--load=ARQUIVO’ ‘-l ARQUIVO’ Create an environment for the package or list of packages that the code within FILE evaluates to. As an example, FILE might contain a definition like this (*note Definindo pacotes::): (use-modules (guix) (gnu packages gdb) (gnu packages autotools) (gnu packages texinfo)) ;; Augment the package definition of GDB with the build tools ;; needed when developing GDB (and which are not needed when ;; simply installing it.) (package (inherit gdb) (native-inputs (modify-inputs (package-native-inputs gdb) (prepend autoconf-2.64 automake texinfo)))) ‘--manifest=ARQUIVO’ ‘-m ARQUIVO’ Create an environment for the packages contained in the manifest object returned by the Scheme code in FILE. This option can be repeated several times, in which case the manifests are concatenated. This is similar to the same-named option in ‘guix package’ (*note ‘--manifest’: profile-manifest.) and uses the same manifest files. *Note ‘guix shell --export-manifest’: shell-export-manifest, for information on how to “convert” command-line options into a manifest. ‘--ad-hoc’ Include all specified packages in the resulting environment, as if an ad hoc package were defined with them as inputs. This option is useful for quickly creating an environment without having to write a package expression to contain the desired inputs. For instance, the command: guix environment --ad-hoc guile guile-sdl -- guile runs ‘guile’ in an environment where Guile and Guile-SDL are available. Note that this example implicitly asks for the default output of ‘guile’ and ‘guile-sdl’, but it is possible to ask for a specific output—e.g., ‘glib:bin’ asks for the ‘bin’ output of ‘glib’ (*note Pacotes com múltiplas saídas::). This option may be composed with the default behavior of ‘guix environment’. Packages appearing before ‘--ad-hoc’ are interpreted as packages whose dependencies will be added to the environment, the default behavior. Packages appearing after are interpreted as packages that will be added to the environment directly. ‘--profile=PERFIL’ ‘-p PERFIL’ Create an environment containing the packages installed in PROFILE. Use ‘guix package’ (*note Invocando guix package::) to create and manage profiles. ‘--pure’ Unset existing environment variables when building the new environment, except those specified with ‘--preserve’ (see below). This has the effect of creating an environment in which search paths only contain package inputs. ‘--preserve=REGEXP’ ‘-E REGEXP’ When used alongside ‘--pure’, preserve the environment variables matching REGEXP—in other words, put them on a “white list” of environment variables that must be preserved. This option can be repeated several times. guix environment --pure --preserve=^SLURM --ad-hoc openmpi ... \ -- mpirun ... This example runs ‘mpirun’ in a context where the only environment variables defined are ‘PATH’, environment variables whose name starts with ‘SLURM’, as well as the usual “precious” variables (‘HOME’, ‘USER’, etc.). ‘--search-paths’ Display the environment variable definitions that make up the environment. ‘--system=SYSTEM’ ‘-s SISTEMA’ Attempt to build for SYSTEM—e.g., ‘i686-linux’. ‘--container’ ‘-C’ Run COMMAND within an isolated container. The current working directory outside the container is mapped inside the container. Additionally, unless overridden with ‘--user’, a dummy home directory is created that matches the current user’s home directory, and ‘/etc/passwd’ is configured accordingly. The spawned process runs as the current user outside the container. Inside the container, it has the same UID and GID as the current user, unless ‘--user’ is passed (see below). ‘--network’ ‘-N’ For containers, share the network namespace with the host system. Containers created without this flag only have access to the loopback device. ‘--link-profile’ ‘-P’ For containers, link the environment profile to ‘~/.guix-profile’ within the container and set ‘GUIX_ENVIRONMENT’ to that. This is equivalent to making ‘~/.guix-profile’ a symlink to the actual profile within the container. Linking will fail and abort the environment if the directory already exists, which will certainly be the case if ‘guix environment’ was invoked in the user’s home directory. Certain packages are configured to look in ‘~/.guix-profile’ for configuration files and data;(2) ‘--link-profile’ allows these programs to behave as expected within the environment. ‘--user=USER’ ‘-u USUÁRIO’ For containers, use the username USER in place of the current user. The generated ‘/etc/passwd’ entry within the container will contain the name USER, the home directory will be ‘/home/USER’, and no user GECOS data will be copied. Furthermore, the UID and GID inside the container are 1000. USER need not exist on the system. Additionally, any shared or exposed path (see ‘--share’ and ‘--expose’ respectively) whose target is within the current user’s home directory will be remapped relative to ‘/home/USER’; this includes the automatic mapping of the current working directory. # will expose paths as /home/foo/wd, /home/foo/test, and /home/foo/target cd $HOME/wd guix environment --container --user=foo \ --expose=$HOME/test \ --expose=/tmp/target=$HOME/target While this will limit the leaking of user identity through home paths and each of the user fields, this is only one useful component of a broader privacy/anonymity solution—not one in and of itself. ‘--no-cwd’ For containers, the default behavior is to share the current working directory with the isolated container and immediately change to that directory within the container. If this is undesirable, ‘--no-cwd’ will cause the current working directory to _not_ be automatically shared and will change to the user’s home directory within the container instead. See also ‘--user’. ‘--expose=FONTE[=ALVO]’ ‘--share=FONTE[=ALVO]’ For containers, ‘--expose’ (resp. ‘--share’) exposes the file system SOURCE from the host system as the read-only (resp. writable) file system TARGET within the container. If TARGET is not specified, SOURCE is used as the target mount point in the container. The example below spawns a Guile REPL in a container in which the user’s home directory is accessible read-only via the ‘/exchange’ directory: guix environment --container --expose=$HOME=/exchange --ad-hoc guile -- guile ‘--emulate-fhs’ ‘-F’ For containers, emulate a Filesystem Hierarchy Standard (FHS) configuration within the container, see the official specification (https://refspecs.linuxfoundation.org/fhs.shtml). As Guix deviates from the FHS specification, this option sets up the container to more closely mimic that of other GNU/Linux distributions. This is useful for reproducing other development environments, testing, and using programs which expect the FHS specification to be followed. With this option, the container will include a version of ‘glibc’ which will read ‘/etc/ld.so.cache’ within the container for the shared library cache (contrary to ‘glibc’ in regular Guix usage) and set up the expected FHS directories: ‘/bin’, ‘/etc’, ‘/lib’, and ‘/usr’ from the container’s profile. ‘guix environment’ also supports all of the common build options that ‘guix build’ supports (*note Opções de compilação comum::) as well as package transformation options (*note Opções de transformação de pacote::). ---------- Footnotes ---------- (1) Users sometimes wrongfully augment environment variables such as ‘PATH’ in their ‘~/.bashrc’ file. As a consequence, when ‘guix environment’ launches it, Bash may read ‘~/.bashrc’, thereby introducing “impurities” in these environment variables. It is an error to define such environment variables in ‘.bashrc’; instead, they should be defined in ‘.bash_profile’, which is sourced only by log-in shells. *Note (bash)Bash Startup Files::, for details on Bash start-up files. (2) For example, the ‘fontconfig’ package inspects ‘~/.guix-profile/share/fonts’ for additional fonts.  File: guix.pt_BR.info, Node: Invocando guix pack, Next: The GCC toolchain, Prev: Invocando guix environment, Up: Desenvolvimento 8.3 Invocando ‘guix pack’ ========================= Occasionally you want to pass software to people who are not (yet!) lucky enough to be using Guix. You’d tell them to run ‘guix package -i SOMETHING’, but that’s not possible in this case. This is where ‘guix pack’ comes in. Nota: If you are looking for ways to exchange binaries among machines that already run Guix, *note Invocando guix copy::, *note Invocando guix publish::, and *note Invocando guix archive::. The ‘guix pack’ command creates a shrink-wrapped “pack” or “software bundle”: it creates a tarball or some other archive containing the binaries of the software you’re interested in, and all its dependencies. The resulting archive can be used on any machine that does not have Guix, and people can run the exact same binaries as those you have with Guix. The pack itself is created in a bit-reproducible fashion, so anyone can verify that it really contains the build results that you pretend to be shipping. For example, to create a bundle containing Guile, Emacs, Geiser, and all their dependencies, you can run: $ guix pack guile emacs emacs-geiser ... /gnu/store/...-pack.tar.gz The result here is a tarball containing a ‘/gnu/store’ directory with all the relevant packages. The resulting tarball contains a “profile” with the three packages of interest; the profile is the same as would be created by ‘guix package -i’. It is this mechanism that is used to create Guix’s own standalone binary tarball (*note Instalação de binários::). Users of this pack would have to run ‘/gnu/store/...-profile/bin/guile’ to run Guile, which you may find inconvenient. To work around it, you can create, say, a ‘/opt/gnu/bin’ symlink to the profile: guix pack -S /opt/gnu/bin=bin guile emacs emacs-geiser That way, users can happily type ‘/opt/gnu/bin/guile’ and enjoy. What if the recipient of your pack does not have root privileges on their machine, and thus cannot unpack it in the root file system? In that case, you will want to use the ‘--relocatable’ option (see below). This option produces “relocatable binaries”, meaning they they can be placed anywhere in the file system hierarchy: in the example above, users can unpack your tarball in their home directory and directly run ‘./opt/gnu/bin/guile’. Alternatively, you can produce a pack in the Docker image format using the following command: guix pack -f docker -S /bin=bin guile guile-readline The result is a tarball that can be passed to the ‘docker load’ command, followed by ‘docker run’: docker load < FILE docker run -ti guile-guile-readline /bin/guile where FILE is the image returned by GUIX PACK, and ‘guile-guile-readline’ is its “image tag”. See the Docker documentation (https://docs.docker.com/engine/reference/commandline/load/) for more information. Yet another option is to produce a SquashFS image with the following command: guix pack -f squashfs bash guile emacs emacs-geiser The result is a SquashFS file system image that can either be mounted or directly be used as a file system container image with the Singularity container execution environment (https://www.sylabs.io/docs/), using commands like ‘singularity shell’ or ‘singularity exec’. Several command-line options allow you to customize your pack: ‘--format=FORMAT’ ‘-f FORMAT’ Produce a pack in the given FORMAT. The available formats are: ‘tarball’ This is the default format. It produces a tarball containing all the specified binaries and symlinks. ‘docker’ This produces a tarball that follows the Docker Image Specification (https://github.com/docker/docker/blob/master/image/spec/v1.2.md). The “repository name” as it appears in the output of the ‘docker images’ command is computed from package names passed on the command line or in the manifest file. ‘squashfs’ This produces a SquashFS image containing all the specified binaries and symlinks, as well as empty mount points for virtual file systems like procfs. Nota: Singularity _requires_ you to provide ‘/bin/sh’ in the image. For that reason, ‘guix pack -f squashfs’ always implies ‘-S /bin=bin’. Thus, your ‘guix pack’ invocation must always start with something like: guix pack -f squashfs bash ... If you forget the ‘bash’ (or similar) package, ‘singularity run’ and ‘singularity exec’ will fail with an unhelpful “no such file or directory” message. ‘deb’ This produces a Debian archive (a package with the ‘.deb’ file extension) containing all the specified binaries and symbolic links, that can be installed on top of any dpkg-based GNU(/Linux) distribution. Advanced options can be revealed via the ‘--help-deb-format’ option. They allow embedding control files for more fine-grained control, such as activating specific triggers or providing a maintainer configure script to run arbitrary setup code upon installation. guix pack -f deb -C xz -S /usr/bin/hello=bin/hello hello Nota: Because archives produced with ‘guix pack’ contain a collection of store items and because each ‘dpkg’ package must not have conflicting files, in practice that means you likely won’t be able to install more than one such archive on a given system. Warning: ‘dpkg’ will assume ownership of any files contained in the pack that it does _not_ know about. It is unwise to install Guix-produced ‘.deb’ files on a system where ‘/gnu/store’ is shared by other software, such as a Guix installation or other, non-deb packs. ‘--relocatable’ ‘-R’ Produce “relocatable binaries”—i.e., binaries that can be placed anywhere in the file system hierarchy and run from there. When this option is passed once, the resulting binaries require support for “user namespaces” in the kernel Linux; when passed _twice_(1), relocatable binaries fall to back to other techniques if user namespaces are unavailable, and essentially work anywhere—see below for the implications. For example, if you create a pack containing Bash with: guix pack -RR -S /mybin=bin bash ... you can copy that pack to a machine that lacks Guix, and from your home directory as a normal user, run: tar xf pack.tar.gz ./mybin/sh In that shell, if you type ‘ls /gnu/store’, you’ll notice that ‘/gnu/store’ shows up and contains all the dependencies of ‘bash’, even though the machine actually lacks ‘/gnu/store’ altogether! That is probably the simplest way to deploy Guix-built software on a non-Guix machine. Nota: By default, relocatable binaries rely on the “user namespace” feature of the kernel Linux, which allows unprivileged users to mount or change root. Old versions of Linux did not support it, and some GNU/Linux distributions turn it off. To produce relocatable binaries that work even in the absence of user namespaces, pass ‘--relocatable’ or ‘-R’ _twice_. In that case, binaries will try user namespace support and fall back to another “execution engine” if user namespaces are not supported. The following execution engines are supported: ‘default’ Try user namespaces and fall back to PRoot if user namespaces are not supported (see below). ‘performance’ Try user namespaces and fall back to Fakechroot if user namespaces are not supported (see below). ‘userns’ Run the program through user namespaces and abort if they are not supported. ‘proot’ Run through PRoot. The PRoot (https://proot-me.github.io/) program provides the necessary support for file system virtualization. It achieves that by using the ‘ptrace’ system call on the running program. This approach has the advantage to work without requiring special kernel support, but it incurs run-time overhead every time a system call is made. ‘fakechroot’ Run through Fakechroot. Fakechroot (https://github.com/dex4er/fakechroot/) virtualizes file system accesses by intercepting calls to C library functions such as ‘open’, ‘stat’, ‘exec’, and so on. Unlike PRoot, it incurs very little overhead. However, it does not always work: for example, some file system accesses made from within the C library are not intercepted, and file system accesses made via direct syscalls are not intercepted either, leading to erratic behavior. When running a wrapped program, you can explicitly request one of the execution engines listed above by setting the ‘GUIX_EXECUTION_ENGINE’ environment variable accordingly. ‘--entry-point=COMMAND’ Use COMMAND as the “entry point” of the resulting pack, if the pack format supports it—currently ‘docker’ and ‘squashfs’ (Singularity) support it. COMMAND must be relative to the profile contained in the pack. The entry point specifies the command that tools like ‘docker run’ or ‘singularity run’ automatically start by default. For example, you can do: guix pack -f docker --entry-point=bin/guile guile The resulting pack can easily be loaded and ‘docker run’ with no extra arguments will spawn ‘bin/guile’: docker load -i pack.tar.gz docker run IMAGE-ID ‘--expression=EXPR’ ‘-e EXPR’ Consider the package EXPR evaluates to. This has the same purpose as the same-named option in ‘guix build’ (*note ‘--expression’ in ‘guix build’: Opções de compilação adicional.). ‘--manifest=ARQUIVO’ ‘-m ARQUIVO’ Use the packages contained in the manifest object returned by the Scheme code in FILE. This option can be repeated several times, in which case the manifests are concatenated. This has a similar purpose as the same-named option in ‘guix package’ (*note ‘--manifest’: profile-manifest.) and uses the same manifest files. It allows you to define a collection of packages once and use it both for creating profiles and for creating archives for use on machines that do not have Guix installed. Note that you can specify _either_ a manifest file _or_ a list of packages, but not both. *Note Writing Manifests::, for information on how to write a manifest. *Note ‘guix shell --export-manifest’: shell-export-manifest, for information on how to “convert” command-line options into a manifest. ‘--system=SYSTEM’ ‘-s SISTEMA’ Attempt to build for SYSTEM—e.g., ‘i686-linux’—instead of the system type of the build host. ‘--target=TRIPLET’ Cross-build for TRIPLET, which must be a valid GNU triplet, such as ‘"aarch64-linux-gnu"’ (*note GNU configuration triplets: (autoconf)Specifying target triplets.). ‘--compression=TOOL’ ‘-C TOOL’ Compress the resulting tarball using TOOL—one of ‘gzip’, ‘zstd’, ‘bzip2’, ‘xz’, ‘lzip’, or ‘none’ for no compression. ‘--symlink=SPEC’ ‘-S SPEC’ Add the symlinks specified by SPEC to the pack. This option can appear several times. SPEC has the form ‘SOURCE=TARGET’, where SOURCE is the symlink that will be created and TARGET is the symlink target. For instance, ‘-S /opt/gnu/bin=bin’ creates a ‘/opt/gnu/bin’ symlink pointing to the ‘bin’ sub-directory of the profile. ‘--save-provenance’ Save provenance information for the packages passed on the command line. Provenance information includes the URL and commit of the channels in use (*note Canais::). Provenance information is saved in the ‘/gnu/store/...-profile/manifest’ file in the pack, along with the usual package metadata—the name and version of each package, their propagated inputs, and so on. It is useful information to the recipient of the pack, who then knows how the pack was (supposedly) obtained. This option is not enabled by default because, like timestamps, provenance information contributes nothing to the build process. In other words, there is an infinity of channel URLs and commit IDs that can lead to the same pack. Recording such “silent” metadata in the output thus potentially breaks the source-to-binary bitwise reproducibility property. ‘--root=ARQUIVO’ ‘-r ARQUIVO’ Make FILE a symlink to the resulting pack, and register it as a garbage collector root. ‘--localstatedir’ ‘--profile-name=NAME’ Include the “local state directory”, ‘/var/guix’, in the resulting pack, and notably the ‘/var/guix/profiles/per-user/root/NAME’ profile—by default NAME is ‘guix-profile’, which corresponds to ‘~root/.guix-profile’. ‘/var/guix’ contains the store database (*note O armazém::) as well as garbage-collector roots (*note Invocando guix gc::). Providing it in the pack means that the store is “complete” and manageable by Guix; not providing it pack means that the store is “dead”: items cannot be added to it or removed from it after extraction of the pack. One use case for this is the Guix self-contained binary tarball (*note Instalação de binários::). ‘--derivation’ ‘-d’ Print the name of the derivation that builds the pack. ‘--bootstrap’ Use the bootstrap binaries to build the pack. This option is only useful to Guix developers. In addition, ‘guix pack’ supports all the common build options (*note Opções de compilação comum::) and all the package transformation options (*note Opções de transformação de pacote::). ---------- Footnotes ---------- (1) Here’s a trick to memorize it: ‘-RR’, which adds PRoot support, can be thought of as the abbreviation of “Really Relocatable”. Neat, isn’t it?  File: guix.pt_BR.info, Node: The GCC toolchain, Next: Invoking guix git authenticate, Prev: Invocando guix pack, Up: Desenvolvimento 8.4 The GCC toolchain ===================== If you need a complete toolchain for compiling and linking C or C++ source code, use the ‘gcc-toolchain’ package. This package provides a complete GCC toolchain for C/C++ development, including GCC itself, the GNU C Library (headers and binaries, plus debugging symbols in the ‘debug’ output), Binutils, and a linker wrapper. The wrapper’s purpose is to inspect the ‘-L’ and ‘-l’ switches passed to the linker, add corresponding ‘-rpath’ arguments, and invoke the actual linker with this new set of arguments. You can instruct the wrapper to refuse to link against libraries not in the store by setting the ‘GUIX_LD_WRAPPER_ALLOW_IMPURITIES’ environment variable to ‘no’. The package ‘gfortran-toolchain’ provides a complete GCC toolchain for Fortran development. For other languages, please use ‘guix search gcc toolchain’ (*note Invoking guix package: guix-search.).  File: guix.pt_BR.info, Node: Invoking guix git authenticate, Prev: The GCC toolchain, Up: Desenvolvimento 8.5 Invoking ‘guix git authenticate’ ==================================== The ‘guix git authenticate’ command authenticates a Git checkout following the same rule as for channels (*note channel authentication: channel-authentication.). That is, starting from a given commit, it ensures that all subsequent commits are signed by an OpenPGP key whose fingerprint appears in the ‘.guix-authorizations’ file of its parent commit(s). You will find this command useful if you maintain a channel. But in fact, this authentication mechanism is useful in a broader context, so you might want to use it for Git repositories that have nothing to do with Guix. The general syntax is: guix git authenticate COMMIT SIGNER [OPTIONS...] By default, this command authenticates the Git checkout in the current directory; it outputs nothing and exits with exit code zero on success and non-zero on failure. COMMIT above denotes the first commit where authentication takes place, and SIGNER is the OpenPGP fingerprint of public key used to sign COMMIT. Together, they form a “channel introduction” (*note channel introduction: channel-authentication.). The options below allow you to fine-tune the process. ‘--repository=DIRECTORY’ ‘-r DIRECTORY’ Open the Git repository in DIRECTORY instead of the current directory. ‘--keyring=REFERENCE’ ‘-k REFERENCE’ Load OpenPGP keyring from REFERENCE, the reference of a branch such as ‘origin/keyring’ or ‘my-keyring’. The branch must contain OpenPGP public keys in ‘.key’ files, either in binary form or “ASCII-armored”. By default the keyring is loaded from the branch named ‘keyring’. ‘--stats’ Display commit signing statistics upon completion. ‘--cache-key=KEY’ Previously-authenticated commits are cached in a file under ‘~/.cache/guix/authentication’. This option forces the cache to be stored in file KEY in that directory. ‘--historical-authorizations=FILE’ By default, any commit whose parent commit(s) lack the ‘.guix-authorizations’ file is considered inauthentic. In contrast, this option considers the authorizations in FILE for any commit that lacks ‘.guix-authorizations’. The format of FILE is the same as that of ‘.guix-authorizations’ (*note ‘.guix-authorizations’ format: channel-authorizations.).  File: guix.pt_BR.info, Node: Interface de programação, Next: Utilitários, Prev: Desenvolvimento, Up: Top 9 Interface de programação ************************** GNU Guix provides several Scheme programming interfaces (APIs) to define, build, and query packages. The first interface allows users to write high-level package definitions. These definitions refer to familiar packaging concepts, such as the name and version of a package, its build system, and its dependencies. These definitions can then be turned into concrete build actions. Build actions are performed by the Guix daemon, on behalf of users. In a standard setup, the daemon has write access to the store—the ‘/gnu/store’ directory—whereas users do not. The recommended setup also has the daemon perform builds in chroots, under specific build users, to minimize interference with the rest of the system. Lower-level APIs are available to interact with the daemon and the store. To instruct the daemon to perform a build action, users actually provide it with a “derivation”. A derivation is a low-level representation of the build actions to be taken, and the environment in which they should occur—derivations are to package definitions what assembly is to C programs. The term “derivation” comes from the fact that build results _derive_ from them. This chapter describes all these APIs in turn, starting from high-level package definitions. * Menu: * Módulos de pacote:: Pacotes do ponto de vista do programador. * Definindo pacotes:: Definindo novos pacotes. * Defining Package Variants:: Customizing packages. * Writing Manifests:: The bill of materials of your environment. * Sistemas de compilação:: Especificando como pacotes são compilados. * Build Phases:: Phases of the build process of a package. * Build Utilities:: Helpers for your package definitions and more. * Search Paths:: Declaring search path environment variables. * O armazém:: Manipulação do armazém de pacotes. * Derivações:: Interface de baixo nível para derivações de pacotes. * A mônada do armazém:: Interface puramente funcional para o armazém. * Expressões-G:: Manipulação de expressões de compilação. * Invocando guix repl:: Programming Guix in Guile * Using Guix Interactively:: Fine-grain interaction at the REPL.  File: guix.pt_BR.info, Node: Módulos de pacote, Next: Definindo pacotes, Up: Interface de programação 9.1 Módulos de pacote ===================== From a programming viewpoint, the package definitions of the GNU distribution are provided by Guile modules in the ‘(gnu packages ...)’ name space(1) (*note Guile modules: (guile)Módulos.). For instance, the ‘(gnu packages emacs)’ module exports a variable named ‘emacs’, which is bound to a ‘’ object (*note Definindo pacotes::). The ‘(gnu packages ...)’ module name space is automatically scanned for packages by the command-line tools. For instance, when running ‘guix install emacs’, all the ‘(gnu packages ...)’ modules are scanned until one that exports a package object whose name is ‘emacs’ is found. This package search facility is implemented in the ‘(gnu packages)’ module. Users can store package definitions in modules with different names—e.g., ‘(my-packages emacs)’(2). There are two ways to make these package definitions visible to the user interfaces: 1. By adding the directory containing your package modules to the search path with the ‘-L’ flag of ‘guix package’ and other commands (*note Opções de compilação comum::), or by setting the ‘GUIX_PACKAGE_PATH’ environment variable described below. 2. By defining a “channel” and configuring ‘guix pull’ so that it pulls from it. A channel is essentially a Git repository containing package modules. *Note Canais::, for more information on how to define and use channels. ‘GUIX_PACKAGE_PATH’ works similarly to other search path variables: -- Environment Variable: GUIX_PACKAGE_PATH This is a colon-separated list of directories to search for additional package modules. Directories listed in this variable take precedence over the own modules of the distribution. The distribution is fully “bootstrapped” and “self-contained”: each package is built based solely on other packages in the distribution. The root of this dependency graph is a small set of “bootstrap binaries”, provided by the ‘(gnu packages bootstrap)’ module. For more information on bootstrapping, *note Inicializando::. ---------- Footnotes ---------- (1) Note that packages under the ‘(gnu packages ...)’ module name space are not necessarily “GNU packages”. This module naming scheme follows the usual Guile module naming convention: ‘gnu’ means that these modules are distributed as part of the GNU system, and ‘packages’ identifies modules that define packages. (2) Note that the file name and module name must match. For instance, the ‘(my-packages emacs)’ module must be stored in a ‘my-packages/emacs.scm’ file relative to the load path specified with ‘--load-path’ or ‘GUIX_PACKAGE_PATH’. *Note (guile)Modules and the File System::, for details.  File: guix.pt_BR.info, Node: Definindo pacotes, Next: Defining Package Variants, Prev: Módulos de pacote, Up: Interface de programação 9.2 Definindo pacotes ===================== The high-level interface to package definitions is implemented in the ‘(guix packages)’ and ‘(guix build-system)’ modules. As an example, the package definition, or “recipe”, for the GNU Hello package looks like this: (define-module (gnu packages hello) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (guix licenses) #:use-module (gnu packages gawk)) (define-public hello (package (name "hello") (version "2.10") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/hello/hello-" version ".tar.gz")) (sha256 (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) (arguments '(#:configure-flags '("--enable-silent-rules"))) (inputs (list gawk)) (synopsis "Hello, GNU world: An example GNU package") (description "Guess what GNU Hello prints!") (home-page "https://www.gnu.org/software/hello/") (license gpl3+))) Without being a Scheme expert, the reader may have guessed the meaning of the various fields here. This expression binds the variable ‘hello’ to a ‘’ object, which is essentially a record (*note Scheme records: (guile)SRFI-9.). This package object can be inspected using procedures found in the ‘(guix packages)’ module; for instance, ‘(package-name hello)’ returns—surprise!—‘"hello"’. With luck, you may be able to import part or all of the definition of the package you are interested in from another repository, using the ‘guix import’ command (*note Invocando guix import::). In the example above, ‘hello’ is defined in a module of its own, ‘(gnu packages hello)’. Technically, this is not strictly necessary, but it is convenient to do so: all the packages defined in modules under ‘(gnu packages ...)’ are automatically known to the command-line tools (*note Módulos de pacote::). There are a few points worth noting in the above package definition: • The ‘source’ field of the package is an ‘’ object (*note Referência do origin::, for the complete reference). Here, the ‘url-fetch’ method from ‘(guix download)’ is used, meaning that the source is a file to be downloaded over FTP or HTTP. The ‘mirror://gnu’ prefix instructs ‘url-fetch’ to use one of the GNU mirrors defined in ‘(guix download)’. The ‘sha256’ field specifies the expected SHA256 hash of the file being downloaded. It is mandatory, and allows Guix to check the integrity of the file. The ‘(base32 ...)’ form introduces the base32 representation of the hash. You can obtain this information with ‘guix download’ (*note Invocando guix download::) and ‘guix hash’ (*note Invocando guix hash::). When needed, the ‘origin’ form can also have a ‘patches’ field listing patches to be applied, and a ‘snippet’ field giving a Scheme expression to modify the source code. • The ‘build-system’ field specifies the procedure to build the package (*note Sistemas de compilação::). Here, ‘gnu-build-system’ represents the familiar GNU Build System, where packages may be configured, built, and installed with the usual ‘./configure && make && make check && make install’ command sequence. When you start packaging non-trivial software, you may need tools to manipulate those build phases, manipulate files, and so on. *Note Build Utilities::, for more on this. • The ‘arguments’ field specifies options for the build system (*note Sistemas de compilação::). Here it is interpreted by ‘gnu-build-system’ as a request run ‘configure’ with the ‘--enable-silent-rules’ flag. What about these quote (‘'’) characters? They are Scheme syntax to introduce a literal list; ‘'’ is synonymous with ‘quote’. Sometimes you’ll also see ‘`’ (a backquote, synonymous with ‘quasiquote’) and ‘,’ (a comma, synonymous with ‘unquote’). *Note quoting: (guile)Expression Syntax, for details. Here the value of the ‘arguments’ field is a list of arguments passed to the build system down the road, as with ‘apply’ (*note ‘apply’: (guile)Fly Evaluation.). The hash-colon (‘#:’) sequence defines a Scheme “keyword” (*note (guile)Keywords::), and ‘#:configure-flags’ is a keyword used to pass a keyword argument to the build system (*note (guile)Coding With Keywords::). • The ‘inputs’ field specifies inputs to the build process—i.e., build-time or run-time dependencies of the package. Here, we add an input, a reference to the ‘gawk’ variable; ‘gawk’ is itself bound to a ‘’ object. Note that GCC, Coreutils, Bash, and other essential tools do not need to be specified as inputs here. Instead, ‘gnu-build-system’ takes care of ensuring that they are present (*note Sistemas de compilação::). However, any other dependencies need to be specified in the ‘inputs’ field. Any dependency not specified here will simply be unavailable to the build process, possibly leading to a build failure. *Note Referência do package::, for a full description of possible fields. Going further: Intimidated by the Scheme language or curious about it? The Cookbook has a short section to get started that recaps some of the things shown above and explains the fundamentals. *Note (guix-cookbook)A Scheme Crash Course::, for more information. Once a package definition is in place, the package may actually be built using the ‘guix build’ command-line tool (*note Invocando guix build::), troubleshooting any build failures you encounter (*note Depurando falhas de compilação::). You can easily jump back to the package definition using the ‘guix edit’ command (*note Invocando guix edit::). *Note Diretrizes de empacotamento::, for more information on how to test package definitions, and *note Invocando guix lint::, for information on how to check a definition for style conformance. Lastly, *note Canais::, for information on how to extend the distribution by adding your own package definitions in a “channel”. Finally, updating the package definition to a new upstream version can be partly automated by the ‘guix refresh’ command (*note Invocando guix refresh::). Behind the scenes, a derivation corresponding to the ‘’ object is first computed by the ‘package-derivation’ procedure. That derivation is stored in a ‘.drv’ file under ‘/gnu/store’. The build actions it prescribes may then be realized by using the ‘build-derivations’ procedure (*note O armazém::). -- Scheme Procedure: package-derivation STORE PACKAGE [SYSTEM] Return the ‘’ object of PACKAGE for SYSTEM (*note Derivações::). PACKAGE must be a valid ‘’ object, and SYSTEM must be a string denoting the target system type—e.g., ‘"x86_64-linux"’ for an x86_64 Linux-based GNU system. STORE must be a connection to the daemon, which operates on the store (*note O armazém::). Similarly, it is possible to compute a derivation that cross-builds a package for some other system: -- Scheme Procedure: package-cross-derivation STORE PACKAGE TARGET [SYSTEM] Return the ‘’ object of PACKAGE cross-built from SYSTEM to TARGET. TARGET must be a valid GNU triplet denoting the target hardware and operating system, such as ‘"aarch64-linux-gnu"’ (*note (autoconf)Specifying Target Triplets::). Once you have package definitions, you can easily define _variants_ of those packages. *Note Defining Package Variants::, for more on that. * Menu: * Referência do package:: O tipo de dados package. * Referência do origin:: O tipo de dados origin.