mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-11-29 22:58:06 +00:00
utils: nix-expressions->profile-build-wrapper: Move #:link-to argument to command-line.
* modules/rosenthal/utils/nix.scm (nix-expressions->profile-build-wrapper): Remove #:link-to argument and get it from command-line instead. (with-nix-profile): Remove path argument.
This commit is contained in:
1 file changed
+20
-19
@@ -130,7 +130,6 @@ optional and interpreted as attribute paths relative to the Nix expression."
|
|||||||
(define* (nix-expressions->profile-build-wrapper
|
(define* (nix-expressions->profile-build-wrapper
|
||||||
expressions
|
expressions
|
||||||
#:key
|
#:key
|
||||||
link-to
|
|
||||||
(paths-to-link %nix-build-profile-paths)
|
(paths-to-link %nix-build-profile-paths)
|
||||||
(extra-outputs-to-install %nix-build-profile-extra-outputs)
|
(extra-outputs-to-install %nix-build-profile-extra-outputs)
|
||||||
(nixpkgs-commit "714a5f8c4ead6b31148d829288440ed033ccc041")
|
(nixpkgs-commit "714a5f8c4ead6b31148d829288440ed033ccc041")
|
||||||
@@ -138,13 +137,13 @@ optional and interpreted as attribute paths relative to the Nix expression."
|
|||||||
"Return a file-like object that wraps the \"nix build\" command-line utility
|
"Return a file-like object that wraps the \"nix build\" command-line utility
|
||||||
and builds a Nix profile if run. Nix daemon is required to use the wrapper.
|
and builds a Nix profile if run. Nix daemon is required to use the wrapper.
|
||||||
|
|
||||||
|
The wrapper accepts an optional path argument and will symlink the resulted
|
||||||
|
profile to the path.
|
||||||
|
|
||||||
EXPRESSIONS (list of strings / list of G-expressions) can be formatted from
|
EXPRESSIONS (list of strings / list of G-expressions) can be formatted from
|
||||||
'installables->nix-expressions' and specifies packages to be added into the
|
'installables->nix-expressions' and specifies packages to be added into the
|
||||||
profile.
|
profile.
|
||||||
|
|
||||||
If set, the resulted profile will be symlinked to LINK-TO (string). This also
|
|
||||||
prevents garbage collection of the profile.
|
|
||||||
|
|
||||||
PATHS-TO-LINK (default: %nix-build-profile-paths, list of strings) limits
|
PATHS-TO-LINK (default: %nix-build-profile-paths, list of strings) limits
|
||||||
subdirectories of packages to be included into the profile. All subdirectories
|
subdirectories of packages to be included into the profile. All subdirectories
|
||||||
will be included if specifying '(\"/\").
|
will be included if specifying '(\"/\").
|
||||||
@@ -196,13 +195,16 @@ in
|
|||||||
(program-file "build-nix-profile-nix-wrapper"
|
(program-file "build-nix-profile-nix-wrapper"
|
||||||
(with-imported-modules '((guix build utils))
|
(with-imported-modules '((guix build utils))
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (guix build utils))
|
(use-modules (ice-9 match)
|
||||||
(invoke #$nix "build"
|
(guix build utils))
|
||||||
"--print-out-paths"
|
(match (command-line)
|
||||||
#$@(if link-to
|
((_ . args)
|
||||||
(list "--out-link" link-to)
|
(apply invoke #$nix
|
||||||
(list "--no-link"))
|
"build" "--print-out-paths"
|
||||||
"--file" #$profile.nix)))))
|
`(,@(if (null? args)
|
||||||
|
(list "--no-link")
|
||||||
|
(list "--out-link" (car args)))
|
||||||
|
"--file" #$profile.nix))))))))
|
||||||
|
|
||||||
;; See also https://nix.dev/manual/nix/2.34/command-ref/new-cli/nix3-env-shell.html
|
;; See also https://nix.dev/manual/nix/2.34/command-ref/new-cli/nix3-env-shell.html
|
||||||
(define* (nix-shell-wrapper name
|
(define* (nix-shell-wrapper name
|
||||||
@@ -337,13 +339,13 @@ practice."
|
|||||||
(description #f)
|
(description #f)
|
||||||
(license #f))))
|
(license #f))))
|
||||||
|
|
||||||
(define-syntax-rule (with-nix-profile path packages)
|
(define-syntax-rule (with-nix-profile packages)
|
||||||
"Transform PACKAGES, turning wrappers created by 'nix-shell-wrapper' into
|
"Transform PACKAGES, turning wrappers created by 'nix-shell-wrapper' into
|
||||||
packages, along with a package containing the build-nix-profile script created
|
packages, additionally adding a package containing the build-nix-profile script
|
||||||
for them by 'nix-expressions->profile-build-wrapper'.
|
created for them by 'nix-expressions->profile-build-wrapper'.
|
||||||
|
|
||||||
When invoking the build-nix-profile script, the resulted Nix profile will be
|
The build-nix-profile accepts an optional path argument and will symlink the
|
||||||
linked to PATH.
|
resulted profile to the path.
|
||||||
|
|
||||||
This macro is intended for use in Guix System and Guix Home package
|
This macro is intended for use in Guix System and Guix Home package
|
||||||
declarations. Note that calls to 'nix-shell-wrapper' must be in the scope of
|
declarations. Note that calls to 'nix-shell-wrapper' must be in the scope of
|
||||||
@@ -351,7 +353,7 @@ this macro.
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
(with-nix-profile \"/nix/var/nix/profiles/guix-system-nix-profile\"
|
(with-nix-profile
|
||||||
(append (list (nix-shell-wrapper \"readest\"
|
(append (list (nix-shell-wrapper \"readest\"
|
||||||
'(\"github:NixOS/nixpkgs/714a5f8c4ead6b31148d829288440ed033ccc041#readest\")
|
'(\"github:NixOS/nixpkgs/714a5f8c4ead6b31148d829288440ed033ccc041#readest\")
|
||||||
#:run-command '(\"readest\")
|
#:run-command '(\"readest\")
|
||||||
@@ -371,8 +373,7 @@ Example:
|
|||||||
((_ _ installables expression)
|
((_ _ installables expression)
|
||||||
(installables->nix-expressions
|
(installables->nix-expressions
|
||||||
installables #:expression expression)))
|
installables #:expression expression)))
|
||||||
wrappers)
|
wrappers)))
|
||||||
#:link-to path))
|
|
||||||
,@(map (match-lambda
|
,@(map (match-lambda
|
||||||
((_ wrapper _ _)
|
((_ wrapper _ _)
|
||||||
(nix-shell-wrapper->package wrapper)))
|
(nix-shell-wrapper->package wrapper)))
|
||||||
|
|||||||
Reference in new issue
Block a user