aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

write nix module to add `node` and `cli` to `environment.systemPackages` #10

Closed aleeusgr closed 1 year ago

aleeusgr commented 1 year ago

A post in our tech chat implied that adding a package outside of the Nixpkgs tree using using Chapter 66. Writing NixOS Modules

harryprayiv — Yesterday at 23:27 nix run github:input-output-hk/cardano-node#mainnet/node from my home.nix file

declarative my node working from the configuration switch by adding the flake to my home.nix file.

I was wondering how I would do the same for the cardano-cli command. I know how to build it from nix but I can’t get the flake to work from my configuration since it is compiled from the exact same repo as “cardano-node”

https://reddit.com/r/NixOS/comments/z18obt/adding_a_flake_to_my_config

figured it out just now. added a new package to my home.nix like so

packages = defaultPkgs ++ gnomePkgs ++ [ inputs.cardano-node.packages.x86_64-linux.cardano-node ] ++ [inputs.cardano-node.packages.x86_64-linux.cardano-cli];

also known as:

cardanoNodePkgs = with inputs.cardano-node.packages.x86_64-linux; [
    cardano-node
    cardano-cli
  ];
aleeusgr commented 1 year ago

add the cardano-node flake to your flake inputs and add inputs.cardano-node.packages.x86_64-linux.cardano-node to home.packages or environment.systemPackages

aleeusgr commented 1 year ago

https://github.com/harryprayiv/nix-config

aleeusgr commented 1 year ago

https://github.com/aleeusgr/nix-things/issues/11

aleeusgr commented 1 year ago

https://www.tweag.io/blog/2020-07-31-nixos-flakes/

>error: cannot look up '' in pure evaluation mode (use '--impure' to override) at /nix/store/2p4kdh8ncla0ixm7c97c3s8w67aczw8m-source/configuration.nix:11:7: 10| ./hardware-configuration.nix 11| | ^ 12| ]; (use '--show-trace' to show detailed location information)

https://github.com/aleeusgr/nix-things/issues/11

aleeusgr commented 1 year ago

error: anonymous function at /nix/store/n0f21zpy9w90sa9v75iwx6fmk897z3nw-source/nixos/lib/eval-config.nix:11:1 called with unexpected argument 'packages'

   at /nix/store/n0f21zpy9w90sa9v75iwx6fmk897z3nw-source/flake.nix:22:11:

       21|         nixosSystem = args:
       22|           import ./nixos/lib/eval-config.nix (
         |           ^
       23|             args // {
aleeusgr commented 1 year ago

https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules