feat: added flake

This commit is contained in:
Luka Dekanozishvili 2026-01-28 22:13:06 +01:00
parent 5c78528f4c
commit f77d930cf9
2 changed files with 90 additions and 2 deletions

88
flake.nix Normal file
View file

@ -0,0 +1,88 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, gitignore, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
packageJSON = lib.importJSON ./package.json;
gitignoreSource = gitignore.lib.gitignoreSource;
pname = packageJSON.name;
version = packageJSON.version;
src = gitignoreSource ./.;
in
{
packages = rec {
hexname-frontend = pkgs.stdenv.mkDerivation {
inherit pname version src;
nativeBuildInputs = [
pkgs.deno
# pkgs.nodejs
];
# Deno wants a writable cache
DENO_DIR = "$TMPDIR/deno";
# Ensure reproducibility
DENO_NO_UPDATE_CHECK = "1";
DENO_NO_PROMPT = "1";
buildPhase = ''
runHook preBuild
export HOME=$TMPDIR
# Cache all deps first (offline build safety)
deno cache --lock=deno.lock --frozen-lockfile \
./vite.config.ts
# SvelteKit build
deno task build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r build $out/
cp -r .svelte-kit $out/ || true
cp package.json $out/
runHook postInstall
'';
# No runtime deps
dontFixup = true;
};
default = hexname-frontend;
};
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.deno
# pkgs.nodejs
];
DENO_DIR = ".deno";
DENO_NO_UPDATE_CHECK = "1";
};
}
);
}

View file

@ -1,7 +1,7 @@
{
"name": "dns-frontend",
"name": "hexname-frontend",
"private": true,
"version": "0.0.1",
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite dev",