Skip to content

Instantly share code, notes, and snippets.

@drupol
Created March 18, 2024 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drupol/243f1d062a2ba02694f22076fc63a898 to your computer and use it in GitHub Desktop.
Save drupol/243f1d062a2ba02694f22076fc63a898 to your computer and use it in GitHub Desktop.
guix.scm
(use-modules (guix)
(guix build-system gnu))
(define-public datetime
(package
(name "datetime")
(version "1.0")
(source (local-file "./src" #:recursive? #t))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'check)
(replace 'build
(lambda* (#:key inputs #:allow-other-keys)
(invoke "gcc" "datetime.c" "-o" "datetime")))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(mkdir-p (string-append out "/bin"))
(install-file "datetime" (string-append out "/bin"))))))))
(synopsis "DateTime Program")
(description "This package contains a simple program that shows the current date and time.")
(home-page #f)
(license #f)))
datetime
@oldiob
Copy link

oldiob commented Mar 20, 2024

If inputs is not used, I think you can simply do: (lambda _ (invoke "gcc" "datetime.c" "-o" "datetime"))

@oldiob
Copy link

oldiob commented Mar 20, 2024

I'm pretty sure that install-file will also create parent directories. So the above mkdir-p is not necessary.

@oldiob
Copy link

oldiob commented Mar 20, 2024

Instead of deleting the check phase, you could add #:tests? #f in arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment