all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do I reference the src checkout in a package?
@ 2022-10-30  4:05 jgart
  2022-10-30  4:09 ` jgart
  0 siblings, 1 reply; 4+ messages in thread
From: jgart @ 2022-10-30  4:05 UTC (permalink / raw)
  To: Guix Devel

Hi,

I need to reference the carp checkout in an environment variable so that
carp can find the libs it needs:

/gnu/store/0xhn0vyjlcb2dv1h2333vhbj7j1vvrr6-carp-0.5.5-checkout

How can I do that?

* carp package definition

```
(define-public carp
  (package
    (name "carp")
    (version "0.5.5")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/carp-lang/Carp")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "14jdnv0ljqvpr9ych1plfw7hp5q57a8j1bv8h3v345x06z783d07"))))
    (build-system haskell-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
           (add-after 'install 'make-clang-available-at-runtime
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out"))
                     (clang (assoc-ref inputs "clang")))
                 (wrap-program (string-append out "/bin/carp")
                   `("CARP_DIR" = (,out))
                   `("PATH" = (,(string-append clang "/bin"))))
                 (wrap-program (string-append out "/bin/carp-header-parse")
                   `("CARP_DIR" = (,out))
                   `("PATH" = (,(string-append clang "/bin"))))))))))
    (native-inputs (list ghc-hunit))
    (inputs (list clang
                  ghc-blaze-markup
                  ghc-blaze-html
                  ghc-split
                  ghc-ansi-terminal
                  ghc-cmark
                  ghc-edit-distance
                  ghc-hashable
                  ghc-open-browser
                  ghc-optparse-applicative))
    (home-page "https://carp-lang.org/")
    (synopsis "Statically typed Lisp without a garbage collector")
    (description
"@code{carp} is a programming language designed to work well for
interactive and performance sensitive use cases like games, sound
synthesis and visualizations.")
    (license license:asl2.0)))
```


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I reference the src checkout in a package?
  2022-10-30  4:05 How do I reference the src checkout in a package? jgart
@ 2022-10-30  4:09 ` jgart
  2022-10-30  4:47   ` Zhu Zihao
  0 siblings, 1 reply; 4+ messages in thread
From: jgart @ 2022-10-30  4:09 UTC (permalink / raw)
  To: Guix Devel

On Sat, 29 Oct 2022 23:05:50 -0500 jgart <jgart@dismail.de> wrote:

For example, nix allows you to reference the source checkout with the $src variable:

https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/compilers/carp/default.nix#L38


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I reference the src checkout in a package?
  2022-10-30  4:09 ` jgart
@ 2022-10-30  4:47   ` Zhu Zihao
  2022-10-30 16:32     ` jgart
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Zihao @ 2022-10-30  4:47 UTC (permalink / raw)
  To: jgart; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]


Try `#$(package-source this-package)` in the builder gexp.

Or you can try `(assoc-ref inputs "source")`, but be careful, this is
undocumented behaviour and it may change without notice and break your
recipes.

OT: it's better to ask for help in help-guix@gnu.org :)

jgart <jgart@dismail.de> writes:

> On Sat, 29 Oct 2022 23:05:50 -0500 jgart <jgart@dismail.de> wrote:
>
> For example, nix allows you to reference the source checkout with the $src variable:
>
> https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/compilers/carp/default.nix#L38


-- 
Retrieve my PGP public key:

  gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I reference the src checkout in a package?
  2022-10-30  4:47   ` Zhu Zihao
@ 2022-10-30 16:32     ` jgart
  0 siblings, 0 replies; 4+ messages in thread
From: jgart @ 2022-10-30 16:32 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: guix-devel

On Sun, 30 Oct 2022 12:47:13 +0800 Zhu Zihao <all_but_last@163.com> wrote:
> 
> Try `#$(package-source this-package)` in the builder gexp.

Thanks! https://issues.guix.gnu.org/58898




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-30 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-30  4:05 How do I reference the src checkout in a package? jgart
2022-10-30  4:09 ` jgart
2022-10-30  4:47   ` Zhu Zihao
2022-10-30 16:32     ` jgart

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.