diff --git a/404.html b/404.html index 7ef6560..ab3c015 100644 --- a/404.html +++ b/404.html @@ -97,7 +97,7 @@ diff --git a/cachix/index.html b/cachix/index.html index 2a0f85b..4629b20 100644 --- a/cachix/index.html +++ b/cachix/index.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/get.html b/doc/flk/get.html index ef4c062..298198a 100644 --- a/doc/flk/get.html +++ b/doc/flk/get.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/home.html b/doc/flk/home.html index e2d23e0..25e7e74 100644 --- a/doc/flk/home.html +++ b/doc/flk/home.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/index.html b/doc/flk/index.html index 11caad1..bc0ab7e 100644 --- a/doc/flk/index.html +++ b/doc/flk/index.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/install.html b/doc/flk/install.html index 0337eae..21eaf4e 100644 --- a/doc/flk/install.html +++ b/doc/flk/install.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/iso.html b/doc/flk/iso.html index fc9b702..a936179 100644 --- a/doc/flk/iso.html +++ b/doc/flk/iso.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/up.html b/doc/flk/up.html index ddb9a6b..7550af7 100644 --- a/doc/flk/up.html +++ b/doc/flk/up.html @@ -95,7 +95,7 @@ diff --git a/doc/flk/update.html b/doc/flk/update.html index 7d7692a..362e6d7 100644 --- a/doc/flk/update.html +++ b/doc/flk/update.html @@ -95,7 +95,7 @@ diff --git a/doc/index.html b/doc/index.html index 528bb06..ac8f2b6 100644 --- a/doc/index.html +++ b/doc/index.html @@ -95,7 +95,7 @@ diff --git a/doc/integrations/deploy.html b/doc/integrations/deploy.html index c15d64d..7a04644 100644 --- a/doc/integrations/deploy.html +++ b/doc/integrations/deploy.html @@ -95,7 +95,7 @@ diff --git a/doc/integrations/hercules.html b/doc/integrations/hercules.html index f26f804..6af5249 100644 --- a/doc/integrations/hercules.html +++ b/doc/integrations/hercules.html @@ -95,7 +95,7 @@ diff --git a/doc/integrations/index.html b/doc/integrations/index.html index d5117d9..7a99741 100644 --- a/doc/integrations/index.html +++ b/doc/integrations/index.html @@ -95,7 +95,7 @@ diff --git a/doc/layout.html b/doc/layout.html index 2770754..833c82f 100644 --- a/doc/layout.html +++ b/doc/layout.html @@ -95,7 +95,7 @@ diff --git a/doc/start/from-nixos.html b/doc/start/from-nixos.html index 84c49ac..39e66c8 100644 --- a/doc/start/from-nixos.html +++ b/doc/start/from-nixos.html @@ -95,7 +95,7 @@ diff --git a/doc/start/index.html b/doc/start/index.html index ca1543c..9fe16ff 100644 --- a/doc/start/index.html +++ b/doc/start/index.html @@ -95,7 +95,7 @@ diff --git a/doc/start/iso.html b/doc/start/iso.html index 74b2fe0..25cce21 100644 --- a/doc/start/iso.html +++ b/doc/start/iso.html @@ -95,7 +95,7 @@ diff --git a/extern/index.html b/extern/index.html index 284e738..d3ded06 100644 --- a/extern/index.html +++ b/extern/index.html @@ -95,7 +95,7 @@ diff --git a/flake.nix b/flake.nix index a4bd1ed..d7c2de4 100644 --- a/flake.nix +++ b/flake.nix @@ -66,7 +66,7 @@ overlay = import ./pkgs; - lib = import ./lib { inherit nixos; }; + lib = import ./lib { inherit nixos pkgs; }; templates.flk.path = ./.; diff --git a/hosts/index.html b/hosts/index.html index 1fc3068..330cd33 100644 --- a/hosts/index.html +++ b/hosts/index.html @@ -95,7 +95,7 @@ @@ -207,7 +207,7 @@ the nixos-hardware reposit - @@ -225,7 +225,7 @@ the nixos-hardware reposit - diff --git a/index.html b/index.html index 8c6bc4b..c9db9fa 100644 --- a/index.html +++ b/index.html @@ -95,7 +95,7 @@ diff --git a/lib/default.nix b/lib/default.nix index 1a5b8d9..aeaf63e 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,4 @@ -{ nixos, ... }: +{ nixos, pkgs, ... }: let inherit (builtins) attrNames attrValues isAttrs readDir listToAttrs mapAttrs pathExists filter; diff --git a/lib/index.html b/lib/index.html new file mode 100644 index 0000000..608d5f3 --- /dev/null +++ b/lib/index.html @@ -0,0 +1,312 @@ + + + + + + Lib - devos docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+

Lib

+

The lib directory mirrors the upstream concepts of nixpkgs:./lib, +nixpkgs:./nixos/lib and nixpkgs:./pkgs/pkgs-lib, +but also occasionally nixpkgs:./pkgs/build-support.

+

It comes with functions necesary to declutter devos itself, but you are +welcome to extend it to your needs.

+

For example:

+
    +
  • +

    you want to add a library function that depends on some packages +and use it throughout your devos environment: place it into ./lib +as if you would place it into nixpkgs:./pkgs/pkgs-lib.

    +
  • +
  • +

    you want to add library functions that don't depend on pkgs: place +them into ./lib as if you would place them into nixpkgs:./lib.

    +
  • +
  • +

    need to try out a newish custom build support: place it here before +upstreaming into nixpkgs:./pkgs/build-support.

    +
  • +
  • +

    you want to reutilize certain module configuration functions or helpers: +place them into ./lib as if you would place them into nixpkgs:./nixos/lib.

    +
  • +
+

Once your library grows, we recoomend you start organizing them into subfolders +analogous nixpkgs:

+ + + + + +
nixpkgsdevos
./lib./lib
./pkgs/pkgs-lib./lib/pkgs-lib
./nixos/lib./lib/nixos-lib
./pkgs/build-support./lib/pkgs-build
+

Example

+

lib/nixos-lib/mkCustomI3BindSym/default.nix:

+
{ pkgs, writers, ... }:
+{ name, cmd, workspace, baseKey }:
+let
+  isWorkspaceEmpty = writers.writePython3 "is-workspace-empty" {
+    libraries = [ pkgs.python3Packages.i3ipc ];
+  } (builtins.readFile ./is-workspace-empty.py);
+
+  ws = builtins.toString workspace;
+in
+''
+
+  # ${name}
+  #bindsym ${baseKey}+${ws} workspace ${ws}; exec ${cmd}
+  bindsym ${baseKey}+${ws} workspace ${ws}; exec bash -c "${isWorkspaceEmpty} && ${cmd}"
+''
+
+

lib/nixos-lib/mkCustomI3BindSym/is-workspace-empty.py:

+
# returns 0/1 if current workspace is empty/non-empty
+
+import i3ipc
+
+i3 = i3ipc.Connection()
+tree = i3.get_tree()
+
+
+def current_workspace():
+    return tree.find_focused().workspace()
+
+
+if current_workspace().leaves():
+    print("Error current workspace is not empty")
+    exit(1)
+exit(0)
+
+

lib/default.nix:

+
{ nixos, pkgs, ... }:
+# ...
+{
+  # ...
+  mkCustomI3BindSym = pkgs.callPackage ./nixos-lib/mkCustomI3BindSym { };
+}
+
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/index.html b/modules/index.html index 2143c1d..64db396 100644 --- a/modules/index.html +++ b/modules/index.html @@ -95,7 +95,7 @@ @@ -235,7 +235,7 @@ in