| 17 Aug 2023 |
lxsameer | * description = "A very basic flake";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
devShells.${system} = {
clang = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
packages = [ pkgs.hello ];
};
gcc = pkgs.mkShell {
packages = [ pkgs.hello ];
};
};
}
);
}
| 11:05:14 |
lxsameer | * {
description = "A very basic flake";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
devShells.${system} = {
clang = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
packages = [ pkgs.hello ];
};
gcc = pkgs.mkShell {
packages = [ pkgs.hello ];
};
};
}
);
}
| 11:06:31 |
Ilan Joselevich (Kranzes) | That's a flake-utils moment. Omit the ${system} part from devShells. | 12:25:13 |
Ilan Joselevich (Kranzes) | devShells.${system} -> devShells | 12:25:24 |
Ilan Joselevich (Kranzes) | flake-utils handles the genAttrs part for the outputs | 12:25:53 |
CRTified | For more context, https://ayats.org/blog/no-flake-utils/ is a good writeup about flake-utils | 12:25:57 |
Ilan Joselevich (Kranzes) | You should probably stay away from flake-utils anyway | 12:26:05 |
lxsameer | I change the flake and I'm not using flake-util like before | 13:03:07 |
lxsameer | I'm just using the system wrappre now | 13:03:16 |
lxsameer | thanks folks | 13:03:33 |
@antifuchs:asf.computer | I find flake.parts a much better-done thing that does all flake-utils does; the post above is great for learning what they do, at any rate | 13:07:43 |
Charles | In reply to @crtified:crtified.me For more context, https://ayats.org/blog/no-flake-utils/ is a good writeup about flake-utils I don't find the arguments made here to be very compelling. Either way you do it, there's a problem of actually knowing how to use your tools; copy-pasting some nix code doesn't guarantee understandability, which is the stated problem. Also, this article doesn't mention https://github.com/nix-systems/nix-systems at all, which flake-utils pulls in for you automatically but would need to be manually integrated into a custom nix expression like the one suggested therein | 15:31:27 |
| @catouc:matrix.org removed their display name catouc. | 18:39:07 |
| @catouc:matrix.org left the room. | 18:39:08 |
lxsameer | how can I get the store path to a dependency? I want to set an env var for cmake to find a dependency | 21:56:25 |
CRTified | Are you talking g about flake inputs or derivations as dependency? | 21:57:16 |
CRTified | * Are you talking about flake inputs or derivations as dependency? | 21:57:29 |
lxsameer | derivations as dependency i suppose. a package in nixpkgs.legacyPackages... | 21:58:22 |
CRTified | In that case, you should probably ask in #nix:nixos.org as it's not really flake specific | 22:19:45 |
CRTified | (but to keep it short: you can use the packages as part of a string and it will get resolved as a store path, so something like "${some Derivation}" is a string containing the path to the store) | 22:21:16 |
lxsameer | thank you 🙇 | 22:21:41 |
CRTified | https://nixos.org/manual/nix/unstable/language/string-interpolation.html there are derivations explicitly listed as interpolateable | 22:22:58 |
lxsameer | Thanks a million | 22:23:12 |
| jthulhu changed their display name from jthulhu to Evan. | 22:49:50 |
| 18 Aug 2023 |
| jthulhu changed their display name from Evan to jthulhu. | 01:18:41 |
| Shados joined the room. | 05:42:11 |
lxsameer | hey friends, I'm trying to create a musl based shell using devShell like this:
devShells = {
${x86_64-linux} = nixpkgs.pkgsCross.libcxxStdenv.mkShell {
nativeBuildInputs = native_build_inputs nixpkgs.pkgsCross;
buildInputs = build_inputs nixpkgs.pkgsCross;
shellHook = ''fish && exit'';
};
| 19:06:53 |
lxsameer | but I get an error that says: error: attribute 'pkgsCross' missing | 19:07:18 |
lxsameer | should I do anything special to access pkgsCross? | 19:07:41 |
CRTified | Is nixpkgs your nixpkgs flake input? If yes, check out the legacyPackages attribute | 19:14:37 |