!yUrHuDcxUngfTlDbiy:matrix.org

flakelight

38 Members
https://github.com/nix-community/flakelight12 Servers

Load older messages


SenderMessageTime
8 Mar 2024
@accelbread:matrix.orgaccelbread *

I'd like to float an idea.

If you just want flakelight to provide you a recent nixpkgs (the default), you dont have to do anything:

{
  inputs.flakelight.url = "github:nix-community/flakelight";
  outputs = { flakelight, ... }:
    flakelight ./. {
    };
}

If you want to bring your own nixpkgs, you have to pass it to flakelight:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    flakelight.url = "github:nix-community/flakelight";
  };
  outputs = { flakelight, ... }@inputs:
    flakelight ./. {
      inherit inputs;
    };
}

But what if you didn't have to pass it and flakelight would use your input?

Like this:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    flakelight.url = "github:nix-community/flakelight";
  };
  outputs = { flakelight, ... }:
    flakelight ./. {
    };
}

Currently, that is having a nixpkgs input, but having flakelight still use its
default.

With this proposal, that becomes using your nixpkgs input for flakelight as well.

Upsides:

  • Easier to just override inputs
  • current behavior might confuse people?
  • Less boilerplate

Downsides:

  • Someone might intentionally want to have a nixpkgs input but still have
    flakelight use the default (seems unlikely).
  • Maybe small perf impact as have to read flake lock?

Passing inputs explicitly may still be preferred for performance or unusual circumstances,
so of course passed inputs override detected ones. It would also need to be
passed if one wishes to pass inputs and the path passed is not ./..

(The autodetection would work by reading ./flake.lock, which is why if the
path passed is not the usual ./., it can't autodetect.)

04:46:49
10 Mar 2024
@accelbread:matrix.orgaccelbreadI'll also be at Nixcon NA btw03:54:31
@cmacr.ae:matrix.orgcmacraeyeah I like your above approval. personally, the main reason I use flakelight is because of how succinct and elegant it is. I think as long as it's well documented and passing inputs explicitly can override detected ones, it's a nice addition :)09:02:48
11 Mar 2024
@accelbread:matrix.orgaccelbread Added the change; should now only need to set inputs if using self or want to override 02:49:04
@accelbread:matrix.orgaccelbread * Added the change; should now only need to set inputs if using inputs.self or want to override 02:49:30
13 Mar 2024
@cmacr.ae:matrix.orgcmacrae just wondering, regarding devShells in flakelight, is there a means to use something like devenv ? it has it's own devenv.lib.mkShell which I'd love to be able to use with flakelight 13:49:14
@accelbread:matrix.orgaccelbreadYeah, you can just set any of the devshells to the output of that function14:58:08
@accelbread:matrix.orgaccelbread

Something like:

{
  inputs = {
    flakelight.url = "github:nix-community/flakelight";
    devenv.url = "github:cachix/devenv";
  };
  outputs = { flakelight, devenv, ... }:
    flakelight ./. {
    };
}
15:08:40
@accelbread:matrix.orgaccelbread *

Something like:

{
  inputs = {
    flakelight.url = "github:nix-community/flakelight";
    devenv.url = "github:cachix/devenv";
  };
  outputs = { flakelight, devenv, ... }:
    flakelight ./. {
      devShell = { pkgs, inputs, ... }: devenv.lib.mkShell { 
        inherit inputs pkgs;
        ...
      };
    };
}
15:10:18
@accelbread:matrix.orgaccelbreadthere we go, not used to enter in middle of message submitting ha15:10:43
@accelbread:matrix.orgaccelbread *

Something like:

{
  inputs = {
    flakelight.url = "github:nix-community/flakelight";
    devenv.url = "github:cachix/devenv";
  };
  outputs = { flakelight, devenv, ... }:
    flakelight ./. {
      devShell = { pkgs, inputs, ... }: devenv.lib.mkShell { 
        inherit inputs pkgs;
        modules = [
        ];
      };
    };
}
15:16:35
@accelbread:matrix.orgaccelbread *

Something like:

{
  inputs = {
    flakelight.url = "github:nix-community/flakelight";
    devenv.url = "github:cachix/devenv";
  };
  outputs = { flakelight, devenv, ... }:
    flakelight ./. {
      devShell = { pkgs, inputs, ... }: devenv.lib.mkShell { 
        inherit inputs pkgs;
        modules = [
          # Your stuff here
        ];
      };
    };
}
15:17:10
@accelbread:matrix.orgaccelbreadI think that should work? Though it seems devenv requires impure?15:17:32
@cmacr.ae:matrix.orgcmacrae awesome, how about if I wanted to use the autoload for devShells/ ? 16:01:36
@cmacr.ae:matrix.orgcmacraeyeah, sadly devenv needs impurity because of some of the features around process management 😢 (I think it writes to files)16:02:11
@accelbread:matrix.orgaccelbread

for autoloading could have:

{ pkgs, inputs, ... }:
  inputs.devenv.lib.mkShell { 
    inherit inputs pkgs;
    modules = [
      # Your stuff here
    ];
  };

and put that in nix/devShell.nix or nix/devShells/devenv.nix or such

16:17:03
@cmacr.ae:matrix.orgcmacraeoh great, okay that's perfect - thanks!16:17:34
@cmacr.ae:matrix.orgcmacrae

any idea why a package definition in nix/packages/example/default.nix, looking like this would complain lib.customisation.callPackageWith: Function called without required argument "buildPythonPackage" at /nix/store/... ?

{ buildPythonPackage }:

buildPythonPackage rec {
  pname = "example"....

haven't run into this with other packages I've defined wherein I use a bunch of build inputs from nixpkgs.
sorry for all the questions 😅

16:48:29
@accelbread:matrix.orgaccelbreadHuh it does not seem to exist in nixpkgs anymore. Maybe it was moved?16:58:42
@accelbread:matrix.orgaccelbreadimage.png
Download image.png
16:59:30
@accelbread:matrix.orgaccelbreadno problem about questions, ask away16:59:56
@cmacr.ae:matrix.orgcmacrae that is very confusing 😅 I was using example = callPackage ./packages/example { inherit buildPythonPackage; }; in a previous iteration of this project and it worked 17:01:24
@accelbread:matrix.orgaccelbreadit seems packages in nixpkgs are also using it which is wierd 17:01:47
@accelbread:matrix.orgaccelbread * it seems packages in nixpkgs are also using it which is weird17:01:51
@accelbread:matrix.orgaccelbreadAh17:02:05
@cmacr.ae:matrix.orgcmacraeits under pythonPackages, is that perhaps why?17:02:44
@accelbread:matrix.orgaccelbread the inherit buildPythonPackage; there adds/overrides stuff to the package set for that callPackage 17:02:48
@accelbread:matrix.orgaccelbread if its pythonPackages.buildPythonPackage you'll want your to take { pythonPackages } and go from there 17:03:51
@cmacr.ae:matrix.orgcmacraeoh good, I'm glad you suggested that, haha. I thought "maybe I just use that, but then I don't want it to all be in scope", but I guess it doesn't matter anyway because of lazy eval? 17:04:46
@accelbread:matrix.orgaccelbreadYeah, lazy eval takes care of it17:05:02

Show newer messages


Back to Room ListRoom Version: 10