build: 🏗️ Add Nix build
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 1s
Deploy to GitHub Pages / build (push) Failing after 1s
Deploy to GitHub Pages / deploy (push) Has been skipped
Docker / build (push) Failing after 0s
Mirror to Codeberg / Mirror (push) Failing after 1s

This commit is contained in:
Jesse Wierzbinski 2025-04-15 15:36:34 +02:00
parent 40bb2cc7dc
commit 5fdf31a717
No known key found for this signature in database
6 changed files with 11118 additions and 0 deletions

3
.gitignore vendored
View file

@ -27,3 +27,6 @@ config
public/emojis
.npmrc
# Nix result
result

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"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"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

57
flake.nix Normal file
View file

@ -0,0 +1,57 @@
{
description = "Versia Frontend";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
...
}:
{
overlays.default = final: prev: {
versia-fe = final.callPackage ./nix/package.nix {};
};
}
// flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
packages = {
inherit (pkgs) versia-fe;
default = self.packages.${system}.versia-fe;
};
})
// flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
devShells = {
default = pkgs.mkShell rec {
libPath = with pkgs;
lib.makeLibraryPath [
stdenv.cc.cc.lib
];
LD_LIBRARY_PATH = "${libPath}";
buildInputs = with pkgs; [
bun
nodejs
vips
pnpm
nodePackages.typescript
nodePackages.typescript-language-server
nix-ld
];
};
};
});
}

65
nix/package.nix Normal file
View file

@ -0,0 +1,65 @@
{
lib,
stdenv,
pnpm,
bun,
nodejs,
makeWrapper,
...
}: let
packageJson = builtins.fromJSON (builtins.readFile ../package.json);
in
stdenv.mkDerivation (finalAttrs: {
pname = packageJson.name;
version = packageJson.version;
src = ../.;
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-NFppXHekesdV9Qg81I7fNjLPTvb3vBz7557a1AGlyOI=";
};
nativeBuildInputs = [
pnpm
pnpm.configHook
bun
nodejs
makeWrapper
];
buildPhase = ''
runHook preBuild
# Disable telemetry, as it crashes the build
export NUXT_TELEMETRY_DISABLED=1
bun run emojis:generate
bun run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r .output/public $out/${finalAttrs.pname}
runHook postInstall
'';
meta = with lib; {
description = packageJson.description;
license = licenses.agpl3Only;
maintainers = [
{
name = "CPlusPatch";
email = "contact@cpluspatch.com";
github = "CPlusPatch";
githubId = 42910258;
matrix = "@jesse:cpluspatch.dev";
}
];
platforms = ["x86_64-linux" "aarch64-linux"];
};
})

View file

@ -1,6 +1,8 @@
{
"name": "versia-fe",
"version": "0.1.0",
"private": true,
"description": " Versia Server frontend, designed with Nuxt.",
"type": "module",
"license": "AGPL-3.0",
"author": {

10930
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff