From 7e021a26295e345c6676f598448baaadc9ff33f0 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 27 Nov 2019 14:04:17 +0100 Subject: [PATCH] simplify overlay.nix Move pkg definitions to pkgs/default.nix. This allows us to just import the pkgs in overlay.nix and get rid of the filtering to exclude the modules. --- default.nix | 15 ++------------- overlay.nix | 22 +--------------------- pkgs/default.nix | 12 ++++++++++++ 3 files changed, 15 insertions(+), 34 deletions(-) create mode 100644 pkgs/default.nix diff --git a/default.nix b/default.nix index f5c5399..14030d9 100644 --- a/default.nix +++ b/default.nix @@ -1,16 +1,5 @@ { pkgs ? import {} }: -{ - # 'lib', 'modules' and 'overlays' are special, see - # https://github.com/nix-community/NUR for more. - modules = import ./modules; # NixOS modules - nodeinfo = pkgs.callPackage ./pkgs/nodeinfo { }; - lightning-charge = pkgs.callPackage ./pkgs/lightning-charge { }; - nanopos = pkgs.callPackage ./pkgs/nanopos { }; - spark-wallet = pkgs.callPackage ./pkgs/spark-wallet { }; - electrs = (pkgs.callPackage ./pkgs/electrs { }).rootCrate.build; - elementsd = pkgs.callPackage ./pkgs/elementsd { withGui = false; }; - hwi = pkgs.callPackage ./pkgs/hwi { }; - pylightning = pkgs.python3Packages.callPackage ./pkgs/pylightning { }; - liquid-swap = pkgs.python3Packages.callPackage ./pkgs/liquid-swap { }; +(import ./pkgs { inherit pkgs; }) // { + modules = import ./modules; } diff --git a/overlay.nix b/overlay.nix index 082b038..ca61067 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,21 +1 @@ -# You can use this file as a nixpkgs overlay. -# It's useful in the case where you don't want to add the whole NUR namespace -# to your configuration. - -self: super: - -let filterSet = - (f: g: s: builtins.listToAttrs - (map - (n: { name = n; value = builtins.getAttr n s; }) - (builtins.filter - (n: f n && g (builtins.getAttr n s)) - (builtins.attrNames s) - ) - ) - ); -in filterSet - (n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages - (p: true) # all packages are ok - (import ./default.nix { pkgs = super; }) - +self: super: import ./pkgs { pkgs = super; } diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..cdde65d --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,12 @@ +{ pkgs ? import {} }: +{ + nodeinfo = pkgs.callPackage ./nodeinfo { }; + lightning-charge = pkgs.callPackage ./lightning-charge { }; + nanopos = pkgs.callPackage ./nanopos { }; + spark-wallet = pkgs.callPackage ./spark-wallet { }; + electrs = (pkgs.callPackage ./electrs { }).rootCrate.build; + elementsd = pkgs.callPackage ./elementsd { withGui = false; }; + hwi = pkgs.callPackage ./hwi { }; + pylightning = pkgs.python3Packages.callPackage ./pylightning { }; + liquid-swap = pkgs.python3Packages.callPackage ./liquid-swap { }; +}