From d8d2ac4c3eb87c0eb1718dcdbd8950223227b44d Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 25 Jan 2024 10:59:03 -0600 Subject: [PATCH] even simpler implementation --- lib/default.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index f794bec..571fc88 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -7,19 +7,14 @@ inherit (nixpkgs.lib) hasSuffix nixosSystem genAttrs; inherit (nixpkgs.lib.filesystem) listFilesRecursive; - # https://xeiaso.net/blog/nix-flakes-1-2022-02-21/ supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; - forAllSystems = genAttrs supportedSystems; - nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); + forAllSystems = f: genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system}); in rec { shToPkg = path: forAllSystems ( - system: let + pkgs: let name = baseNameOf path; - pkgs = nixpkgsFor.${system}; - in { - ${name} = pkgs.writeScriptBin name (readFile path); - } + in {${name} = pkgs.writeScriptBin name (readFile path);} ); isNixFile = path: hasSuffix ".nix" path;