This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
9
3
[PATCH v1 0/3] Patches for default.nix
Hi,
this set adds some stuff to the default.nix file. In my case it didn't work
because I am running the stable channel of nixpkgs, but "b4" is only available
for unstable.
Therefore I added unstable as fallback.
I also added a gitignore and made it used in the default.nix "src" attribute.
This is a proposal, I'm happy to rewrite things if you want me to!
Matthias
Matthias Beyer (3):
Add gitignore
Rewrite to fallback to unstable nixpkgs if required
Fix: Ignore gitignored files in src attribute
.gitignore | 1 +
default.nix | 52 ++++++++++++++++++++++++++++++++--------------------
2 files changed, 33 insertions(+), 20 deletions(-)
create mode 100644 .gitignore
--
2.29.2
[PATCH v1 1/3] Add gitignore
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b2be92b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+ result
--
2.29.2
[PATCH v1 2/3] Rewrite to fallback to unstable nixpkgs if required
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
---
default.nix | 52 ++++++++++++++++++++++++++++++++ --------------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/default.nix b/default.nix
index 6b4d0cc..1f85fe4 100644
--- a/default.nix
+++ b/default.nix
@@ -1,28 +1,40 @@
{ pkgs ? import <nixpkgs> {} }:
- let drv =
+ let
+ lib = pkgs.lib;
+ unstable = import
+ # unstable nixpkgs on 2021-02-09
+ (builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/d9c6f13e13f8cfe9adcb9dc5f7191336d0d8e8a7.tar.gz")
+ { config = pkgs.config; };
- { lib, stdenv, b4, notmuch, makeWrapper }:
- let paths = lib.makeBinPath [ b4 notmuch ];
- in
- stdenv.mkDerivation {
- name = "nixpkgs-ml-tools";
- version = "0.1";
+ b4 = if (lib.elem "b4" (lib.attrNames pkgs)) then
+ pkgs.b4
+ else
+ unstable.b4;
- src = ./.;
+ paths = lib.makeBinPath (with pkgs; [ b4 notmuch ]);
- nativeBuildInputs = [ makeWrapper ];
+ drv = { lib, stdenv, b4, notmuch, makeWrapper }:
+ stdenv.mkDerivation {
+ name = "nixpkgs-ml-tools";
+ version = "0.1";
- makeFlags = [ "PREFIX=$(out)" ];
+ src = ./.;
- postInstall = ''
- bins="$(find $out/bin -type f -executable -print)"
- for bin in $bins
- do
- patchShebangs "$bin"
- wrapProgram "$bin" --prefix PATH : "${paths}"
- done
- '';
- };
+ nativeBuildInputs = [ makeWrapper ];
- in pkgs.callPackage drv {}
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ postInstall = ''
+ bins="$(find $out/bin -type f -executable -print)"
+ for bin in $bins
+ do
+ patchShebangs "$bin"
+ wrapProgram "$bin" --prefix PATH : "${paths}"
+ done
+ '';
+ };
+
+ in pkgs.callPackage drv {
+ inherit (pkgs) b4 notmuch;
+ }
--
2.29.2
[PATCH v1 3/3] Fix: Ignore gitignored files in src attribute
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
---
default.nix | 2 + -
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/default.nix b/default.nix
index 1f85fe4..8214f9a 100644
--- a/default.nix
+++ b/default.nix
@@ -19,7 +19,7 @@ let
name = "nixpkgs-ml-tools";
version = "0.1";
- src = ./.;
+ src = pkgs.nix-gitignore.gitignoreSource [] ./.;
nativeBuildInputs = [ makeWrapper ];
--
2.29.2
On 09-02-2021 08:50:19, Matthias Beyer wrote:
> this set adds some stuff to the default.nix file.
Ah, should have added the subject prefix that this set is for nixpkgs-ml-tools.
Sorry about that!
Re: [PATCH v1 2/3] Rewrite to fallback to unstable nixpkgs if required
On Tue, Feb 09 2021, Matthias Beyer wrote:
> + drv = { lib, stdenv, b4, notmuch, makeWrapper }:
> + stdenv.mkDerivation {
> + name = "nixpkgs-ml-tools";
> + version = "0.1";
nit: I don't think `lib` is necessary
[PATCH nixpkgs-ml-tools] fixup! Rewrite to fallback to unstable nixpkgs if required
---
default.nix | 2 + -
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/default.nix b/default.nix
index 8214f9a..a2409ca 100644
--- a/default.nix
+++ b/default.nix
@@ -14,7 +14,7 @@ let
paths = lib.makeBinPath (with pkgs; [ b4 notmuch ]);
- drv = { lib, stdenv, b4, notmuch, makeWrapper }:
+ drv = { stdenv, b4, notmuch, makeWrapper }:
stdenv.mkDerivation {
name = "nixpkgs-ml-tools";
version = "0.1";
--
2.29.2
Re: [PATCH v1 1/3] Add gitignore
thx, pushed
To git://git.jb55.com/nixpkgs-ml-tools
fdc1835..1cb9e68 master -> master
Re: [PATCH v1 2/3] Rewrite to fallback to unstable nixpkgs if required
Matthias Beyer <mail@beyermatthias.de > writes:
> Signed-off-by: Matthias Beyer <mail@beyermatthias.de >
> ---
> default.nix | 52 ++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 32 insertions(+), 20 deletions(-)
>
> diff --git a/default.nix b/default.nix
> index 6b4d0cc..1f85fe4 100644
> --- a/default.nix
> +++ b/default.nix
> @@ -1,28 +1,40 @@
> { pkgs ? import <nixpkgs> {} }:
>
> -let drv =
> +let
> + lib = pkgs.lib;
> + unstable = import
> + # unstable nixpkgs on 2021-02-09
> + (builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/d9c6f13e13f8cfe9adcb9dc5f7191336d0d8e8a7.tar.gz")
> + { config = pkgs.config; };
I think this might be a bit overkill, let's just pin nixpkgs:
--- a/default.nix
+++ b/default.nix
@@ -1,4 +1,4 @@
-{ pkgs ? import <nixpkgs> {} }:
+{ pkgs ? import (fetchTarball "https://github.com/nixos/nixpkgs/archive/d9c6f13e13f8cfe9adcb9dc5f7191336d0d8e8a7.tar.gz") {} }:
I've pushed this:
To git://jb55.com/nixpkgs-ml-tools
1cb9e68..24cd0c7 master -> master
Re: [PATCH v1 3/3] Fix: Ignore gitignored files in src attribute
thanks!
pushed to git://jb55.com/nixpkgs-ml-tools
24cd0c7..f8b4125 master -> master