From 8c3d5783c0c08af1a47e1c05226a221c830d4b5b Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Mon, 1 Jan 2024 15:42:02 +0000 Subject: [PATCH] Switch to nix flakes Signed-off-by: Mary Guillemard --- default.nix | 32 ++++------------------------ flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 48 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/default.nix b/default.nix index 6397437..1ef8a22 100644 --- a/default.nix +++ b/default.nix @@ -1,28 +1,4 @@ -{ pkgs ? (import {})}: -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 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..262f073 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..57c38c0 --- /dev/null +++ b/flake.nix @@ -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; + }); +} +