!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

900 Members
184 Servers

Load older messages


SenderMessageTime
16 Aug 2023
@crtified:crtified.meCRTified
In reply to @kranzes:matrix.org
      devShells.x86_64-linux = {
        clang = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
          packages = [ pkgs.hello ];
        };
        gcc = pkgs.mkShell {
          packages = [ pkgs.cmatrix ];
        };
      };
Where's pkgs coming from there?
23:21:53
@kranzes:matrix.orgIlan Joselevich (Kranzes)let binding23:22:08
@crtified:crtified.meCRTifiednixpkgs instantiation? 23:22:10
@kranzes:matrix.orgIlan Joselevich (Kranzes)inputs.nixpkgs.legacyPackages.x86_64-linux23:22:30
@crtified:crtified.meCRTified👌 Just wanted to be sure whether devShells behaves differently 23:22:46
@kranzes:matrix.orgIlan Joselevich (Kranzes)
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

  outputs = inputs:
    let
      system = "x86_64-linux";
      pkgs = inputs.nixpkgs.legacyPackages.${system};
    in
    {
      devShells.${system} = {
        clang = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
          packages = [ pkgs.hello ];
        };
        gcc = pkgs.mkShell {
          packages = [ pkgs.hello ];
        };
      };
    };
}
23:23:14
@kranzes:matrix.orgIlan Joselevich (Kranzes)really basic flake for 1 system architecture23:23:37
@lxsameer:matrix.orglxsameerPretty cool. Thanks folks23:31:13
17 Aug 2023
@lxsameer:matrix.orglxsameer hey friends, I have a very basic flake that follows. when i do nix flake show I get error: expected a derivation. Where might be the error? is there any way to get a traceback? 11:04:36
@lxsameer:matrix.orglxsameer
  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:04:47
@lxsameer:matrix.orglxsameer *
  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:01
@lxsameer:matrix.orglxsameer *
  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:matrix.orglxsameer *
 {
  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
@kranzes:matrix.orgIlan Joselevich (Kranzes)That's a flake-utils moment. Omit the ${system} part from devShells.12:25:13
@kranzes:matrix.orgIlan Joselevich (Kranzes) devShells.${system} -> devShells 12:25:24
@kranzes:matrix.orgIlan Joselevich (Kranzes)flake-utils handles the genAttrs part for the outputs12:25:53
@crtified:crtified.meCRTified For more context, https://ayats.org/blog/no-flake-utils/ is a good writeup about flake-utils 12:25:57
@kranzes:matrix.orgIlan Joselevich (Kranzes)You should probably stay away from flake-utils anyway12:26:05
@lxsameer:matrix.orglxsameerI change the flake and I'm not using flake-util like before13:03:07
@lxsameer:matrix.orglxsameerI'm just using the system wrappre now13:03:16
@lxsameer:matrix.orglxsameerthanks folks13:03:33
@antifuchs:asf.computer@antifuchs:asf.computerI 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 rate13:07:43
@charles:computer.surgeryCharles
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@catouc:matrix.org removed their display name catouc.18:39:07
@catouc:matrix.org@catouc:matrix.org left the room.18:39:08
@lxsameer:matrix.orglxsameerhow can I get the store path to a dependency? I want to set an env var for cmake to find a dependency21:56:25
@crtified:crtified.meCRTifiedAre you talking g about flake inputs or derivations as dependency? 21:57:16
@crtified:crtified.meCRTified* Are you talking about flake inputs or derivations as dependency? 21:57:29
@lxsameer:matrix.orglxsameer derivations as dependency i suppose. a package in nixpkgs.legacyPackages... 21:58:22
@crtified:crtified.meCRTified In that case, you should probably ask in #nix:nixos.org as it's not really flake specific 22:19:45

Show newer messages


Back to Room ListRoom Version: 6