diff --git a/doc/.vitepress/config.ts b/doc/.vitepress/config.ts index 6aaaa2b..3e589ae 100644 --- a/doc/.vitepress/config.ts +++ b/doc/.vitepress/config.ts @@ -1,6 +1,11 @@ import { defineConfig } from "vitepress"; import pkg from "../package.json"; import markdownItFootnote from "markdown-it-footnote"; +import { + groupIconMdPlugin, + groupIconVitePlugin, + localIconLoader, +} from "vitepress-plugin-group-icons"; // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -74,6 +79,20 @@ export default defineConfig({ markdown: { config: (md) => { md.use(markdownItFootnote); + md.use(groupIconMdPlugin); }, }, + vite: { + plugins: [ + groupIconVitePlugin({ + customIcon: { + nixos: "vscode-icons:file-type-nix", + "configuration.nix": "vscode-icons:file-type-nix", + "module.nix": "vscode-icons:file-type-nix", + home: localIconLoader(import.meta.url, "../assets/homemanager.svg"), + ".conf": "vscode-icons:file-type-config", + }, + }), + ], + }, }); diff --git a/doc/.vitepress/theme/index.ts b/doc/.vitepress/theme/index.ts new file mode 100644 index 0000000..f789161 --- /dev/null +++ b/doc/.vitepress/theme/index.ts @@ -0,0 +1,5 @@ +// .vitepress/theme/index.ts +import Theme from "vitepress/theme"; +import "virtual:group-icons.css"; + +export default Theme; diff --git a/doc/assets/homemanager.svg b/doc/assets/homemanager.svg new file mode 100644 index 0000000..852c6f6 --- /dev/null +++ b/doc/assets/homemanager.svg @@ -0,0 +1 @@ + diff --git a/doc/guide/getting-started.md b/doc/guide/getting-started.md index 2f1b874..f781e6c 100644 --- a/doc/guide/getting-started.md +++ b/doc/guide/getting-started.md @@ -1,3 +1,29 @@ -# Getting Started +--- +comment: true +title: Getting Started +description: Getting started with Wire Tool! +--- -golf2 +# {{ $frontmatter.title }} + +## Installation + +Wire can be heavy to compile. You should enable the substituter `wires.cachix.org`. + +::: code-group + +<<< @/snippets/getting-started/cache.nix [module.nix] +<<< @/snippets/getting-started/nix.conf + +::: + +### NixOS / Home Manager + +::: code-group + +<<< @/snippets/getting-started/nixos.flake.nix [flake.nix (NixOS)] +<<< @/snippets/getting-started/hm.flake.nix [flake.nix (Home Manager)] +<<< @/snippets/getting-started/configuration.nix +<<< @/snippets/getting-started/home.nix + +::: diff --git a/doc/package.json b/doc/package.json index 068829f..4a09964 100644 --- a/doc/package.json +++ b/doc/package.json @@ -16,6 +16,7 @@ ] }, "dependencies": { - "markdown-it-footnote": "^4.0.0" + "markdown-it-footnote": "^4.0.0", + "vitepress-plugin-group-icons": "^1.3.8" } } diff --git a/doc/package.nix b/doc/package.nix index c627f48..0b8f54d 100644 --- a/doc/package.nix +++ b/doc/package.nix @@ -3,6 +3,7 @@ nixosOptionsDoc, runCommand, wire, + nix, nodejs, pnpm, stdenv, @@ -43,11 +44,12 @@ stdenv.mkDerivation (finalAttrs: { wire nodejs pnpm.configHook + nix ]; src = ./.; pnpmDeps = pnpm.fetchDeps { inherit (finalAttrs) pname version src; - hash = "sha256-7ThshGf9tkCwSaz4DMTXxmjhN+2g0dErgzpgzJ2gv8Y"; + hash = "sha256-QSk2+o8gMNWfpBgjKeW5DBrso9zGcbP06Ga2hK8df5A="; }; patchPhase = '' cat ${optionsDoc} >> ./reference/module.md @@ -55,5 +57,9 @@ stdenv.mkDerivation (finalAttrs: { ''; buildPhase = "pnpm run build > build.log 2>&1"; installPhase = "cp .vitepress/dist -r $out"; + doCheck = true; + checkPhase = '' + nix-instantiate --eval --strict ./snippets > /dev/null + ''; DEBUG = "*"; }) diff --git a/doc/pnpm-lock.yaml b/doc/pnpm-lock.yaml index 2ce0886..202236a 100644 --- a/doc/pnpm-lock.yaml +++ b/doc/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: markdown-it-footnote: specifier: ^4.0.0 version: 4.0.0 + vitepress-plugin-group-icons: + specifier: ^1.3.8 + version: 1.3.8 devDependencies: vitepress: specifier: ^1.6.3 @@ -90,6 +93,12 @@ packages: resolution: {integrity: sha512-XXHbq2heOZc9EFCc4z+uyHS9YRBygZbYQVsWjWZWx8hdAz+tkBX/jLHM9Xg+3zO0/v8JN6pcZzqYEVsdrLeNLg==} engines: {node: '>= 14.0.0'} + '@antfu/install-pkg@1.0.0': + resolution: {integrity: sha512-xvX6P/lo1B3ej0OsaErAjqgFYzYVcJpamjLAFLYh9vRJngBrMoUG7aVnrGTeqM7yxbyTD5p3F2+0/QUEh8Vzhw==} + + '@antfu/utils@8.1.1': + resolution: {integrity: sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==} + '@babel/helper-string-parser@7.25.9': resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} engines: {node: '>=6.9.0'} @@ -268,12 +277,21 @@ packages: cpu: [x64] os: [win32] + '@iconify-json/logos@1.2.4': + resolution: {integrity: sha512-XC4If5D/hbaZvUkTV8iaZuGlQCyG6CNOlaAaJaGa13V5QMYwYjgtKk3vPP8wz3wtTVNVEVk3LRx1fOJz+YnSMw==} + '@iconify-json/simple-icons@1.2.29': resolution: {integrity: sha512-KYrxmxtRz6iOAulRiUsIBMUuXek+H+Evwf8UvYPIkbQ+KDoOqTegHx3q/w3GDDVC0qJYB+D3hXPMZcpm78qIuA==} + '@iconify-json/vscode-icons@1.2.17': + resolution: {integrity: sha512-7ge4lTxBMpxEE8SGZ3ytjsLOWEip35B+6HJIKPep8gnoqZHTTT5bYDNDkx3iSganyaTviOvBuarzz5Z7Rg62Iw==} + '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} + '@iconify/utils@2.3.0': + resolution: {integrity: sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==} + '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} @@ -523,6 +541,11 @@ packages: '@vueuse/shared@12.8.2': resolution: {integrity: sha512-dznP38YzxZoNloI0qpEfpkms8knDtaoQ6Y/sfS0L7Yki4zh40LFHEhur0odJC6xTHG5dxWVPiUWBXn+wCG2s5w==} + acorn@8.14.1: + resolution: {integrity: sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==} + engines: {node: '>=0.4.0'} + hasBin: true + algoliasearch@5.23.0: resolution: {integrity: sha512-7TCj+hLx6fZKppLL74lYGDEltSBNSu4vqRwgqeIKZ3VQ0q3aOrdEN0f1sDWcvU1b+psn2wnl7aHt9hWtYatUUA==} engines: {node: '>= 14.0.0'} @@ -542,6 +565,12 @@ packages: comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} + + confbox@0.2.1: + resolution: {integrity: sha512-hkT3yDPFbs95mNCy1+7qNKC6Pro+/ibzYxtM2iqEigpf0sVw+bg4Zh9/snjsBcf990vfIsg5+1U7VyiyBb3etg==} + copy-anything@3.0.5: resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} engines: {node: '>=12.13'} @@ -549,6 +578,15 @@ packages: csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -571,6 +609,9 @@ packages: estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + exsolve@1.0.4: + resolution: {integrity: sha512-xsZH6PXaER4XoV+NiT7JHp1bJodJVT+cxeSH1G0f0tlT0lJqYuHUP3bUx2HtfTDvOagMINYp8rsqusxud3RXhw==} + focus-trap@7.6.4: resolution: {integrity: sha512-xx560wGBk7seZ6y933idtjJQc1l+ck+pI3sKvhKozdBV1dRZoKhkW5xoCaFv9tQiX5RH1xfSxjuNu6g+lmN/gw==} @@ -579,6 +620,10 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + globals@15.15.0: + resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} + engines: {node: '>=18'} + hast-util-to-html@9.0.5: resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==} @@ -595,6 +640,13 @@ packages: resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} engines: {node: '>=12.13'} + kolorist@1.8.0: + resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + + local-pkg@1.1.1: + resolution: {integrity: sha512-WunYko2W1NcdfAFpuLUoucsgULmgDBRkdxHxWQ7mK0cQqwPiy8E1enjuRBrhLtZkB5iScJ1XIPdhVEFK8aOLSg==} + engines: {node: '>=14'} + magic-string@0.30.17: resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} @@ -628,6 +680,12 @@ packages: mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} + mlly@1.7.4: + resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + nanoid@3.3.11: resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -636,12 +694,24 @@ packages: oniguruma-to-es@3.1.1: resolution: {integrity: sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ==} + package-manager-detector@0.2.11: + resolution: {integrity: sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + pkg-types@1.3.1: + resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} + + pkg-types@2.1.0: + resolution: {integrity: sha512-wmJwA+8ihJixSoHKxZJRBQG1oY8Yr9pGLzRmSsNms0iNWyHHAlZCa7mmKiFR10YPZuz/2k169JiS/inOjBCZ2A==} + postcss@8.5.3: resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} @@ -652,6 +722,9 @@ packages: property-information@7.0.0: resolution: {integrity: sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==} + quansync@0.2.10: + resolution: {integrity: sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==} + regex-recursion@6.0.2: resolution: {integrity: sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==} @@ -696,9 +769,15 @@ packages: tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + ufo@1.5.4: + resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} + unist-util-is@6.0.0: resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} @@ -751,6 +830,9 @@ packages: terser: optional: true + vitepress-plugin-group-icons@1.3.8: + resolution: {integrity: sha512-BIx1HgXEvbDeJX8NqVvthWHQqEW2slj1SkAWLMNoUR5IJq1dq6LmrURYCyznMJCB3/0g+YY89ifvQp3in1fX3g==} + vitepress@1.6.3: resolution: {integrity: sha512-fCkfdOk8yRZT8GD9BFqusW3+GggWYZ/rYncOfmgcDtP3ualNHCAg+Robxp2/6xfH1WwPHtGpPwv7mbA3qomtBw==} hasBin: true @@ -881,6 +963,13 @@ snapshots: dependencies: '@algolia/client-common': 5.23.0 + '@antfu/install-pkg@1.0.0': + dependencies: + package-manager-detector: 0.2.11 + tinyexec: 0.3.2 + + '@antfu/utils@8.1.1': {} + '@babel/helper-string-parser@7.25.9': {} '@babel/helper-validator-identifier@7.25.9': {} @@ -987,12 +1076,33 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true + '@iconify-json/logos@1.2.4': + dependencies: + '@iconify/types': 2.0.0 + '@iconify-json/simple-icons@1.2.29': dependencies: '@iconify/types': 2.0.0 + '@iconify-json/vscode-icons@1.2.17': + dependencies: + '@iconify/types': 2.0.0 + '@iconify/types@2.0.0': {} + '@iconify/utils@2.3.0': + dependencies: + '@antfu/install-pkg': 1.0.0 + '@antfu/utils': 8.1.1 + '@iconify/types': 2.0.0 + debug: 4.4.0 + globals: 15.15.0 + kolorist: 1.8.0 + local-pkg: 1.1.1 + mlly: 1.7.4 + transitivePeerDependencies: + - supports-color + '@jridgewell/sourcemap-codec@1.5.0': {} '@rollup/rollup-android-arm-eabi@4.37.0': @@ -1224,6 +1334,8 @@ snapshots: transitivePeerDependencies: - typescript + acorn@8.14.1: {} + algoliasearch@5.23.0: dependencies: '@algolia/client-abtesting': 5.23.0 @@ -1250,12 +1362,20 @@ snapshots: comma-separated-tokens@2.0.3: {} + confbox@0.1.8: {} + + confbox@0.2.1: {} + copy-anything@3.0.5: dependencies: is-what: 4.1.16 csstype@3.1.3: {} + debug@4.4.0: + dependencies: + ms: 2.1.3 + dequal@2.0.3: {} devlop@1.1.0: @@ -1294,6 +1414,8 @@ snapshots: estree-walker@2.0.2: {} + exsolve@1.0.4: {} + focus-trap@7.6.4: dependencies: tabbable: 6.2.0 @@ -1301,6 +1423,8 @@ snapshots: fsevents@2.3.3: optional: true + globals@15.15.0: {} + hast-util-to-html@9.0.5: dependencies: '@types/hast': 3.0.4 @@ -1325,6 +1449,14 @@ snapshots: is-what@4.1.16: {} + kolorist@1.8.0: {} + + local-pkg@1.1.1: + dependencies: + mlly: 1.7.4 + pkg-types: 2.1.0 + quansync: 0.2.10 + magic-string@0.30.17: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -1366,6 +1498,15 @@ snapshots: mitt@3.0.1: {} + mlly@1.7.4: + dependencies: + acorn: 8.14.1 + pathe: 2.0.3 + pkg-types: 1.3.1 + ufo: 1.5.4 + + ms@2.1.3: {} + nanoid@3.3.11: {} oniguruma-to-es@3.1.1: @@ -1374,10 +1515,28 @@ snapshots: regex: 6.0.1 regex-recursion: 6.0.2 + package-manager-detector@0.2.11: + dependencies: + quansync: 0.2.10 + + pathe@2.0.3: {} + perfect-debounce@1.0.0: {} picocolors@1.1.1: {} + pkg-types@1.3.1: + dependencies: + confbox: 0.1.8 + mlly: 1.7.4 + pathe: 2.0.3 + + pkg-types@2.1.0: + dependencies: + confbox: 0.2.1 + exsolve: 1.0.4 + pathe: 2.0.3 + postcss@8.5.3: dependencies: nanoid: 3.3.11 @@ -1388,6 +1547,8 @@ snapshots: property-information@7.0.0: {} + quansync@0.2.10: {} + regex-recursion@6.0.2: dependencies: regex-utilities: 2.3.0 @@ -1456,8 +1617,12 @@ snapshots: tabbable@6.2.0: {} + tinyexec@0.3.2: {} + trim-lines@3.0.1: {} + ufo@1.5.4: {} + unist-util-is@6.0.0: dependencies: '@types/unist': 3.0.3 @@ -1499,6 +1664,14 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + vitepress-plugin-group-icons@1.3.8: + dependencies: + '@iconify-json/logos': 1.2.4 + '@iconify-json/vscode-icons': 1.2.17 + '@iconify/utils': 2.3.0 + transitivePeerDependencies: + - supports-color + vitepress@1.6.3(@algolia/client-search@5.23.0)(postcss@8.5.3)(search-insights@2.17.3): dependencies: '@docsearch/css': 3.8.2 diff --git a/doc/snippets/default.nix b/doc/snippets/default.nix new file mode 100644 index 0000000..6136b88 --- /dev/null +++ b/doc/snippets/default.nix @@ -0,0 +1,7 @@ +{ + getting-started-hm = import ./getting-started/home.nix; + getting-started-hm-flake = import ./getting-started/hm.flake.nix; + getting-started-nixos = import ./getting-started/configuration.nix; + getting-started-nixos-flake = import ./getting-started/nixos.flake.nix; + getting-started-cache = import ./getting-started/cache.nix; +} diff --git a/doc/snippets/getting-started/cache.nix b/doc/snippets/getting-started/cache.nix new file mode 100644 index 0000000..52b9abd --- /dev/null +++ b/doc/snippets/getting-started/cache.nix @@ -0,0 +1,12 @@ +{ + nix.settings = { + substituters = [ + "https://wires.cachix.org" + # ... + ]; + trusted-public-keys = [ + "wires.cachix.org-1:7XQoG91Bh+Aj01mAJi77Ui5AYyM1uEyV0h1wOomqjpk=" + # ... + ]; + }; +} diff --git a/doc/snippets/getting-started/configuration.nix b/doc/snippets/getting-started/configuration.nix new file mode 100644 index 0000000..c7b3483 --- /dev/null +++ b/doc/snippets/getting-started/configuration.nix @@ -0,0 +1,11 @@ +{system, ...}: let + wire = import ( # [!code ++] + builtins.fetchTarball "https://github.com/wires-org/wire/archive/refs/heads/main.tar.gz" # [!code ++] + ); # [!code ++] +in { + environment.systemPackages = [ + wire.packages.${system}.wire # [!code ++] + ]; + + # ... +} diff --git a/doc/snippets/getting-started/hm.flake.nix b/doc/snippets/getting-started/hm.flake.nix new file mode 100644 index 0000000..7c60eef --- /dev/null +++ b/doc/snippets/getting-started/hm.flake.nix @@ -0,0 +1,34 @@ +{ + inputs = { + # ... + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + wire.url = "github:wires-org/wire"; # [!code ++] + }; + + outputs = { + # ... + nixpkgs, + home-manager, + wire, # [!code ++] + ... + }: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + homeConfigurations.my-user = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + # ... + { + home.packages = [ + wire.packages.${system}.wire # [!code ++] + ]; + } + ]; + }; + }; +} diff --git a/doc/snippets/getting-started/home.nix b/doc/snippets/getting-started/home.nix new file mode 100644 index 0000000..838bb22 --- /dev/null +++ b/doc/snippets/getting-started/home.nix @@ -0,0 +1,11 @@ +{system, ...}: let + wire = import ( # [!code ++] + builtins.fetchTarball "https://github.com/wires-org/wire/archive/refs/heads/main.tar.gz" # [!code ++] + ); # [!code ++] +in { + home.packages = [ + wire.packages.${system}.wire # [!code ++] + ]; + + # ... +} diff --git a/doc/snippets/getting-started/nix.conf b/doc/snippets/getting-started/nix.conf new file mode 100644 index 0000000..c0a8db4 --- /dev/null +++ b/doc/snippets/getting-started/nix.conf @@ -0,0 +1,2 @@ +substituters = https://wires.cachix.org +trusted-public-keys = wires.cachix.org-1:7XQoG91Bh+Aj01mAJi77Ui5AYyM1uEyV0h1wOomqjpk= \ No newline at end of file diff --git a/doc/snippets/getting-started/nixos.flake.nix b/doc/snippets/getting-started/nixos.flake.nix new file mode 100644 index 0000000..2873e9d --- /dev/null +++ b/doc/snippets/getting-started/nixos.flake.nix @@ -0,0 +1,29 @@ +{ + inputs = { + # ... + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + wire.url = "github:wires-org/wire"; # [!code ++] + }; + + outputs = inputs @ { + # ... + nixpkgs, + wire, # [!code ++] + ... + }: { + nixosConfigurations.my-system = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = [ + # ... + ( + {system, ...}: { + environment.systemPackages = [ + wire.packages.${system}.wire # [!code ++] + ]; + } + ) + ]; + }; + }; +} diff --git a/flake.nix b/flake.nix index cbac645..4a244c6 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,7 @@ pkgs, inputs', config, + lib, ... }: { @@ -49,13 +50,20 @@ programs = { # rfc style nixfmt.enable = true; - + # docs only + alejandra.enable = true; rustfmt.enable = true; just.enable = true; prettier.enable = true; protolint.enable = true; taplo.enable = true; }; + settings.formatter = { + nixfmt.excludes = [ "doc/snippets/*.nix" ]; + alejandra = { + includes = lib.mkForce [ "doc/snippets/*.nix" ]; + }; + }; }; }; };