75 lines
3.1 KiB
Org Mode
75 lines
3.1 KiB
Org Mode
:PROPERTIES:
|
|
:ID: arroyo/nixos
|
|
:END:
|
|
#+TITLE: Arroyo NixOS Generator
|
|
#+filetags: :Project:
|
|
#+PROPERTY: header-args :mkdirp yes
|
|
#+PROPERTY: header-args:emacs-lisp :tangle arroyo-nixos.el
|
|
#+AUTO_TANGLE: t
|
|
#+ARCOLOGY_KEY: cce/arroyo/nixos
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
|
|
Arroyo can manage any number of NixOS hosts, though right now it seeks to only manage systems which are "endpoints" -- a place the user may want to deploy their Arroyo configuration to.
|
|
|
|
Server and cluster management will be explored at some point in the future, but for now this is designed to build laptops and desktops which can be given a bare-bones NixOS install through my [[id:cce/nixos_automatic_partitioning_installer][NixOS Automatic Partitioning Installer]] and attached to the same network as a machine running Arroyo or capable of running [[id:cce/morph][Morph]] on a set of Arroyo tangled files.
|
|
|
|
* Calling in to the Arcology to generate [[id:cce/my_nixos_configuration][My NixOS Configuration]]
|
|
|
|
I'll move this code here someday, for now we call it with a nix run. good luck making this work for yourself! you could replace the =path:= and it might just work.
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun arroyo-nixos-imports (&optional role)
|
|
(arroyo-generate-imports "nixos" role nil t))
|
|
#+end_src
|
|
|
|
* Arroyo NixOS manages systems with [[id:cce/morph][Morph]]:
|
|
|
|
It goes in to [[id:arroyo/home-manager][Arroyo Home Manager]] but can be installed from GitHub to bootstrap the system if necessary.
|
|
|
|
#+ARROYO_HOME_MODULE: hm/morph.nix
|
|
|
|
#+begin_src nix :tangle ~/arroyo-nix/hm/morph.nix
|
|
{ pkgs, ... }:
|
|
{
|
|
home.packages = [ pkgs.morph ];
|
|
}
|
|
#+end_src
|
|
|
|
** NEXT why isn't this on the [[id:cce/morph][Morph]] page..?
|
|
|
|
* Flooding the Arroyo tangles and deploys all sub-systems
|
|
:PROPERTIES:
|
|
:ID: 20211130T215142.470274
|
|
:ROAM_ALIASES: arroyo-flood
|
|
:END:
|
|
=arroyo-flood= is an interactive command which stitches together the arroyo system and runs the =morph= command which deploys the system:
|
|
|
|
#+ARROYO_MODULE_WANTS: cce/org-roam.org
|
|
|
|
[[elisp:(arroyo-flood)][Click here to flood the Arroyo.]]
|
|
|
|
#+begin_src emacs-lisp :results none
|
|
(defun arroyo-nixos-full-spread (host &optional local-only switch-action)
|
|
"Flood the arroyo. Tangle all related files and run morph deploy.
|
|
DEP-FILE is a string pointing to a Morph network definition.
|
|
SWITCH-ACTION is one of the actions which morph deploy expects. Read its docs."
|
|
(interactive (list (->> (shell-command-to-string "deploy-targets")
|
|
(s-split "\n")
|
|
(append '("--all"))
|
|
(completing-read "Which host do you want to deploy to? "))))
|
|
(let ((switch-action (or switch-action "switch")))
|
|
;; expand this to include CCE_NIXOS keywords eventually
|
|
(org-babel-tangle-file (expand-file-name "cce/home-manager.org" org-roam-directory))
|
|
(org-babel-tangle-file (expand-file-name "arroyo/arroyo-emacs.org" org-roam-directory))
|
|
(arroyo-emacs-generate-init)
|
|
(async-shell-command (format "deploy -a %s %s" switch-action host)
|
|
"*nix-deploy*")))
|
|
|
|
(defalias 'arroyo-flood 'arroyo-nixos-full-spread)
|
|
#+end_src
|
|
|
|
#+begin_src emacs-lisp
|
|
(provide 'arroyo-nixos)
|
|
#+end_src
|