Switch to nix flakes

Signed-off-by: Mary Guillemard <mary@mary.zone>
This commit is contained in:
Mary Guillemard 2024-01-01 15:42:02 +00:00
parent 56cfe2c055
commit 8c3d5783c0
3 changed files with 113 additions and 28 deletions

View file

@ -1,28 +1,4 @@
{ pkgs ? (import <nixpkgs> {})}: (import (fetchTarball
with pkgs; "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
let src = builtins.fetchGit ./.;
}).defaultNix
package = buildNpmPackage {
pname = "ryujinx-ldn-website";
version = "1.0.0";
#linkDevDependencies = true;
src = ./.;
npmBuildScript = "release";
npmBuildFlags = [ "--" "--outDir" "dist" ];
installPhase = ''
runHook preInstall
cp -r dist $out/
cp -r public package.json package-lock.json node_modules $out/
makeWrapper '${nodejs}/bin/node' "$out/bin/ryujinx-ldn-website" --add-flags "$out/index.js"
runHook postInstall
'';
npmDepsHash = "sha256-Wo4dGsUAZwXbkuWwTKNA5kv4ZUnekdKm/TagP4Q4Ds8=";
};
in package

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1703992652,
"narHash": "sha256-C0o8AUyu8xYgJ36kOxJfXIroy9if/G6aJbNOpA5W0+M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "32f63574c85fbc80e4ba1fbb932cde9619bad25e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"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
}

48
flake.nix Normal file
View file

@ -0,0 +1,48 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs = { self, nixpkgs, flake-utils }:
let
wesbite_overlay = final: prev: {
ryujinx-ldn-website = with final;
buildNpmPackage {
pname = "ryujinx-ldn-website";
version = "1.0.0";
src = ./.;
npmBuildScript = "release";
npmBuildFlags = [ "--" "--outDir" "dist" ];
installPhase = ''
runHook preInstall
cp -r dist $out/
cp -r public package.json package-lock.json node_modules $out/
makeWrapper '${nodejs}/bin/node' "$out/bin/ryujinx-ldn-website" --add-flags "$out/index.js"
runHook postInstall
'';
npmDepsHash = "sha256-Wo4dGsUAZwXbkuWwTKNA5kv4ZUnekdKm/TagP4Q4Ds8=";
};
};
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays."${system}" ];
};
in {
packages = {
default = self.packages.${system}.ryujinx-ldn-website;
ryujinx-ldn-website = pkgs.ryujinx-ldn-website;
};
overlays = wesbite_overlay;
formatter = pkgs.nixfmt;
});
}