diff --git a/dev/flake.lock b/dev/flake.lock index 2c9b0aa2..a851dacb 100644 --- a/dev/flake.lock +++ b/dev/flake.lock @@ -1,5 +1,52 @@ { "nodes": { + "catppuccin-rolling": { + "locked": { + "lastModified": 1732838231, + "narHash": "sha256-KJTRqfEcGpONBK/6BkMdWmbGth0r/nYWY3k/rvZl4es=", + "owner": "catppuccin", + "repo": "nix", + "rev": "becc64812c8d6af24dedc2f75c5c63ebf778a115", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, + "catppuccin-v1.1": { + "locked": { + "lastModified": 1731087391, + "narHash": "sha256-O4GA8GMA9bGJwBW1U6rahT4wJWC6YweLZeGo0i1TS7U=", + "rev": "7c57f5c0a39a4b1557eaade06ba8507cd0ad7537", + "revCount": 313, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/catppuccin/nix/1.1.0/01930ce8-240c-7eee-a23c-4c7873bdedc9/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/catppuccin/nix/1.1.%2A.tar.gz" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -41,6 +88,32 @@ "type": "github" } }, + "ixx": { + "inputs": { + "flake-utils": [ + "nuscht-search", + "flake-utils" + ], + "nixpkgs": [ + "nuscht-search", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.6", + "repo": "ixx", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1730785428, @@ -73,12 +146,55 @@ "type": "github" } }, + "nuscht-search": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "ixx": "ixx", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731936508, + "narHash": "sha256-z0BSSf78LkxIrrFXZYmCoRRAxAmxMUKpK7CyxQRvkZI=", + "owner": "NuschtOS", + "repo": "search", + "rev": "fe07070f811b717a4626d01fab714a87d422a9e1", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "root": { "inputs": { + "catppuccin-rolling": "catppuccin-rolling", + "catppuccin-v1.1": "catppuccin-v1.1", + "flake-utils": "flake-utils", "home-manager": "home-manager", "home-manager-stable": "home-manager-stable", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable", + "nuscht-search": "nuscht-search" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/dev/flake.nix b/dev/flake.nix index 9e177501..66866019 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -3,6 +3,28 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + # NOTE: This is only to deduplicate inputs + flake-utils = { + url = "github:numtide/flake-utils"; + }; + + nuscht-search = { + url = "github:NuschtOS/search"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + + catppuccin-rolling = { + url = "github:catppuccin/nix"; + }; + + "catppuccin-v1.1" = { + url = "https://flakehub.com/f/catppuccin/nix/1.1.*.tar.gz"; + }; + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; home-manager = { @@ -19,11 +41,14 @@ outputs = { self, + nuscht-search, nixpkgs, nixpkgs-stable, home-manager, home-manager-stable, - }: + ... + }@inputs: + let systems = [ "x86_64-linux" @@ -38,14 +63,29 @@ }); forAllSystems = nixpkgs.lib.genAttrs systems; + + # Versions of the modules we want to index in our search + searchVersions = + map + (versionName: { + inherit versionName; + catppuccin = inputs."catppuccin-${versionName}"; + }) + [ + "v1.1" + "rolling" + ]; in + { apps = forAllSystems ( system: + let pkgs = nixpkgsFor.${system}.unstable; inherit (pkgs) lib; in + { serve = { type = "app"; @@ -56,6 +96,7 @@ checks = forAllSystems ( system: + let pkgs = nixpkgsFor.${system}; inherit (pkgs.unstable) lib; @@ -63,6 +104,7 @@ callUnstable = lib.flip pkgs.unstable.callPackage { inherit home-manager; }; callStable = lib.flip pkgs.stable.callPackage { home-manager = home-manager-stable; }; in + lib.optionalAttrs pkgs.unstable.stdenv.hostPlatform.isDarwin { darwin-test-unstable = callUnstable ../tests/darwin.nix; darwin-test-stable = callStable ../tests/darwin.nix; @@ -77,43 +119,43 @@ packages = forAllSystems ( system: + let pkgs = nixpkgsFor.${system}.unstable; inherit (pkgs) lib; - version = self.shortRev or self.dirtyShortRev or "unknown"; - mkOptionDoc = pkgs.callPackage ../docs/options-doc.nix { }; mkSite = pkgs.callPackage ../docs/mk-site.nix { }; - packages' = self.packages.${system}; - in - { - nixos-doc = mkOptionDoc { - inherit version; - moduleRoot = ../modules/nixos; + mkSearchInstance = pkgs.callPackage ../docs/mk-search.nix { + inherit (nuscht-search.packages.${system}) mkMultiSearch; }; - home-manager-doc = mkOptionDoc { - inherit version; - moduleRoot = ../modules/home-manager; - }; + search-instances = lib.listToAttrs ( + map ( + { catppuccin, versionName }: + { + name = "search-${versionName}"; + value = mkSearchInstance { inherit catppuccin versionName; }; + } + ) searchVersions + ); + in + + search-instances + // { + site = mkSite { + pname = "catppuccin-nix-site"; + version = self.shortRev or self.dirtyShortRev or "unknown"; + + src = ../docs; + + postPatch = "ln -sf ${inputs.catppuccin-rolling + "/CHANGELOG.md"} src/NEWS.md"; - site = mkSite rec { - pname = "catppuccin-nix-website"; - inherit version; - - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.unions [ - ../CHANGELOG.md - ../docs/src - ../docs/book.toml - ../docs/theme - ]; - }; - sourceRoot = "${src.name}/docs"; - - nixosDoc = packages'.nixos-doc; - homeManagerDoc = packages'.home-manager-doc; + postInstall = lib.concatLines ( + [ "mkdir -p $out/search" ] + ++ lib.mapAttrsToList ( + name: value: "ln -s ${value.outPath} $out/${lib.replaceStrings [ "-" ] [ "/" ] name}" + ) search-instances + ); }; add-source = @@ -133,7 +175,7 @@ chmod 755 $out/bin/add-source ''; - default = packages'.site; + default = self.packages.${system}.site; } ); }; diff --git a/docs/mk-search.nix b/docs/mk-search.nix new file mode 100644 index 00000000..12455133 --- /dev/null +++ b/docs/mk-search.nix @@ -0,0 +1,25 @@ +{ mkMultiSearch }: + +{ catppuccin, versionName }: + +let + urlPrefix = "https://github.com/catppuccin/nix/tree/${catppuccin.rev}/"; +in + +mkMultiSearch { + title = "catppuccin/nix Option Search"; + baseHref = "/search/${versionName}/"; + + scopes = [ + { + name = "NixOS modules"; + modules = [ catppuccin.nixosModules.catppuccin ]; + inherit urlPrefix; + } + { + name = "home-manager modules"; + modules = [ catppuccin.homeManagerModules.catppuccin ]; + inherit urlPrefix; + } + ]; +} diff --git a/docs/mk-site.nix b/docs/mk-site.nix index c3253a51..87a85181 100644 --- a/docs/mk-site.nix +++ b/docs/mk-site.nix @@ -1,39 +1,35 @@ { + lib, stdenvNoCC, - writeShellApplication, mdbook, python3, + writeShellApplication, }: -{ nixosDoc, homeManagerDoc, ... }@args: + +args: + stdenvNoCC.mkDerivation ( finalAttrs: args // { - nativeBuildInputs = [ mdbook ]; + nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ mdbook ]; - dontPatch = true; dontConfigure = true; doCheck = false; buildPhase = '' runHook preBuild - - ln -s ${nixosDoc} src/options/nixos-options.md - ln -s ${homeManagerDoc} src/options/home-manager-options.md mdbook build - runHook postBuild ''; installPhase = '' runHook preInstall - mv book $out - runHook postInstall ''; - passthru = { + passthru = lib.recursiveUpdate (args.passthru or { }) { serve = writeShellApplication { name = "serve"; diff --git a/docs/options-doc.nix b/docs/options-doc.nix deleted file mode 100644 index b84656c8..00000000 --- a/docs/options-doc.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ lib, nixosOptionsDoc }: -{ - version, - modules ? [ moduleRoot ], - moduleRoot, -}: -let - baseDeclarationUrl = "https://github.com/catppuccin/nix/blob/main"; - declarationIsOurs = declaration: lib.hasPrefix (toString moduleRoot) (toString declaration); - declarationSubpath = declaration: lib.removePrefix (toString ../. + "/") (toString declaration); - - toGithubDeclaration = - declaration: - let - subpath = declarationSubpath declaration; - in - { - url = "${baseDeclarationUrl}/${subpath}"; - name = ""; - }; - - evaluated = lib.evalModules { - modules = modules ++ [ - { - options.system.nixos.release = lib.mkOption { - type = lib.types.str; - default = lib.trivial.release; - readOnly = true; - }; - - config = { - _module.check = false; - }; - } - ]; - }; - - optionsDoc = nixosOptionsDoc { - options = builtins.removeAttrs evaluated.options [ - "_module" - "system" - ]; - - transformOptions = - opt: - opt - // { - declarations = map ( - declaration: if declarationIsOurs declaration then toGithubDeclaration declaration else declaration - ) opt.declarations; - }; - - documentType = "none"; - revision = version; - }; -in -optionsDoc.optionsCommonMark diff --git a/docs/src/NEWS.md b/docs/src/NEWS.md deleted file mode 120000 index 699cc9e7..00000000 --- a/docs/src/NEWS.md +++ /dev/null @@ -1 +0,0 @@ -../../CHANGELOG.md \ No newline at end of file diff --git a/docs/src/README.md b/docs/src/README.md index e5f763c4..a3acea07 100644 --- a/docs/src/README.md +++ b/docs/src/README.md @@ -6,10 +6,7 @@ Built on top of [NixOS](https://nixos.org) and [home-manager](https://github.com ## What you'll find here -You should first check out our [Getting started](getting-started) guide. Once you're done, you can take a look at all of our available options: - -- [For NixOS](options/nixos-options.md) -- [For home-manager](options/home-manager-options.md) +You should first check out our [Getting started](getting-started) guide. Once you're done, you can [take a look](options.md) at all of our available options. ## Find a problem? diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 4f26eac6..8bdc968a 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -6,9 +6,7 @@ - [Stable Nix](getting-started/stable-nix.md) - [Flakes](getting-started/flakes.md) -- [Module options](options/README.md) - - [NixOS](options/nixos-options.md) - - [home-manager](options/home-manager-options.md) +- [Module options](options.md) - [FAQ](faq.md) diff --git a/docs/src/options.md b/docs/src/options.md new file mode 100644 index 00000000..e493ab79 --- /dev/null +++ b/docs/src/options.md @@ -0,0 +1,8 @@ +# Module Options + +We provide a search engine for the different supported versions of catppuccin/nix: + +- [v1.1](/search/v1.1) +- [rolling](/search/rolling) (`main` branch on GitHub) + +If you have any issues with this documentation, don't hesitate to [open an issue](https://github.com/catppuccin/nix/issues/new). diff --git a/docs/src/options/README.md b/docs/src/options/README.md deleted file mode 100644 index fef2b9d4..00000000 --- a/docs/src/options/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Module Options - -Below is a (searchable) list of all the options in the modules we provide. Enjoy! - -- [NixOS options](nixos-options.md) -- [home-manager options](home-manager-options.md) - -If you have any issues with this documentation, don't hesitate to [open an issue](https://github.com/catppuccin/nix/issues/new).