From bff94c383aea480eeebc3d77cf6b4d19da803e4b Mon Sep 17 00:00:00 2001 From: didier amyot Date: Sun, 30 Apr 2023 09:01:09 -0400 Subject: [PATCH] Fixed nixpkgs by generating a function by system. --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 58 ++++++++++++++++++++++++++++----------------------- 2 files changed, 93 insertions(+), 26 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0c1144a --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1682692304, + "narHash": "sha256-9/lyXN2BpHw+1xE+D2ySBSLMCHWqiWu5tPHBMRDib8M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "937a9d1ee7b1351d8c55fff6611a8edf6e7c1c37", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "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 index 12ad54f..ded7c98 100644 --- a/flake.nix +++ b/flake.nix @@ -3,33 +3,39 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }: { - writePythonApplication = {name, contentFile}: let - wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile); - in - pkgs.writeShellApplication { - name = name; - runtimeInputs = [ - wrappedScript - pkgs.python311]; - text = '' - exec ${pkgs.python38}/bin/python ${wrappedScript} "$@" - ''; - }; + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system;}; + in + { + writePythonApplication = {name, contentFile}: let + wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile); + in + pkgs.writeShellApplication { + name = name; + runtimeInputs = [ + wrappedScript + pkgs.python311]; + text = '' + exec ${pkgs.python38}/bin/python ${wrappedScript} "$@" + ''; + }; - writeBabashkaApplication = {name, contentFile}: let - wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile); - in - pkgs.writeShellApplication { - name = name; - runtimeInputs = [ - wrappedScript - pkgs.babashka]; - text = '' - exec ${pkgs.babashka}/bin/bb ${wrappedScript} "$@" - ''; - }; - }; + writeBabashkaApplication = {name, contentFile}: let + wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile); + in + pkgs.writeShellApplication { + name = name; + runtimeInputs = [ + wrappedScript + pkgs.babashka]; + text = '' + exec ${pkgs.babashka}/bin/bb ${wrappedScript} "$@" + ''; + }; + }); }