File tree Expand file tree Collapse file tree 5 files changed +145
-5
lines changed Expand file tree Collapse file tree 5 files changed +145
-5
lines changed Original file line number Diff line number Diff line change 82
82
''
83
83
# Configuration Options
84
84
85
+ To see all available resources options, use the [nixidy options search](search) powered by [NüschtOS](https://github.com/NuschtOS/search).
85
86
''
86
87
]
87
88
++ ( mapAttrsToList ( n : opt :
Original file line number Diff line number Diff line change
1
+ {
2
+ pkgs ,
3
+ lib ,
4
+ kubenix ,
5
+ mkSearch ,
6
+ } : let
7
+ nixidyPath = toString ./.. ;
8
+ kubenixPath = toString kubenix ;
9
+
10
+ # Borrowed from home-manager :)
11
+ gitHubDeclaration = user : repo : subpath : {
12
+ url = "https://github.com/${ user } /${ repo } /blob/main/${ subpath } " ;
13
+ name = "${ repo } /${ subpath } " ;
14
+ } ;
15
+
16
+ options =
17
+ ( lib . evalModules {
18
+ modules =
19
+ import ../modules/modules.nix
20
+ ++ [
21
+ {
22
+ nixidy . resourceImports = [
23
+ ( kubenix + "/modules/generated/v1.30.nix" )
24
+ ../modules/generated/argocd.nix
25
+ ] ;
26
+ }
27
+ ] ;
28
+ specialArgs = {
29
+ inherit pkgs lib ;
30
+ } ;
31
+ } )
32
+ . options ;
33
+
34
+ optionsJSON =
35
+ ( pkgs . buildPackages . nixosOptionsDoc {
36
+ options = removeAttrs options [ "_module" ] ;
37
+ transformOptions = opt :
38
+ opt
39
+ // {
40
+ declarations =
41
+ map (
42
+ decl :
43
+ if lib . hasPrefix nixidyPath ( toString decl )
44
+ then gitHubDeclaration "arnarg" "nixidy" ( lib . removePrefix "/" ( lib . removePrefix nixidyPath ( toString decl ) ) )
45
+ else if lib . hasPrefix kubenixPath ( toString decl )
46
+ then gitHubDeclaration "hall" "kubenix" ( lib . removePrefix "/" ( lib . removePrefix kubenixPath ( toString decl ) ) )
47
+ else if decl == "lib/modules.nix"
48
+ then gitHubDeclaration "NixOS" "nixpkgs" decl
49
+ else decl
50
+ )
51
+ opt . declarations ;
52
+ }
53
+ // ( lib . optionalAttrs ( opt . description == null ) {
54
+ description = "" ;
55
+ } ) ;
56
+ } )
57
+ . optionsJSON ;
58
+ in
59
+ baseHref :
60
+ mkSearch {
61
+ inherit baseHref ;
62
+ optionsJSON = optionsJSON + "/share/doc/nixos/options.json" ;
63
+ urlPrefix = "https://github.com/arnarg/nixidy/tree/main" ;
64
+ title = "nixidy options search" ;
65
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
pkgs ,
3
3
lib ? pkgs . lib ,
4
+ kubenix ,
5
+ mkSearch ,
4
6
} : let
5
7
optionsMd = import ./build-options-doc.nix { inherit pkgs lib ; } ;
6
8
9
+ buildSearch = import ./build-options-search.nix {
10
+ inherit pkgs lib kubenix mkSearch ;
11
+ } ;
12
+
7
13
libraryMd = import ./build-library-doc.nix { inherit pkgs lib ; } ;
8
14
9
15
docsHtml = pkgs . stdenv . mkDerivation {
83
89
buildPhase = ''
84
90
mkdir -p $out
85
91
python -m mkdocs build
92
+
93
+ cp -r ${ buildSearch "/nixidy/options/search/" } $out/options/search
86
94
'' ;
87
95
} ;
88
96
in {
89
97
html = docsHtml ;
98
+ search = buildSearch "/" ;
90
99
}
Original file line number Diff line number Diff line change 6
6
flake-utils . url = "github:numtide/flake-utils" ;
7
7
nix-kube-generators . url = "github:farcaller/nix-kube-generators" ;
8
8
9
+ nuschtos = {
10
+ url = "github:nuschtos/search" ;
11
+ inputs = {
12
+ nixpkgs . follows = "nixpkgs" ;
13
+ flake-utils . follows = "flake-utils" ;
14
+ } ;
15
+ } ;
16
+
9
17
kubenix = {
10
18
url = "github:hall/kubenix" ;
11
19
inputs . nixpkgs . follows = "nixpkgs" ;
18
26
flake-utils ,
19
27
nix-kube-generators ,
20
28
kubenix ,
29
+ nuschtos ,
21
30
} :
22
31
{
23
32
lib = rec {
69
78
inherit system ;
70
79
} ;
71
80
docs = import ./docs {
72
- inherit pkgs ;
81
+ inherit pkgs kubenix ;
82
+ mkSearch = nuschtos . packages . ${ system } . mkSearch ;
83
+ lib = import ./lib {
84
+ inherit pkgs ;
85
+ kubelib = nix-kube-generators ;
86
+ } ;
73
87
} ;
74
88
packages = import ./nixidy pkgs ;
75
89
in {
You can’t perform that action at this time.
0 commit comments