    (oshi.json SystemInfo)))
 
 ;; just wanted the defrecord near the top
-(declare facts primary-network)
+(declare facts arch)
 
 (defrecord Oshi [facts]
   Facter

             " days"
             " day")))))

(defn primary-network
  "Takes the set of facts and returns a vector of [ipv4 ipv6] for the
  primary network adapter.  Is somewhat naive in that it picks the
  primary adapter based on total bytes sent and received."
  [facts]
  ;; TODO - is this sufficient to find the "primary"?
  (->> (get-in facts [:hardware :networks])
       (remove (comp empty? :ipv4))
       (sort-by #(+ (:bytesSent %)
                    (:bytesRecv %)))
       last
       ((juxt :ipv4 :ipv6))
       (map first)))

(defn uname [{:keys [platform] :as facts}]
  (let [platform (string/lower-case platform)]

  (raw [x] x)

  (arch [{x :facts}]
    (arch x))

  (model [{x :facts}]
    (arch x))

  (cpu-type [{x :facts}]
    (get-in x [:hardware :processor :name]))
