!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1518 Members
Nix programming language267 Servers

Load older messages


SenderMessageTime
28 Jul 2024
@kamillaova:matrix.orgKamilla 'ovaHi, can someone explain this behavior?18:54:00
@kamillaova:matrix.orgKamilla 'ovaimage.png
Download image.png
18:54:08
@emilazy:matrix.orgemilyoh boy19:16:32
@emilazy:matrix.orgemily that's not the only platform divergence, try builtins.split "" 🙃 19:16:49
@emilazy:matrix.orgemilybut this might be a new one19:16:57
@emilazy:matrix.orgemilyyou might want to report it upstream19:47:21
29 Jul 2024
@andmuz:matrix.organdmuz joined the room.00:49:46
@rayne:spooky.computer@rayne:spooky.computer left the room.03:38:31
@kenzie:matrix.kenzi.dev@kenzie:matrix.kenzi.dev left the room.06:57:49
@gamerkold:matrix.orgKodin joined the room.07:04:18
@mariosangiorgio:matrix.org@mariosangiorgio:matrix.org left the room.07:21:39
@travis-staton:matrix.orgTravis joined the room.15:04:04
@minec:ins4.xyz@minec:ins4.xyz joined the room.16:41:04
@infinisil:matrix.orginfinisilNeat find!23:10:50
30 Jul 2024
@quapka4:matrix.orgquapka4

Hi folks, let's say I am building a derivation that depends on many pkgs and I wanna be able to build the final derivation with various versions of the dependencies. What is a clean way to do it? I was thinking something like:

builder = { pkg1 ? { version = null; hash = null;} pkg2 ? { version = null; hash = null; ... }: {
  ...
}
09:08:44
@quapka4:matrix.orgquapka4 *

Hi folks, let's say I am building a derivation that depends on many pkgs and I wanna be able to build the final derivation with various versions of the dependencies. What is a clean way to do it? I was thinking something like:

builder = { pkg1 ? { version = null; hash = null;} pkg2 ? { version = null; hash = null; ... }: {
  ...
}
09:08:48
@quapka4:matrix.orgquapka4 And then if version of a given package is provided I will rebuild it. 09:09:09
@raf:notashelf.devraf changed their display name from notashelf to raf.10:04:55
@raf:notashelf.devraf changed their display name from raf to NotAShelf.10:05:49
@mattsturg:matrix.orgMatt Sturgeon

Normally you would do this using the callPackage pattern where the various dependencies are inputs to your derivation function.

When you call your derivation using callPackage any arguments will default to pkgs.* if not explicitly passed in.

# A file using your package
lib.callPackage ./package.nix { /* explicit args (optional) */ };

# package.nix
{
  lib,
  runCommand,
  some-dep,
  other-dep,
}:
runCommand "name" {} ''
  echo "Hello, world!" > "$out"
''

# Some other file that overrides a dep
lib.callPackage ./package.nix {
  inherit some-dep;
}
10:26:26
@mattsturg:matrix.orgMatt Sturgeon *

Normally you would do this using the callPackage pattern where the various dependencies are inputs to your derivation function.

When you call your derivation using callPackage any arguments will default to pkgs.* if not explicitly passed in.

# A file using your package
lib.callPackage ./package.nix { /* explicit args (optional) */ };

# Some other file that overrides a dep
lib.callPackage ./package.nix {
  inherit some-dep;
}
# package.nix
{
  lib,
  runCommand,
  some-dep,
  other-dep,
}:
runCommand "name" {} ''
  echo "Hello, world!" > "$out"
''
10:27:04
@mattsturg:matrix.orgMatt Sturgeon *

Normally you would do this using the callPackage pattern where the various dependencies are inputs to your derivation function.

When you call your derivation using callPackage any arguments will default to pkgs.* if not explicitly passed in.

# A file using your package
{
  foo = lib.callPackage ./package.nix { /* explicit args (optional) */ };

  # This overrides a dep
  foobar = lib.callPackage ./package.nix {
    inherit some-dep;
  };
}
# package.nix
{
  lib,
  runCommand,
  some-dep,
  other-dep,
}:
runCommand "name" {} ''
  echo "Hello, world!" > "$out"
''
10:28:00
@zm94zgv2:private.coffeeZm94ZGV2 changed their profile picture.10:33:26
@quapka4:matrix.orgquapka4Thanks!10:43:56
@quapka4:matrix.orgquapka4 Hm, inherit name.value to inherit value as value does not work? Is there a reason or different syntax needed? Would such a use case make sense? 11:31:51
@lordmzte:mzte.deLordMZTE You want inherit (name) value; here. I think this is in place so you can inherit multiple values without it looking strange. you could have inherit (name) value otherValue; for example. 11:43:01
@quapka4:matrix.orgquapka4

Can I do that for multiple values? Say I have

...
let
  pkgBuilder = { version, hash }: callPackage ...;
in 
derivationBuilder = {
  let pkg = pkgBuilder { inherit (name) version hash; };
} {
...
}
11:52:00
@quapka4:matrix.orgquapka4

I tried:

inherit name.version name.hash;
inherit (name.version) (name.hash);
inherit (name) version hash;
inherit (name) version (name) hash);

But can't get it to work.

11:53:02
@lordmzte:mzte.deLordMZTEThe third one should work. Can you show the error you're getting?11:54:13
@quapka4:matrix.orgquapka4 Oh, I am so sorry, it does indeed! I have messed with the pkgBuilder and removed hash and didn't read the subsequent error msg properly. Thanks. 11:55:51

Show newer messages


Back to Room ListRoom Version: 6