From eeddc85c71acf44a998e485bc2edc1389d4f48c6 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 25 Jun 2023 08:29:46 +0200 Subject: [PATCH] move fetchers to lib now 'nix flake show' works --- .envrc | 1 + flake.nix | 93 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 48 insertions(+), 46 deletions(-) diff --git a/.envrc b/.envrc index 68cd078..2f48800 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,3 @@ #!/usr/bin/env bash export NIX_CONFIG='builders = ' +export NIXPKGS_ALLOW_UNFREE=1 diff --git a/flake.nix b/flake.nix index a2a51bc..8ec309f 100644 --- a/flake.nix +++ b/flake.nix @@ -10,65 +10,66 @@ erosanix, ... } @ inputs: - { + let + systems = nixpkgs.lib.systems.flakeExposed; + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f rec { + inherit system; + inherit (nixpkgs.legacyPackages.${system}) pkgs lib; + }); + in nixpkgs.lib.recursiveUpdate { - packages.x86_64-linux = with nixpkgs.legacyPackages.x86_64-linux; rec { + lib = forAllSystems ({ pkgs, system, ... }: pkgs.callPackage ./pkgs/fetchers.nix { + inherit (self.packages.${system}) badown mediafire-dl; + }); - badown = callPackage ./pkgs/badown.nix {}; - mediafire-dl = python3Packages.callPackage ./pkgs/mediafire-dl.nix {}; + packages = forAllSystems ({ pkgs, ... }: { + badown = pkgs.callPackage ./pkgs/badown.nix {}; + mediafire-dl = pkgs.python3Packages.callPackage ./pkgs/mediafire-dl.nix {}; + }); - inherit (callPackage ./pkgs/fetchers.nix { inherit badown mediafire-dl; }) - fetchFromDrive - fetchFromMega - fetchFromMediafire; + }{ + # mkWindowsApp resources: + # - https://github.com/emmanuelrosa/erosanix/tree/master/pkgs/mkwindowsapp + # - https://github.com/emmanuelrosa/sumatrapdf-nix/blob/master/sumatrapdf.nix - pokemon = let - callPackage = newScope (erosanix.lib.x86_64-linux // { - wine = wineWowPackages.full; - wineArch = "win64"; - inherit - fetchFromDrive - fetchFromMega - fetchFromMediafire; - }); - in { - - # mkWindowsApp resources: - # - https://github.com/emmanuelrosa/erosanix/tree/master/pkgs/mkwindowsapp - # - https://github.com/emmanuelrosa/sumatrapdf-nix/blob/master/sumatrapdf.nix - - infinite-fusion = callPackage ./games/infinite-fusion.nix { - legacy-version = false; - }; - - infinite-fusion-legacy = callPackage ./games/infinite-fusion.nix { - legacy-version = true; - wine = winePackages.full; - wineArch = "win32"; - }; - - project-untamed = callPackage ./games/project-untamed.nix { }; - - uranium = callPackage ./games/uranium.nix { wine = winePackages.full; wineArch = "win32"; }; - - clockwork = callPackage ./games/clockwork.nix { wine = winePackages.full; wineArch = "win32"; }; + packages.x86_64-linux = with nixpkgs.legacyPackages.x86_64-linux; let + callPackage = newScope ( + { wine = wineWowPackages.full; wineArch = "win64"; } + // self.lib.x86_64-linux + // erosanix.lib.x86_64-linux + ); + in rec { + pokemon-infinite-fusion = callPackage ./games/infinite-fusion.nix { + legacy-version = false; }; + pokemon-infinite-fusion-legacy = callPackage ./games/infinite-fusion.nix { + legacy-version = true; + wine = winePackages.full; + wineArch = "win32"; + }; + + pokemon-project-untamed = callPackage ./games/project-untamed.nix { }; + + + pokemon-uranium = callPackage ./games/uranium.nix { wine = winePackages.full; wineArch = "win32"; }; + + pokemon-clockwork = callPackage ./games/clockwork.nix { wine = winePackages.full; wineArch = "win32"; }; + + + + + + + }; - # garbage-collect + # a mkWindowsApp garbage-collect tool apps.x86_64-linux.gc = { type = "app"; program = "${erosanix.packages.x86_64-linux.mkwindowsapp-tools}/bin/mkwindows-tools-gc"; }; - lib.x86_64-linux = { - inherit (self.packages.x86_64-linux) - fetchFromDrive - fetchFromMega - fetchFromMediafire; - }; - }; }