;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\301\302!\210\301\303!\210\301\304!\210\305\306\307\310\311\312%\210\313>\203\314\315!\210\316\317\320\321\322DD\323\311\306\324\325&\210\316\326\320\321\327DD\330\311\306\324\331&\210\316\332\320\321\333DD\334\311\306\324\321&\210\316\335\320\321\336DD\337\311\306\324\340&\210\316\341\320\321\342DD\343\311\306\324\344&\210\316\345\320\321\346DD\347\311\306\324\321&\210\316\350\320\321\351DD\352\311\306\324\353&\210\316\354\320\321\355DD\356\311\306\324\325&\210\316\357\320\321\360DD\361\311\306\324\362&\207" [system-type require cl-lib subr-x json custom-declare-group nix-env-install nil "Install packages using nix-env." :group nix (ms-dos windows-nt cygwin) user-error "Nix doesn't run on non-UNIX systems" custom-declare-variable nix-env-install-display-process-buffers funcall function #[0 "\300\207" [t] 1] "Whether to display process buffers." :type boolean nix-env-install-window-height #[0 "\300\207" [15] 1] "Window height of process buffers." number nix-env-install-display-buffer #[0 "\300\207" [nix-env-install--display-buffer-default] 1] "Function used to display process buffers." nix-env-install-cachix-executable #[0 "\300\207" [#1="cachix"] 1 #1#] "Executable of cachix." file nix-env-install-process-environment #[0 "\300\207" [("NIX_BUILD_SHELL")] 1] "Additional environment variables for processes.\n\nThe entries in this variables are added to `process-environment'\nand possibly overrides existing ones.\n\nIf you set NIX_BUILD_SHELL to something like zsh in your shell,\nyou need to unset it when you run commands in \"nix-shell\".\nThis variable allows that." (repeat string) nix-env-install-process-filter #[0 "\300\207" [nix-env-install-default-process-filter] 1] "Filter function for processes." nix-env-install-process-output-filter #[0 "\300\301!\203\301\207\300\302!\205\302\207" [fboundp xterm-color-filter ansi-color-filter-apply] 2] "Function used to handle output from processes." (choice function nil) nix-env-install-delete-process-window #[0 "\300\207" [t] 1] "When non-nil, delete the process window on success." nix-env-install-npm-node2nix-options #[0 "\300\207" [#2="--nodejs-10"] 1 #2#] "Additional command line arguments for node2nix." string] 8) #@175 Hook to run immediately after creating a process in this package. This hook is run in process buffers, so you can use it to convert the output of each program, for example. (defvar nix-env-install-start-process-hook nil (#$ . 2314)) (defvar nix-env-install-process-window nil) #@759 Start an asynchronous process for running a system command. NAME, BUFFER, and COMMAND are the same as in `make-process'. COMMAND is a list of an executable name and arguments. When CLEAR-BUFFER is non-nil, the buffer is erased before the process starts. When DISPLAY-BUFFER is non-nil, the buffer is displayed. If it is a function, it is used to display the buffer. Otherwise, `nix-env-install-display-buffer' is used. ON-FINISHED is a function called after a successful exit of the command. ON-ERROR is a function called when the process exits with a non-zero exit code. CLEANUP is a function whenever the process exits. (fn NAME BUFFER COMMAND &key CLEAR-BUFFER (DISPLAY-BUFFER nix-env-install-display-process-buffers) ON-FINISHED ON-ERROR CLEANUP) (defalias 'nix-env-install--start-process #[899 "\305\306\"A@\305\307\"\206\310DA@\305\311\"A@\305\312\"A@\305\313\"A@\211\203P\211@\314>\2038\211AA\262\202%\315>A@\203G\310\262\202%\316\317@\"\210\202%\210\203e\320!\203erq\210\321 \210)\322\323\n%\324 \325\326 \327\f\330 \331\n\332\n&\n)r\333!q\210\334\303!\210\310\335\336!\210\205\244\337!\203\241\202\242\fp!)\207" [nix-env-install-display-process-buffers process-environment nix-env-install-process-filter header-line-format nix-env-install-display-buffer plist-member :clear-buffer :display-buffer nil :on-finished :on-error :cleanup (:clear-buffer :display-buffer :on-finished :on-error :cleanup :allow-other-keys) :allow-other-keys error "Keyword argument %s not one of (:clear-buffer :display-buffer :on-finished :on-error :cleanup)" get-buffer erase-buffer make-closure #[514 "r\304!q\210db\210)\305!\204\303\203\303 \210\211\306\232\203$\301\203$\301 \207\307\310\"\2042\307\311\"\205A\302\2039\302 \207\312\313\300\314\315\"#\207" [V0 V1 V2 V3 process-buffer process-live-p "finished\n" string-match "exited abnormally with code \\([[:digit:]]+\\)" "failed with code \\([[:digit:]]+\\)" message "Process %s has exited with %s" match-string 1] 8 "\n\n(fn PROC EVENT)"] nix-env-install--make-process-environment make-process :name :buffer :command :filter :sentinel process-buffer make-local-variable run-hooks nix-env-install-start-process-hook functionp] 21 (#$ . 2599)]) (byte-code "\300\301\302\303#\300\207" [function-put nix-env-install--start-process lisp-indent-function 1] 4) #@85 Default process filter. PROC is the process, and STR is the string. (fn PROC STR) (defalias 'nix-env-install-default-process-filter #[514 "\301!\302!\211\205/\303!r\304\305\"\216\306@\307\"\210db\210\203&!\202'c\210\310\311!*\262\207" [nix-env-install-process-output-filter process-buffer get-buffer-window internal--before-with-selected-window make-closure #[0 "\301\300!\207" [V0 internal--after-with-selected-window] 2] select-window norecord recenter -1] 8 (#$ . 4968)]) #@93 Make a new value of `process-enviroment' with `nix-env-install-process-environment' merged. (defalias 'nix-env-install--make-process-environment #[0 "\302\303\" \211\2031\211@\304!\305@\"\211\203 \211A\241\266\202*@BB\262\266A\266\202\202\210\302\306\"\207" [process-environment nix-env-install-process-environment mapcar #[257 "\300!@B\207" [nix-env-install--parse-environment] 3 "\n\n(fn RAW-FORM)"] nix-env-install--parse-environment assoc cdr] 7 (#$ . 5464)]) #@201 Return a cell of key and value from the RAW-FORM of a key=value pair. If the equal sign is not contained in the form, it returns a cell where the key is the form and the value is nil. (fn RAW-FORM) (defalias 'nix-env-install--parse-environment #[257 "\300\301\"\203\302\303\"\302\304\"B\207\211C\207" [string-match "^\\([^=]+\\)=\\([^z-a]+?\\)$" match-string 1 2] 5 (#$ . 5955)]) #@34 Delete the window for processes. (defalias 'nix-env-install--delete-process-window #[0 "\205 \205\302 !\205\303 !\207" [nix-env-install-delete-process-window nix-env-install-process-window window-live-p delete-window] 2 (#$ . 6348)]) #@56 Display BUFFER in a new dedicated window. (fn BUFFER) (defalias 'nix-env-install--display-buffer-default #[257 "\205 \302!\205 \211\203$\303!\203\304\305\"\210\306\"\210\304\307\"\207\310\311\312 BD\"\211\207" [nix-env-install-process-window nix-env-install-window-height window-live-p window-dedicated-p set-window-dedicated-p nil set-window-buffer t display-buffer-in-side-window (side . bottom) height] 7 (#$ . 6595)]) (defconst nix-env-install-cachix-buffer "*nix-env-install cachix*") #@47 Return non-nil if there is cachix executable. (defalias 'nix-env-install-cachix-exists-p #[0 "\301!\206 \302!\207" [nix-env-install-cachix-executable file-executable-p executable-find] 2 (#$ . 7107)]) #@166 Install cachix, if you haven't already. When the installation process is finished, ON-FINISHED is called. (fn &key (ON-FINISHED #\='nix-env-install-cachix-setup)) (defalias 'nix-env-install-cachix #[128 "\301\302\"\206\303A@\211\2035\211@\304>\203\211AA\262\202 \305>A@\203,\306\262\202 \307\310@\"\210\202 \210\311 \203E\312\313!\205L\314\315!\207\316\317\320\302%\207" [nix-env-install-cachix-buffer plist-member :on-finished (nil nix-env-install-cachix-setup) (:on-finished :allow-other-keys) :allow-other-keys nil error "Keyword argument %s not one of (:on-finished)" nix-env-install-cachix-exists-p called-interactively-p interactive message "Cachix is already installed" nix-env-install--start-process "nix-env" ("nix-env" "-iA" "cachix" "-f" "https://cachix.org/api/v1/install")] 8 (#$ . 7318) nil]) #@39 Start an interactive setup of cachix. (defalias 'nix-env-install-cachix-setup #[0 "\300\301!\210\302\303!\207" [browse-url "https://cachix.org/" message "After cachix is installed, follow the instructions to set up your account."] 2 (#$ . 8152)]) #@41 Enable binary cache of NAME. (fn NAME) (defalias 'nix-env-install-cachix-use #[257 "\302 \203\303\304 \305E\306\307\310\311\312 \"&\207\313\314!\205&\315\310\316\307\317DE\"\207" [nix-env-install-cachix-buffer nix-env-install-cachix-executable nix-env-install-cachix-exists-p nix-env-install--start-process "cachix" "use" :display-buffer nil :on-finished make-closure #[0 "\301 \210\302\303\300\"\207" [V0 nix-env-install--delete-process-window message "Successfully enabled cachix from %s"] 3] yes-or-no-p "Cachix is not installed yet. Install it? " nix-env-install-cachix lambda nix-env-install-cachix-use] 11 (#$ . 8405) "sCachix: "]) #@55 Uninstall PACKAGE installed by nix-env. (fn PACKAGE) (defalias 'nix-env-install-uninstall #[257 "\300\301\302\303\304!\"!!\207" [message shell-command-to-string format "nix-env -e %s" shell-quote-argument] 7 (#$ . 9058) (byte-code "\300\301\302\303\304\"\"C\207" [completing-read "Package: " process-lines "nix-env" "-q"] 5)]) (defconst nix-env-install-npm-buffer "*nix-env-install npm*") (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\207" [custom-declare-variable nix-env-install-npm-install-hook funcall function #[0 "\300\207" [nil] 1] "Hooks called after installation of npm packages." :type hook :group nix-env-install] 8) #@46 Generate a temporary directory for node2nix. (defalias 'nix-env-install--node2nix-temp-dir #[0 "\300\301\302!!\207" [string-trim-right shell-command-to-string "mktemp -d -t emacs-node2nix-XXX"] 3 (#$ . 9705)]) #@53 Install PACKAGES from npm using Nix. (fn PACKAGES) (defalias 'nix-env-install-npm #[257 "\211\204\303\304!\210\305 \211\306\307\"\310\311\312\"r\211q\210\313\314\"\216\315<\203'\202.;\205.C!c\210\316ed#\210*\210\317\320\"\210\321\322 \323\324\325\326\327\330 \n#\257\331\312\332\333\334\335\321\336\301\337\340\341\336\342\306\343\"\344F\345\346<\203o\202\205;\203{C\202\205\347\350\351#\205\205\334\"#D\332\333\334\352\317\353\337DE\354BBBB\355\333\334\356\357BBE\257F&)\207" [default-directory nix-env-install-npm-buffer nix-env-install-npm-node2nix-options user-error "PACKAGES cannot be nil" nix-env-install--node2nix-temp-dir expand-file-name "npm-packages.json" generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] json-encode write-region message "Generating Nix expressions using node2nix for %s..." nix-env-install--start-process "nix-env-install-node2nix" "nix-shell" "-p" "nodePackages.node2nix" "--run" format "node2nix -i %s %s" :clear-buffer :on-finished lambda nil (message "Installing npm packages using nix-env...") "nix-env" quote apply append "-f" "default.nix" "-i" mapcar #[257 "\300\301\302\"D\207" ["-A" format "\"%s\""] 5 "\n\n(fn IT)"] error "cl-etypecase failed: %s, %s" (list string) (nix-env-install--delete-process-window) "Finished installing npm packages: %s" ((run-hooks 'nix-env-install-npm-install-hook)) :cleanup delete-directory (t)] 26 (#$ . 9921) (byte-code "\300\301\302!\303\"C\207" [split-string read-string "npm packages: " " "] 3)]) (provide 'nix-env-install)