From b218d3ec30f8ff2c51d4caf17509b9d21cf0c088 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 9 Mar 2024 06:26:27 -0800 Subject: [PATCH] build: add nix package --- .gitignore | 4 ++++ Justfile | 27 ++++++++++++++++++-------- content/_index.md | 3 +++ default.nix | 31 ++++++++++++++++++++++++++++++ flake.lock | 47 +++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 ++++++++++++++++++++++++ hugo.toml | 23 ++++++++++++++++++---- package.nix | 1 + typegen/.gitignore | 2 ++ typegen/default.nix | 10 ++++++++++ 10 files changed, 161 insertions(+), 12 deletions(-) create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 package.nix create mode 100644 typegen/.gitignore create mode 100644 typegen/default.nix diff --git a/.gitignore b/.gitignore index 02901a7..31fa04a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,7 @@ # hugo /.hugo_build.lock +/public/ + +# nix +/result diff --git a/Justfile b/Justfile index 6999994..04302e6 100644 --- a/Justfile +++ b/Justfile @@ -1,4 +1,10 @@ +typegen_bin := env_var_or_default('TYPEGEN', './typegen/target/debug/typegen') +src_path := env_var_or_default('SRC_PATH', '../src') + +build_typegen := if typegen_bin == './typegen/target/debug/typegen' { "true" } else { "false" } + clean: + rm -rf public rm -rf build rm -rf data/modules/Quickshell rm -rf content/docs/types/Quickshell @@ -7,15 +13,20 @@ clean: rm -rf data/modules/Quickshell.Wayland rm -rf content/docs/types/Quickshell.Wayland -typedocs: clean - cd typegen && cargo build +buildtypegen: + ({{build_typegen}} && cd typegen && cargo build) || true + +typedocs: clean buildtypegen mkdir -p build/types/types - ./typegen/target/debug/typegen gentypes ../src/core/module.md build/types/types/Quickshell.json - ./typegen/target/debug/typegen gentypes ../src/io/module.md build/types/types/Quickshell.Io.json - ./typegen/target/debug/typegen gentypes ../src/wayland/module.md build/types/types/Quickshell.Wayland.json - sh -c './typegen/target/debug/typegen gendocs ../src/core/module.md data/modules/Quickshell content/docs/types/Quickshell types/* build/types/types/*' - sh -c './typegen/target/debug/typegen gendocs ../src/io/module.md data/modules/Quickshell.Io content/docs/types/Quickshell.Io types/* build/types/types/*' - sh -c './typegen/target/debug/typegen gendocs ../src/wayland/module.md data/modules/Quickshell.Wayland content/docs/types/Quickshell.Wayland types/* build/types/types/*' + {{typegen_bin}} gentypes {{src_path}}/core/module.md build/types/types/Quickshell.json + {{typegen_bin}} gentypes {{src_path}}/io/module.md build/types/types/Quickshell.Io.json + {{typegen_bin}} gentypes {{src_path}}/wayland/module.md build/types/types/Quickshell.Wayland.json + sh -c '{{typegen_bin}} gendocs {{src_path}}/core/module.md data/modules/Quickshell content/docs/types/Quickshell types/* build/types/types/*' + sh -c '{{typegen_bin}} gendocs {{src_path}}/io/module.md data/modules/Quickshell.Io content/docs/types/Quickshell.Io types/* build/types/types/*' + sh -c '{{typegen_bin}} gendocs {{src_path}}/wayland/module.md data/modules/Quickshell.Wayland content/docs/types/Quickshell.Wayland types/* build/types/types/*' serve: typedocs hugo server --buildDrafts --disableFastRender + +build: typedocs + hugo diff --git a/content/_index.md b/content/_index.md index 0707788..0e6efd2 100644 --- a/content/_index.md +++ b/content/_index.md @@ -7,4 +7,7 @@ Quickshell is a fully user customizable desktop shell based on QtQuick. {{< cards >}} {{< card link="/docs/configuration" title="Configuration" >}} {{< card link="/docs/types" title="Type Reference" >}} +
+ {{< card link="https://git.outfoxxed.me/outfoxxed/quickshell-examples" title="Examples" >}} + {{< card link="https://git.outfoxxed.me/outfoxxed/quickshell" title="Source" >}} {{< /cards >}} diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..9c8a24a --- /dev/null +++ b/default.nix @@ -0,0 +1,31 @@ +{ + stdenv, + nix-gitignore, + hugo, + cargo, + just, + + callPackage, + typegen ? (callPackage ./typegen {}), + + srcpath ? ../src, +}: stdenv.mkDerivation { + name = "quickshell-docs"; + version = "0.1.0"; + src = nix-gitignore.gitignoreSource "/typegen\n" ./.; + + buildInputs = [ + just + hugo + typegen + ]; + + buildPhase = '' + SRC_PATH="${srcpath}" TYPEGEN=typegen just build + ''; + + installPhase = '' + mkdir -p $out + cp -r ./public/* $out/ + ''; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..488c12c --- /dev/null +++ b/flake.lock @@ -0,0 +1,47 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1709703039, + "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "quickshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709989609, + "narHash": "sha256-l6RQfXuE7XL2VQUq1Fja5NESPo0PuhFKZp2X1C9CFBk=", + "ref": "refs/heads/master", + "rev": "5f9bb9b46c1435777f9782f09f077ebc3ef222c9", + "revCount": 104, + "type": "git", + "url": "https://git.outfoxxed.me/outfoxxed/quickshell" + }, + "original": { + "type": "git", + "url": "https://git.outfoxxed.me/outfoxxed/quickshell" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "quickshell": "quickshell" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..88aff80 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + + quickshell = { + url = "git+https://git.outfoxxed.me/outfoxxed/quickshell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, quickshell }: let + forEachSystem = fn: nixpkgs.lib.genAttrs + [ "x86_64-linux" "aarch64-linux" ] + (system: fn system nixpkgs.legacyPackages.${system}); + in { + packages = forEachSystem (system: pkgs: rec { + quickshell-docs = import ./package.nix { + inherit pkgs; + srcpath = "${quickshell}/src"; + }; + + default = quickshell-docs; + }); + }; +} diff --git a/hugo.toml b/hugo.toml index 4404b42..cca9271 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,4 +1,4 @@ -baseURL = "https://example.org/" +baseURL = "https://quickshell.outfoxxed.me" languageCode = "en-us" title = "Quickshell" theme = "hextra" @@ -12,6 +12,12 @@ enable = true type = "flexsearch" flexsearch.index = "content" +[params.navbar] +displayLogo = false + +[params.page] +width = "wide" + [markup] # required by theme to render properly goldmark.renderer.unsafe = true highlight.noClasses = false @@ -20,9 +26,13 @@ highlight.noClasses = false name = "QtQuick Type Reference ↗" url = "https://doc.qt.io/qt-6/qtquick-qmlmodule.html" +[[menu.sidebar]] +name = "Quickshell Examples ↗" +url = "https://git.outfoxxed.me/outfoxxed/quickshell-examples" + [[menu.main]] -name = "Docs" -pageRef = "/docs" +name = "Configuration" +pageRef = "/docs/configuration" weight = 1 [[menu.main]] @@ -31,6 +41,11 @@ pageRef = "/docs/types" weight = 2 [[menu.main]] -name = "Search" +name = "Source ↗" +url = "https://git.outfoxxed.me/outfoxxed/quickshell" weight = 3 + +[[menu.main]] +name = "Search" +weight = 4 params.type = "search" diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..38904cd --- /dev/null +++ b/package.nix @@ -0,0 +1 @@ +{ pkgs ? import {}, srcpath ? ../src }: pkgs.callPackage ./default.nix { inherit srcpath; } diff --git a/typegen/.gitignore b/typegen/.gitignore new file mode 100644 index 0000000..62781db --- /dev/null +++ b/typegen/.gitignore @@ -0,0 +1,2 @@ +/target/ +/result diff --git a/typegen/default.nix b/typegen/default.nix new file mode 100644 index 0000000..0947059 --- /dev/null +++ b/typegen/default.nix @@ -0,0 +1,10 @@ +{ + nix-gitignore, + rustPlatform, +}: rustPlatform.buildRustPackage { + pname = "quickshell-docs-typegen"; + version = "0.1.0"; + + src = nix-gitignore.gitignoreSource [] ./.; + cargoSha256 = "rep68gbnp9uPhzjK7opLg7dh4X2uKNmAPfGUuGjE35w="; +}