input-output-hk / daedalus

The open source cryptocurrency wallet for ada, built to grow with the community
https://daedaluswallet.io/
Apache License 2.0
1.23k stars 295 forks source link

`flake.nix` (or; remove need for `--impure` flag on nixos install) #3029

Open quinn-dougherty opened 2 years ago

quinn-dougherty commented 2 years ago

I'm running nixos, and I can't install daedalus in pure mode. I need to run --impure flag on nixos-rebuild switch, or else I get the following bug

building the system configuration...
error: attribute 'currentSystem' missing

       at /nix/store/77yavamh2axnx8znz6dwbpjwmgg96bhw-iohk-nix-src/default.nix:2:12:

            1| { config ? {}
            2| , system ? builtins.currentSystem
             |            ^
            3| , crossSystem ? null

       … while evaluating the attribute 'system'

       at /nix/store/77yavamh2axnx8znz6dwbpjwmgg96bhw-iohk-nix-src/default.nix:47:20:

           46|             overlays = extraOverlays;
           47|             inherit system crossSystem;
             |                    ^
           48|           } // args);

       … while evaluating the attribute 'system'

       at /nix/store/d5hgy42a104xh2ajkrfy5i3gl9425v45-nixpkgs-src/pkgs/top-level/impure.nix:18:19:

           17|   # (build, in GNU Autotools parlance) platform.
           18|   localSystem ? { system = args.system or builtins.currentSystem; }
             |                   ^
           19|

       … while evaluating 'splitString'

       at /nix/store/d5hgy42a104xh2ajkrfy5i3gl9425v45-nixpkgs-src/lib/strings.nix:440:23:

          439|   */
          440|   splitString = _sep: _s:
             |                       ^
          441|     let

       … from call site

       at /nix/store/d5hgy42a104xh2ajkrfy5i3gl9425v45-nixpkgs-src/lib/systems/parse.nix:472:69:

          471|
          472|   mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s));
             |                                                                     ^
          473|

       … while evaluating 'mkSkeletonFromList'

....
.....
...

My install looks like this, with home-manager:

let 
  daedalus = (import (pkgs.fetchFromGitHub {
    owner = "input-output-hk";
    repo = "daedalus";
    rev = "478ec558705cebfc660b7b4ebba3aa20c6bfb6b6";
    sha256 = "+7t3nfe+J9iZZ1LiPP0m8c0lvl09HeTOgfQ/OcUWiog=";
  }) { }).daedalus; in
...
home.packages = [ ... daedalus ... ]
...

I think a flake would be a better way to install daedalus.

danielmain commented 2 years ago

Hi @quinn-dougherty we only give official support by using the signed installers from www.daedaluswallet.io

But I am sure @michalrus could give you an answer here 🙏

michalrus commented 2 years ago

Hey, @quinn-dougherty!

If you want flakes, you can try this in-progress PR → #3008

We use some impure evaluations for code signing of the Windows builds, so it may take some time, before this is merged into develop

If #3008 works for you, I can merge the current develop into it, so that you have more up-to-date code

michalrus commented 2 years ago

Or you can also look at that diff, to see what I had to change to make it build purely.

Unfortunately, IIRC, I don’t think that passing target = "x86_64-linux"; when you import this repository would be enough…

quinn-dougherty commented 2 years ago

So

nix build github:input-output-hk/daedalus/chore/ddw-1083-flakes

works great, and the reason I can't build my system is the package isn't interacting with fish completions

error: attribute 'name' missing

       at /nix/store/gyp5c9cp5v0xkmgc5xkcl4dxrmmrrgla-source/modules/programs/fish.nix:311:30:

          310|         generateCompletions = package:
          311|           pkgs.runCommand "${package.name}-fish-completions" {
             |                              ^
          312|             src = package;
(use '--show-trace' to show detailed location information)
~

Which isn't super important to you, but I figured it couldn't hurt to make you aware.

Thanks for the branch!

michalrus commented 2 years ago

Oh, so there is no name for the defaultPackage on that branch?

Interesting :open_mouth: Thanks! :bow: I’ll add it :memo:

olmokramer commented 1 year ago

FWIW this seems to work fine for me on Linux on the 5.1.1 tag

{
  inputs.daedalus.url = "github:input-output-hk/daedalus/5.1.1";

  outputs = { nixpkgs, daedalus, ... }: {
    # ...
    home.packages = [
      (import daedalus {
        target = "x86_64-linux";
        localLibSystem = "x86_64-linux";
      }).daedalus
    ];
    # ...
  };
}