diff --git a/lib/fetchfile.nix b/lib/fetchfile.nix new file mode 100644 index 0000000..573db92 --- /dev/null +++ b/lib/fetchfile.nix @@ -0,0 +1,7 @@ +{ stdenv, pkgs, ... }: + { path, storeHash, ... }: + let + derivationName = baseNameOf path; + storePath = "/nix/store/${storeHash}-${derivationName}"; + in + if builtins.pathExists storePath then storePath else path diff --git a/lib/list-to-bash-array.nix b/lib/list-to-bash-array.nix new file mode 100644 index 0000000..b87c31a --- /dev/null +++ b/lib/list-to-bash-array.nix @@ -0,0 +1,37 @@ +# Source: http://chriswarbo.net/projects/nixos/useful_hacks.html + +{ args, name }: + let + nixpkgs = import {}; + lib = nixpkgs.lib; + in + rec { + # Store each arg in a separate variable, named numerically + env = with lib.foldl' (result: arg: { + # Increment the count, for the next arg (if any) + count = result.count + 1; + + # Append a variable to the environment for this arg + vars = result.vars // { + "${name}${toString result.count}" = arg; + }; + }) + # Start with variable 1 in an empty environment + { count = 1; vars = {}; } + args; + vars; + + code = '' + ### Auto-generated by nixListToBashArray + ${name}=() + + for N in $(seq 1 "${toString (lib.length args)}") + do + # Use a "variable variable" to look up "$name$N" as a variable name + NIXLISTTOBASHARRAYTEMP="${name}$N" + ${name}=("''${${name}[@]}" "''${!NIXLISTTOBASHARRAYTEMP}") + unset NIXLISTTOBASHARRAYTEMP + done + ### End of auto-generated code + ''; + } diff --git a/lib/packages.nix b/lib/packages.nix index 4e021cc..c3ba3d5 100644 --- a/lib/packages.nix +++ b/lib/packages.nix @@ -2,6 +2,7 @@ options: let combinedOptions = options // { overlays = [ (import ../nixpkgs-mozilla/rust-overlay.nix) + (import (fetchTarball https://git.cryto.net/joepie91/morepkgs/archive/master.tar.gz)) (self: super: { jre8Plugin = super.jre8Plugin.overrideAttrs (drv: { src = ../sources/jdk-8u141-linux-x64.tar.gz; @@ -11,7 +12,9 @@ options: let }; in { master = (import (fetchTarball https://github.com/NixOS/nixpkgs/archive/master.tar.gz) combinedOptions); - unstable = (import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) combinedOptions); + /* unstable = (import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) combinedOptions); */ + unstable = (import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/e05a926713441a4ec632c7b793448654f7c2056d.tar.gz) combinedOptions); + /* unstable = (import ) combinedOptions; */ nixpkgs = (import ) combinedOptions; myNixpkgs = (import ../packages) {}; }