From 1cd4ed136a76f8c5342168ff86e8af93f7eb5e45 Mon Sep 17 00:00:00 2001 From: Pacman99 Date: Sat, 24 Apr 2021 08:14:58 -0700 Subject: [PATCH 1/2] mkFlakeDoc: move to packages output the packages output allows us to do `nix build .#nixosOptionsDoc`. theres also already an instantiated nixpkgs available there. --- flake.lock | 2 +- lib/flake.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 00b0728..23e6089 100644 --- a/flake.lock +++ b/flake.lock @@ -81,7 +81,7 @@ "utils": "utils_2" }, "locked": { - "narHash": "sha256-LvO5VwFNFzb2xbmgw+fWhkrRY1KMlp5vxqQU/BqS0H8=", + "narHash": "sha256-eZJ8p2u56dkLPxF7GiQLbQ6YRKHP6DoOM52G/p+M/3w=", "path": "./lib", "type": "path" }, diff --git a/lib/flake.nix b/lib/flake.nix index c9bd99a..6c7484a 100644 --- a/lib/flake.nix +++ b/lib/flake.nix @@ -81,6 +81,14 @@ lib = nixpkgs.lib // lib; }; }; + packages = { + mkFlakeDoc = pkgs.writeText "mkFlakeOptions.md" + ( + pkgs.nixosOptionsDoc { + inherit (lib.mkFlake.evalArgs { nixos = "nixos"; args = { }; }) options; + } + ).optionsMDDoc; + }; } ); From a53aa8b7eb04f87c8dda74cf82282f73230d4c06 Mon Sep 17 00:00:00 2001 From: Pacman99 Date: Sat, 24 Apr 2021 08:37:23 -0700 Subject: [PATCH 2/2] lib: drop jobs output, prefer checks and packages With mkFlakeDoc in packages there is no need for jobs. And I think anything that could go in jobs really should go in checks or packages. If something needs to be tested - checks, if something needs to be built - packages. jobs is not multi-arch and is redundant to build/test things with when official flake outputs exist --- flake.lock | 2 +- lib/flake.nix | 4 ---- lib/jobs/default.nix | 7 ------- lib/jobs/mkFlakeDoc.nix | 33 --------------------------------- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 lib/jobs/default.nix delete mode 100644 lib/jobs/mkFlakeDoc.nix diff --git a/flake.lock b/flake.lock index 23e6089..0e3ada8 100644 --- a/flake.lock +++ b/flake.lock @@ -81,7 +81,7 @@ "utils": "utils_2" }, "locked": { - "narHash": "sha256-eZJ8p2u56dkLPxF7GiQLbQ6YRKHP6DoOM52G/p+M/3w=", + "narHash": "sha256-7Y6SqdLWr/g8tqNjqakRbS0KVIA/yzRm3D/RnoTAuzE=", "path": "./lib", "type": "path" }, diff --git a/lib/flake.nix b/lib/flake.nix index 6c7484a..c694169 100644 --- a/lib/flake.nix +++ b/lib/flake.nix @@ -54,13 +54,9 @@ } ); - jobs = import ./jobs { inherit nixpkgs; lib = nixpkgs.lib // lib; }; - in { - inherit jobs; - lib = utils.lib // { inherit (lib) mkFlake; diff --git a/lib/jobs/default.nix b/lib/jobs/default.nix deleted file mode 100644 index 5e9cff2..0000000 --- a/lib/jobs/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ nixpkgs, lib, system ? "x86_64-linux" }: -let - pkgs = import nixpkgs { inherit system; overlays = [ ]; config = { }; }; -in -{ - mkFlakeDoc = import ./mkFlakeDoc.nix { inherit pkgs lib; }; -} diff --git a/lib/jobs/mkFlakeDoc.nix b/lib/jobs/mkFlakeDoc.nix deleted file mode 100644 index 5a13d9f..0000000 --- a/lib/jobs/mkFlakeDoc.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ pkgs, lib, ... }: -let - singleDoc = name: value: '' - ## ${name} - ${value.description} - ${lib.optionalString (value ? type) '' - *_Type_*: - ${value.type} - ''} - ${lib.optionalString (value ? default) '' - *_Default_* - ``` - ${builtins.toJSON value.default} - ``` - ''} - ${lib.optionalString (value ? example) '' - *_Example_* - ``` - ${value.example} - ``` - ''} - ''; - - options = ( - lib.mkFlake.evalArgs { nixos = "nixos"; args = { }; } - ).options; - - processedOptions = (pkgs.nixosOptionsDoc { inherit options; }).optionsNix; - - fullDoc = lib.concatStringsSep "" (lib.mapAttrsToList singleDoc processedOptions); -in -pkgs.writeText "devosOptions.md" fullDoc -