From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gDwEMM0BcWSIAAEASxT56A (envelope-from ) for ; Fri, 26 May 2023 21:00:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id WO4lL80BcWS/DQAAG6o9tA (envelope-from ) for ; Fri, 26 May 2023 21:00:29 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5174BE16D for ; Fri, 26 May 2023 21:00:29 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2cfY-0001S7-BT; Fri, 26 May 2023 15:00:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2cfV-0001MN-1f for help-guix@gnu.org; Fri, 26 May 2023 15:00:05 -0400 Received: from mail-vk1-xa31.google.com ([2607:f8b0:4864:20::a31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2cfO-0002LV-T1 for help-guix@gnu.org; Fri, 26 May 2023 15:00:00 -0400 Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-456d241fcdcso303656e0c.0 for ; Fri, 26 May 2023 11:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685127589; x=1687719589; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=lJzZkrLV0cFdSVMTit531s0FexYFquVCgaXNXsIrb5c=; b=gZT4sYhTnKLcz1EtCEkwerqUj3K8ZeqVbt00PBHVZqwWkG+OBBn8C2j+dEPsNT3jL6 qnpC+kbThwC5ZrYQk7nptqbdZ0w33eNYQqmlnaf/Y3lYg1GNxUUOhPQ9+4BrXXzOhRWT mcuX+YMFNhvu40D2O1yjhXvD6LwuJrlGzJsbQIedJ9tZnLQoK+o68blJQZpfVw93unn6 e94Fxjy5u0DSEMpjzfJDbOBx2XowVFrxFY4QpNhyimXAncGw7dPR9Z5LG6vxbrmfRkRM iDkmOl51iTtRjpM6DU3RxEq8O0Gc+KQeB8sYM339dLQM4nKdDlOMDjeC9HdF5E6afh2I HHyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685127589; x=1687719589; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lJzZkrLV0cFdSVMTit531s0FexYFquVCgaXNXsIrb5c=; b=eRUnJk4M7I6r9dIyzWil7VFvrl+YZFhj2PlYmeHW3wpmU0PEyXh5P1ruIJE4RpHdb+ D9OgMTNu1eR8LtKPhnU7JTirgW0iEpNDLttmgqfUWAQIUcsLBz7iTAiD9RS54URqFtdV R3ghapv+YqAo5gdkUGnHdDFHka9d0EAqEWxbskiecLWIQQMBUOGnur5l6UnbqZRSwOPk Drzi4HIavfUPt2dMNFrl7kYg90fIWQcFR5dzE0o43TylrkriM74fc/2lUVwP1A8cpqZr St9I13P2Yt1eXwyh5y+xxb668pXukAU7ThG2qmuoLSDQL+ux/v/9QF5FE8FwNy746QmU F1QA== X-Gm-Message-State: AC+VfDxO8FjWFLWEMaKxPDzkDJ/DQSQnrRY1i8Glhl9kIuCj5BFovMwx RI6VEpj1CLzCUb1AEQKF16p/X9ur45jwQAAJ+bs2tObrpuo= X-Google-Smtp-Source: ACHHUZ4EdrJUIfciqcuvNnbNn20gcoMeV26n6KP/BfzbVa1kmmAvTB5Ucka8z1z1lcDigPUhE9YXyl88L2xHPL0VDI4= X-Received: by 2002:a67:f58e:0:b0:43a:3295:dddf with SMTP id i14-20020a67f58e000000b0043a3295dddfmr695621vso.9.1685127589034; Fri, 26 May 2023 11:59:49 -0700 (PDT) MIME-Version: 1.0 From: Rodrigo Morales Date: Fri, 26 May 2023 18:59:33 +0000 Message-ID: Subject: Let's share examples of simplistic and useless package definitions To: help-guix@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::a31; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-vk1-xa31.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1685127629; a=rsa-sha256; cv=none; b=o5AWs5aSg041JQs/5lhOtkn/xAYdNadyY1WFw5BwfM4Ww7Q1afJAWNTECWUxAS94hrUeGr jlvmlPBzu4YVvKi6URdeai6i6RSCGlFoa8WQbld5aA84Ec3CPO9JkhEd6UJod9JJqwbUgp n3dPSSoD7AVua9dfirUB6fznlshSeUIZJq8+lYaKvdXujG323bQv0Nwp26OwdW5HVz3c/M d0oF788PwtmNuivFJb67Z1NpmjuxmjtjURpQc4dGu7wUR6vkJzCycVSXmUAEXwbXzjOlG/ y74B3WA5AoiKxKqI2PJsnzR/bwnOgx9cUBqmDu1sYU+o1Ht22LudyXGsa4/nDw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gZT4sYhT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685127629; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lJzZkrLV0cFdSVMTit531s0FexYFquVCgaXNXsIrb5c=; b=PNSJ57p9hrFgI/HYbIvLJAa+qFaqay+TjREtiptcH8Zj4Ck3Wpp1rUMAz9CMCNbf4FhUk1 +MCfQbfh0i2S5UbNOxCQWvY3oLSGz8XW889U2Ej+PrLgEP+XhsahWsSoo2yVIv1v10Nn3k PJJpuZhaEtS+Mkv5CDxpKiQbqieiLxFzmQ7FZ3lF9rIlLiYNdzl2RKtGK7abVW89xx4eKt gRIQaY1FoP+B3frudfR8GBpLOq1RlecNznMGSz/tJKjKl/+4Op6U8NvTm/0fsNHUCiLaEy yGiU/lzKxGktb1XNOlCyoamoj3XTS8oNdphx5IeMfIiCHwG+74EdcAcRidpkHQ== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=gZT4sYhT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.82 X-Spam-Score: -4.82 X-Migadu-Queue-Id: 5174BE16D X-TUID: kNN4/B3xVC2J Table of Contents _________________ 1. The context .. 1. Package no. 1: Create `%output' directory .. 2. Package no. 2: Copy a local file 2. The enquiries 1 The context ============= As part of my learning journey with Guix, I'm trying to write simplistic and useless package definitions in order to experiment with them and get more familiar with the internals with Guix. I've been able to come up with the following packages. 1.1 Package no. 1: Create `%output' directory ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following package creates the output directory and does nothing else. ,---- | (define-module (my test) | #:use-module (guix packages) | #:use-module (guix build-system trivial)) | | (define-public my-package-1 | (package | (name "my-package-1") | (version "50.0") | (home-page #f) | (synopsis #f) | (description #f) | (license #f) | (source #f) | (build-system trivial-build-system) | (arguments | `(#:modules ((guix build utils)) | #:builder | (begin | (use-modules (guix build utils)) | (format #t "~a~%" "foo 1") | (format #t "~a~%" %output) | (format #t "~a~%" "foo 2") | (mkdir %output)))))) `---- ,---- | guix package -v3 --no-substitutes -L ~/my/git-repos/guix-packages -i my-package-1 | echo Exit code: $? `---- ,---- | The following package will be installed: | my-package-1 50.0 | | The following derivations will be built: | /gnu/store/d5882590j5w74gwyzl784609wp08hjnl-profile.drv | /gnu/store/fh51w90hsp5pn67wz2k6a14y3ix96kdq-my-package-1-50.0.drv | The following profile hooks will be built: | /gnu/store/1mrv6rb283vhjd0kxvbzngy9bdh4nyr5-glib-schemas.drv | /gnu/store/gaz7c0ivgz4ygyg6m0805s4bhv4n09p9-gdk-pixbuf-loaders-cache-file.drv | /gnu/store/hhqw7ykgx3hk2r2p1b4mb5bwbi9syz5k-xdg-mime-database.drv | /gnu/store/hnslzij7j5772zdypb5rxcwzjlm2snj4-ca-certificate-bundle.drv | /gnu/store/j797wxpm81ajszfx08j7yq7643dmx3cv-gtk-im-modules.drv | /gnu/store/jk0qiy0bmy3jp99jhj6bvinly6an4rg4-gtk-icon-themes.drv | /gnu/store/phf48hr7xa7smgc7q4zcksc4nwxi622v-xdg-desktop-database.drv | /gnu/store/qissga15w17swkcdmjfhxnf086nl0gad-info-dir.drv | /gnu/store/x5zxihym559mqhmkbnz0jpxr9ywfyk84-fonts-dir.drv | /gnu/store/xc6nwqvn0ap15ajp5lw9k1k1kf2fc1va-emacs-subdirs.drv | building /gnu/store/fh51w90hsp5pn67wz2k6a14y3ix96kdq-my-package-1-50.0.drv... | foo 1 | /gnu/store/i48wxgjpvskkmvpkgscik3vbmsqn8z27-my-package-1-50.0 | foo 2 | successfully built /gnu/store/fh51w90hsp5pn67wz2k6a14y3ix96kdq-my-package-1-50.0.drv | building CA certificate bundle... | successfully built /gnu/store/hnslzij7j5772zdypb5rxcwzjlm2snj4-ca-certificate-bundle.drv | listing Emacs sub-directories... | successfully built /gnu/store/xc6nwqvn0ap15ajp5lw9k1k1kf2fc1va-emacs-subdirs.drv | building fonts directory... | successfully built /gnu/store/x5zxihym559mqhmkbnz0jpxr9ywfyk84-fonts-dir.drv | generating GdkPixbuf loaders cache... | successfully built /gnu/store/gaz7c0ivgz4ygyg6m0805s4bhv4n09p9-gdk-pixbuf-loaders-cache-file.drv | generating GLib schema cache... | successfully built /gnu/store/1mrv6rb283vhjd0kxvbzngy9bdh4nyr5-glib-schemas.drv | creating GTK+ icon theme cache... | successfully built /gnu/store/jk0qiy0bmy3jp99jhj6bvinly6an4rg4-gtk-icon-themes.drv | building cache files for GTK+ input methods... | successfully built /gnu/store/j797wxpm81ajszfx08j7yq7643dmx3cv-gtk-im-modules.drv | building directory of Info manuals... | successfully built /gnu/store/qissga15w17swkcdmjfhxnf086nl0gad-info-dir.drv | building XDG desktop file cache... | successfully built /gnu/store/phf48hr7xa7smgc7q4zcksc4nwxi622v-xdg-desktop-database.drv | building XDG MIME database... | successfully built /gnu/store/hhqw7ykgx3hk2r2p1b4mb5bwbi9syz5k-xdg-mime-database.drv | building profile with 19 packages... | successfully built /gnu/store/d5882590j5w74gwyzl784609wp08hjnl-profile.drv | hint: Consider setting the necessary environment variables by running: | | GUIX_PROFILE="/home/rdrg/.guix-profile" | . "$GUIX_PROFILE/etc/profile" | | Alternately, see `guix package --search-paths -p | "/home/rdrg/.guix-profile"'. | | Exit code: 0 `---- 1.2 Package no. 2: Copy a local file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following package copies a local file to `~/.guix-profile/share'. ,---- | echo a > ~/e/foo.txt `---- ,---- | (define-module (my test) | #:use-module (guix gexp) | #:use-module (guix packages) | #:use-module (guix build-system trivial)) | | (define-public my-package-1 | (package | (name "my-package-1") | (version "53.0") | (home-page #f) | (synopsis #f) | (description #f) | (license #f) | (source (local-file (string-append "/home/rdrg/e/foo.txt"))) | (build-system trivial-build-system) | (arguments | `(#:modules ((guix build utils)) | #:builder | (begin | (use-modules (guix build utils)) | (let* ((dir (string-append %output "/share")) | (file (string-append dir "/foo.txt"))) | (mkdir-p dir) | (copy-file (assoc-ref %build-inputs "source") file) | (format #t "~a~%" "foo 1") | (format #t "%build-inputs: ~a~%" %build-inputs) | (format #t "%output: ~a~%" %output) | (format #t "dir: ~a~%" dir) | (format #t "file: ~a~%" file) | (format #t "~a~%" "foo 2"))))))) `---- ,---- | guix package -v3 --no-substitutes -L ~/my/git-repos/guix-packages -i my-package-1 | echo Exit code: $? `---- ,---- | The following package will be installed: | my-package-1 53.0 | | The following derivations will be built: | /gnu/store/n528dak6y0f9r9zdbd86drysphgyl21h-profile.drv | /gnu/store/pck6w1v3shagpmhw9xzhgjrbz3s09saw-my-package-1-53.0.drv | The following profile hooks will be built: | /gnu/store/0w41r9qzf1y0yymx4ym7zmx3lv4r46ds-ca-certificate-bundle.drv | /gnu/store/2qd0kypbs5nb7ma4sdgd3iffj23qfhmb-glib-schemas.drv | /gnu/store/72wpyxjxzdiy5gjw9ji0bwlprcf76407-gtk-icon-themes.drv | /gnu/store/a18j6s911nn46a5d7r2902q32kbvf6wy-xdg-desktop-database.drv | /gnu/store/hl2zcs4d79d9xb2x2wwih27hhbwwmpqn-info-dir.drv | /gnu/store/pgqb8kb71jrplwa7dmaz0rrh6h1i20bl-xdg-mime-database.drv | /gnu/store/w3mcyvm92kn15mr7hcw1mgb2687jhpkv-fonts-dir.drv | /gnu/store/x3ams39s13ykak6ghg3knbyn4rnpw07b-gtk-im-modules.drv | /gnu/store/xmfnb64dxknbnq16rg8sf3wxmri99w9g-gdk-pixbuf-loaders-cache-file.drv | /gnu/store/yh5c44v3pdf1l1j6a9hjqa7l0wacighg-emacs-subdirs.drv | building /gnu/store/pck6w1v3shagpmhw9xzhgjrbz3s09saw-my-package-1-53.0.drv... | foo 1 | %build-inputs: ((source . /gnu/store/bzbxn3r9gq7rhqm565rw9fcy88b8gryy-foo.txt)) | %output: /gnu/store/hf37gi60wq46qlgzks9hfxln3hx77xms-my-package-1-53.0 | dir: /gnu/store/hf37gi60wq46qlgzks9hfxln3hx77xms-my-package-1-53.0/share | file: /gnu/store/hf37gi60wq46qlgzks9hfxln3hx77xms-my-package-1-53.0/share/foo.txt | foo 2 | successfully built /gnu/store/pck6w1v3shagpmhw9xzhgjrbz3s09saw-my-package-1-53.0.drv | building CA certificate bundle... | successfully built /gnu/store/0w41r9qzf1y0yymx4ym7zmx3lv4r46ds-ca-certificate-bundle.drv | listing Emacs sub-directories... | successfully built /gnu/store/yh5c44v3pdf1l1j6a9hjqa7l0wacighg-emacs-subdirs.drv | building fonts directory... | successfully built /gnu/store/w3mcyvm92kn15mr7hcw1mgb2687jhpkv-fonts-dir.drv | generating GdkPixbuf loaders cache... | successfully built /gnu/store/xmfnb64dxknbnq16rg8sf3wxmri99w9g-gdk-pixbuf-loaders-cache-file.drv | generating GLib schema cache... | successfully built /gnu/store/2qd0kypbs5nb7ma4sdgd3iffj23qfhmb-glib-schemas.drv | creating GTK+ icon theme cache... | successfully built /gnu/store/72wpyxjxzdiy5gjw9ji0bwlprcf76407-gtk-icon-themes.drv | building cache files for GTK+ input methods... | successfully built /gnu/store/x3ams39s13ykak6ghg3knbyn4rnpw07b-gtk-im-modules.drv | building directory of Info manuals... | successfully built /gnu/store/hl2zcs4d79d9xb2x2wwih27hhbwwmpqn-info-dir.drv | building XDG desktop file cache... | successfully built /gnu/store/a18j6s911nn46a5d7r2902q32kbvf6wy-xdg-desktop-database.drv | building XDG MIME database... | successfully built /gnu/store/pgqb8kb71jrplwa7dmaz0rrh6h1i20bl-xdg-mime-database.drv | building profile with 19 packages... | successfully built /gnu/store/n528dak6y0f9r9zdbd86drysphgyl21h-profile.drv | hint: Consider setting the necessary environment variables by running: | | GUIX_PROFILE="/home/rdrg/.guix-profile" | . "$GUIX_PROFILE/etc/profile" | | Alternately, see `guix package --search-paths -p | "/home/rdrg/.guix-profile"'. | | Exit code: 0 `---- 2 The enquiries =============== 1. I'm now trying to write a package that creates a temporary file containing the letter "a" with "echo > /a/temporary/location.txt" and makes it available at =~/.guix-profile/share=. What would this package look like? 2. Could you share other package definitions that have the same level of simplicity? I opened [a thread] on this topic 3 months ago and someone replied, but I didn't have the enough knowledge to understand his response. Today, the same question popped up in my mind and I finally understood it so I wrote the packages shown above. [a thread]