refactor: Rename sydnix → sydnix-cli
This commit is contained in:
@@ -11,7 +11,7 @@ A second try at NixOS, now that I have a better idea of what I'm doing. The effo
|
|||||||
|
|
||||||
* Inbox
|
* Inbox
|
||||||
|
|
||||||
* Principles
|
* Conventions
|
||||||
|
|
||||||
** User configuration
|
** User configuration
|
||||||
|
|
||||||
@@ -22,8 +22,6 @@ In order of descending preference, user programs should be configured by...
|
|||||||
3. ~home.file~ and similar.
|
3. ~home.file~ and similar.
|
||||||
4. Mutable symlinks using ~home.file~ and ~mkOutOfStoreSymlink~.
|
4. Mutable symlinks using ~home.file~ and ~mkOutOfStoreSymlink~.
|
||||||
|
|
||||||
* Conventions
|
|
||||||
|
|
||||||
** Repo structure
|
** Repo structure
|
||||||
|
|
||||||
*** =hosts/=
|
*** =hosts/=
|
||||||
@@ -93,6 +91,10 @@ On boot, ...
|
|||||||
|
|
||||||
- =/persist/users/«user»= :: Persistent files belonging to specific users. This differs from the persistent home directories in that files are not necessarily linked anywhere.
|
- =/persist/users/«user»= :: Persistent files belonging to specific users. This differs from the persistent home directories in that files are not necessarily linked anywhere.
|
||||||
|
|
||||||
|
* ~sydnix-cli~
|
||||||
|
|
||||||
|
sydnix-cli is a command-line utility written in Clojure wrapping various sydnix-related scripts.
|
||||||
|
|
||||||
* Tasks
|
* Tasks
|
||||||
|
|
||||||
** Emacs
|
** Emacs
|
||||||
|
|||||||
@@ -18,4 +18,4 @@
|
|||||||
:main-opts ["-m" "nrepl.cmdline"
|
:main-opts ["-m" "nrepl.cmdline"
|
||||||
"--socket" ".nrepl/socket"]}
|
"--socket" ".nrepl/socket"]}
|
||||||
:run
|
:run
|
||||||
{:main-opts ["-m" "sydnix.main"]}}}
|
{:main-opts ["-m" "sydnix-cli.main"]}}}
|
||||||
@@ -18,38 +18,32 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
sydnix = pkgs.mkCljBin {
|
sydnix-cli-unwrapped = clj-nix.lib.mkCljApp {
|
||||||
name = "msyds/sydnix";
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
main-ns = "sydnix.main";
|
modules = [
|
||||||
projectSrc = ./.;
|
{
|
||||||
|
name = "msyds/sydnix-cli";
|
||||||
|
version = "1.0";
|
||||||
|
main-ns = "sydnix-cli.main";
|
||||||
|
projectSrc = ./.;
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
nativeImage = {
|
||||||
asciidoctor
|
enable = true;
|
||||||
|
};
|
||||||
|
# customJdk.enable = true;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
makeWrapper
|
|
||||||
];
|
|
||||||
postInstall = ''
|
|
||||||
wrapProgram $out/bin/sydnix \
|
|
||||||
--set ADOC_PROCESSOR "${pkgs.asciidoctor}/bin/asciidoctor"
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
packages.default = clj-nix.lib.mkCljApp {
|
packages.default = pkgs.symlinkJoin {
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
name = "sydnix-cli";
|
||||||
modules = [
|
version = "0.0.0";
|
||||||
{
|
paths = [ sydnix-cli-unwrapped ];
|
||||||
name = "msyds/sydnix";
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
version = "1.0";
|
postInstall = ''
|
||||||
main-ns = "sydnix.main";
|
wrapProgram $out/bin/sydnix \
|
||||||
projectSrc = ./.;
|
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.asciidoctor ]}
|
||||||
|
'';
|
||||||
nativeImage = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
# customJdk.enable = true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
(ns sydnix.cli-table)
|
(ns sydnix-cli.cli-table)
|
||||||
|
|
||||||
(def *cli-table (atom nil))
|
(def *cli-table (atom nil))
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
(ns sydnix.commands.help
|
(ns sydnix-cli.commands.help
|
||||||
(:require
|
(:require
|
||||||
[babashka.process :as p]
|
[babashka.process :as p]
|
||||||
[sydnix.mangen :as mangen]))
|
[sydnix-cli.mangen :as mangen]))
|
||||||
|
|
||||||
|
|
||||||
(defn adorn-with-help-option [wrapped-command-fn]
|
(defn adorn-with-help-option [wrapped-command-fn]
|
||||||
(fn [{:keys [opts dispatch]}]
|
(fn [{:keys [opts dispatch]}]
|
||||||
@@ -26,7 +25,10 @@
|
|||||||
(defn- wrap-command-fn [wrapped-fn]
|
(defn- wrap-command-fn [wrapped-fn]
|
||||||
(fn [info]
|
(fn [info]
|
||||||
(if (:help (:opts info))
|
(if (:help (:opts info))
|
||||||
(view-man-for-command (mangen/find-dispatched (:dispatch info)))
|
(do (mangen/render-docs-for-command
|
||||||
|
(mangen/find-dispatched (:dispatch info)))
|
||||||
|
#_
|
||||||
|
(view-man-for-command (mangen/find-dispatched (:dispatch info))))
|
||||||
(when-not (nil? wrapped-fn)
|
(when-not (nil? wrapped-fn)
|
||||||
(wrapped-fn info)))))
|
(wrapped-fn info)))))
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
(ns sydnix.commands.rebuild
|
(ns sydnix-cli.commands.rebuild
|
||||||
(:require
|
(:require
|
||||||
[clojure.java.shell :refer [sh]]
|
[clojure.java.shell :refer [sh]]
|
||||||
[sydnix.commands.help :refer [adorn-with-help-option*]]))
|
[sydnix-cli.commands.help :refer [adorn-with-help-option*]]))
|
||||||
|
|
||||||
(def command-options-spec
|
(def command-options-spec
|
||||||
{:flake {:coerce :string
|
{:flake {:coerce :string
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
(ns sydnix.commands.status
|
(ns sydnix-cli.commands.status
|
||||||
(:require
|
(:require
|
||||||
[sydnix.commands.help :refer [adorn-with-help-option*]]))
|
[sydnix-cli.commands.help :refer [adorn-with-help-option*]]))
|
||||||
|
|
||||||
(defn- command-fn [opts]
|
(defn- command-fn [opts]
|
||||||
(prn opts))
|
(prn opts))
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
(ns sydnix.commands.util
|
(ns sydnix-cli.commands.util
|
||||||
(:require
|
(:require
|
||||||
[sydnix.commands.util.mangen :as cmd-util-mangen]))
|
[sydnix-cli.commands.util.mangen :as cmd-util-mangen]))
|
||||||
|
|
||||||
(def commands
|
(def commands
|
||||||
[{:cmds ["util"]
|
[{:cmds ["util"]
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
(ns sydnix.commands.util.mangen
|
(ns sydnix-cli.commands.util.mangen
|
||||||
(:require
|
(:require
|
||||||
[asciidoc.render]
|
[asciidoc.render]
|
||||||
[babashka.fs :as fs]
|
[babashka.fs :as fs]
|
||||||
[babashka.process :as p]
|
[babashka.process :as p]
|
||||||
[sydnix.mangen :as mangen]
|
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[sydnix.cli-table :refer [*cli-table]]
|
[sydnix-cli.mangen :as mangen]
|
||||||
[sydnix.commands.help :refer [adorn-with-help-option*]]
|
[sydnix-cli.cli-table :refer [*cli-table]]
|
||||||
[sydnix.prelude :as prelude]))
|
[sydnix-cli.commands.help :refer [adorn-with-help-option*]]
|
||||||
|
[sydnix-cli.prelude :as prelude]))
|
||||||
|
|
||||||
(defn command-fn [{:keys [yes output-directory]}]
|
(defn command-fn [{:keys [yes output-directory]}]
|
||||||
(if (or yes
|
(if (or yes
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
(ns sydnix.main
|
(ns sydnix-cli.main
|
||||||
(:require
|
(:require
|
||||||
[babashka.cli :as cli]
|
[babashka.cli :as cli]
|
||||||
[sydnix.cli-table :refer [*cli-table]]
|
[sydnix-cli.cli-table :refer [*cli-table]]
|
||||||
[sydnix.commands.help :as cmd-help :refer [adorn-with-help-option*]]
|
[sydnix-cli.commands.help :as cmd-help :refer [adorn-with-help-option*]]
|
||||||
[sydnix.commands.rebuild :as cmd-rebuild]
|
[sydnix-cli.commands.rebuild :as cmd-rebuild]
|
||||||
[sydnix.commands.status :as cmd-status]
|
[sydnix-cli.commands.status :as cmd-status]
|
||||||
[sydnix.commands.util :as cmd-util])
|
[sydnix-cli.commands.util :as cmd-util])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
(def real-cli-table
|
(def real-cli-table
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
(ns sydnix.mangen
|
(ns sydnix-cli.mangen
|
||||||
(:require
|
(:require
|
||||||
[asciidoc.render]
|
[asciidoc.render]
|
||||||
[asciidoc.types]
|
[asciidoc.types]
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
[babashka.process :as p]
|
[babashka.process :as p]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[sydnix.cli-table :refer [*cli-table]])
|
[sydnix-cli.cli-table :refer [*cli-table]])
|
||||||
(:import
|
(:import
|
||||||
[java.io BufferedReader PipedReader PipedWriter]))
|
[java.io BufferedReader PipedReader PipedWriter]))
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
(ns sydnix.prelude
|
(ns sydnix-cli.prelude
|
||||||
(:require
|
(:require
|
||||||
[clojure.core.match :refer [match]]))
|
[clojure.core.match :refer [match]]))
|
||||||
|
|
||||||
Reference in New Issue
Block a user