Skip to content

Commit

Permalink
Switch to nix flakes
Browse files Browse the repository at this point in the history
Signed-off-by: Mary Guillemard <mary@mary.zone>
  • Loading branch information
marysaka committed Jan 1, 2024
1 parent 56cfe2c commit 8c3d578
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 28 deletions.
32 changes: 4 additions & 28 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
{ pkgs ? (import <nixpkgs> {})}:
with pkgs;
let

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
(import (fetchTarball
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).defaultNix
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
});
}

0 comments on commit 8c3d578

Please sign in to comment.