feat: Add nix package
We've used snowfall here to simplify writing our flake, as well as to make it use a similar structure to auxolotl/website BREAKING-CHANGE: This replaces bun with nodejs, as buildNpmPackage cannot take a bun.lockb
This commit is contained in:
parent
deb10f1ed1
commit
295db9c69c
128
flake.lock
128
flake.lock
|
@ -1,5 +1,21 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1650374568,
|
||||||
|
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
|
@ -18,23 +34,86 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"flake-utils-plus": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_2"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713248628,
|
"lastModified": 1696331477,
|
||||||
"narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=",
|
"narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=",
|
||||||
"path": "/nix/store/3kwj19dbdfxnjbcns4hw307ylhz3wgrm-source",
|
"owner": "gytis-ivaskevicius",
|
||||||
"rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8",
|
"repo": "flake-utils-plus",
|
||||||
"type": "path"
|
"rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3",
|
||||||
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "gytis-ivaskevicius",
|
||||||
"type": "indirect"
|
"repo": "flake-utils-plus",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1694529238,
|
||||||
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715787315,
|
||||||
|
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"snowfall-lib": "snowfall-lib",
|
||||||
|
"wiki": "wiki"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"snowfall-lib": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils-plus": "flake-utils-plus",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715107207,
|
||||||
|
"narHash": "sha256-Lq38yoHyY8t+zkVdpYlr2Fonb89Id4o5zgIfz8KCB8Y=",
|
||||||
|
"owner": "snowfallorg",
|
||||||
|
"repo": "lib",
|
||||||
|
"rev": "299b24861ebfa98a5b586dfa9ec8138ab6a4c626",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "snowfallorg",
|
||||||
|
"repo": "lib",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
@ -51,6 +130,37 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wiki": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715898404,
|
||||||
|
"narHash": "sha256-2etxkOw7LGoKB9w9/ZGUQK+MKasDj5gMGWF6CZjFj0M=",
|
||||||
|
"owner": "auxolotl",
|
||||||
|
"repo": "wiki",
|
||||||
|
"rev": "79717a98d2b429fc679b90146d2d8e8067cea34a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "auxolotl",
|
||||||
|
"repo": "wiki",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
38
flake.nix
38
flake.nix
|
@ -1,17 +1,31 @@
|
||||||
{
|
{
|
||||||
description = "A Clicks project";
|
description = "A documentation browser for Auxolotl";
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
inputs.snowfall-lib = {
|
||||||
|
url = "github:snowfallorg/lib";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
inputs.wiki = {
|
||||||
|
url = "github:auxolotl/wiki";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{ nixpkgs, flake-utils, ... }:
|
inputs:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
inputs.snowfall-lib.mkFlake {
|
||||||
system:
|
inherit inputs;
|
||||||
let
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
src = ./.;
|
||||||
in
|
|
||||||
{
|
alias.packages.default = "docs-site";
|
||||||
devShells.default = pkgs.mkShell { packages = [ pkgs.bun ]; };
|
|
||||||
formatter = pkgs.nixfmt;
|
snowfall = {
|
||||||
}
|
root = ./nix;
|
||||||
);
|
namespace = "auxolotl--docs-site";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs-builder = channels: { formatter = channels.nixpkgs.nixfmt-rfc-style; };
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
31
nix/packages/docs-site/default.nix
Normal file
31
nix/packages/docs-site/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
writeScriptBin,
|
||||||
|
buildNpmPackage,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
json = lib.importJSON (lib.snowfall.fs.get-file "package.json");
|
||||||
|
in
|
||||||
|
buildNpmPackage {
|
||||||
|
pname = "aux-website";
|
||||||
|
inherit (json) version;
|
||||||
|
|
||||||
|
src = lib.snowfall.fs.get-file "/";
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-0j7m82hgronEuNFT0D/G21EXr/VGAF5zLIiDbDvT4Ek=";
|
||||||
|
|
||||||
|
npmFlags = [ "--ignore-scripts" ];
|
||||||
|
|
||||||
|
postUnpack = ''
|
||||||
|
mkdir -p $sourceRoot/src/content
|
||||||
|
cp -r ${inputs.wiki} $sourceRoot/src/content/wiki
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
|
||||||
|
cp -r ./dist/* $out/
|
||||||
|
'';
|
||||||
|
}
|
1
nix/shells/default/default.nix
Normal file
1
nix/shells/default/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ mkShell, nodejs_20 }: mkShell { packages = [ nodejs_20 ]; }
|
7380
package-lock.json
generated
Normal file
7380
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue