2
1
Fork 0

build: add nix package

This commit is contained in:
outfoxxed 2024-03-09 06:26:27 -08:00
parent 70989dc619
commit b218d3ec30
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
10 changed files with 161 additions and 12 deletions

4
.gitignore vendored
View file

@ -10,3 +10,7 @@
# hugo # hugo
/.hugo_build.lock /.hugo_build.lock
/public/
# nix
/result

View file

@ -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: clean:
rm -rf public
rm -rf build rm -rf build
rm -rf data/modules/Quickshell rm -rf data/modules/Quickshell
rm -rf content/docs/types/Quickshell rm -rf content/docs/types/Quickshell
@ -7,15 +13,20 @@ clean:
rm -rf data/modules/Quickshell.Wayland rm -rf data/modules/Quickshell.Wayland
rm -rf content/docs/types/Quickshell.Wayland rm -rf content/docs/types/Quickshell.Wayland
typedocs: clean buildtypegen:
cd typegen && cargo build ({{build_typegen}} && cd typegen && cargo build) || true
typedocs: clean buildtypegen
mkdir -p build/types/types mkdir -p build/types/types
./typegen/target/debug/typegen gentypes ../src/core/module.md build/types/types/Quickshell.json {{typegen_bin}} gentypes {{src_path}}/core/module.md build/types/types/Quickshell.json
./typegen/target/debug/typegen gentypes ../src/io/module.md build/types/types/Quickshell.Io.json {{typegen_bin}} gentypes {{src_path}}/io/module.md build/types/types/Quickshell.Io.json
./typegen/target/debug/typegen gentypes ../src/wayland/module.md build/types/types/Quickshell.Wayland.json {{typegen_bin}} gentypes {{src_path}}/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_bin}} gendocs {{src_path}}/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_bin}} gendocs {{src_path}}/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/*' 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 serve: typedocs
hugo server --buildDrafts --disableFastRender hugo server --buildDrafts --disableFastRender
build: typedocs
hugo

View file

@ -7,4 +7,7 @@ Quickshell is a fully user customizable desktop shell based on QtQuick.
{{< cards >}} {{< cards >}}
{{< card link="/docs/configuration" title="Configuration" >}} {{< card link="/docs/configuration" title="Configuration" >}}
{{< card link="/docs/types" title="Type Reference" >}} {{< card link="/docs/types" title="Type Reference" >}}
<br>
{{< card link="https://git.outfoxxed.me/outfoxxed/quickshell-examples" title="Examples" >}}
{{< card link="https://git.outfoxxed.me/outfoxxed/quickshell" title="Source" >}}
{{< /cards >}} {{< /cards >}}

31
default.nix Normal file
View file

@ -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/
'';
}

47
flake.lock Normal file
View file

@ -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
}

25
flake.nix Normal file
View file

@ -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;
});
};
}

View file

@ -1,4 +1,4 @@
baseURL = "https://example.org/" baseURL = "https://quickshell.outfoxxed.me"
languageCode = "en-us" languageCode = "en-us"
title = "Quickshell" title = "Quickshell"
theme = "hextra" theme = "hextra"
@ -12,6 +12,12 @@ enable = true
type = "flexsearch" type = "flexsearch"
flexsearch.index = "content" flexsearch.index = "content"
[params.navbar]
displayLogo = false
[params.page]
width = "wide"
[markup] # required by theme to render properly [markup] # required by theme to render properly
goldmark.renderer.unsafe = true goldmark.renderer.unsafe = true
highlight.noClasses = false highlight.noClasses = false
@ -20,9 +26,13 @@ highlight.noClasses = false
name = "QtQuick Type Reference ↗" name = "QtQuick Type Reference ↗"
url = "https://doc.qt.io/qt-6/qtquick-qmlmodule.html" 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]] [[menu.main]]
name = "Docs" name = "Configuration"
pageRef = "/docs" pageRef = "/docs/configuration"
weight = 1 weight = 1
[[menu.main]] [[menu.main]]
@ -31,6 +41,11 @@ pageRef = "/docs/types"
weight = 2 weight = 2
[[menu.main]] [[menu.main]]
name = "Search" name = "Source ↗"
url = "https://git.outfoxxed.me/outfoxxed/quickshell"
weight = 3 weight = 3
[[menu.main]]
name = "Search"
weight = 4
params.type = "search" params.type = "search"

1
package.nix Normal file
View file

@ -0,0 +1 @@
{ pkgs ? import <nixpkgs> {}, srcpath ? ../src }: pkgs.callPackage ./default.nix { inherit srcpath; }

2
typegen/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target/
/result

10
typegen/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
nix-gitignore,
rustPlatform,
}: rustPlatform.buildRustPackage {
pname = "quickshell-docs-typegen";
version = "0.1.0";
src = nix-gitignore.gitignoreSource [] ./.;
cargoSha256 = "rep68gbnp9uPhzjK7opLg7dh4X2uKNmAPfGUuGjE35w=";
}