obsidiansystems / obelisk

Functional reactive web and mobile applications, with batteries included.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
954 stars 104 forks source link

Install obelisk with flake #1063

Closed MohsenNz closed 2 days ago

MohsenNz commented 6 months ago

I'm newbie in obelisk and nix, but I'm using nix (home-manager) with flake in my Ubuntu. How can I install obelisk with that?

ners commented 6 months ago

Here's a simple flake with a dev shell that contains Obelisk:

{
  nixConfig.binaryCaches = [ "https://nixcache.reflex-frp.org" ];
  nixConfig.binaryCachePublicKeys = [ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ];

  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.obelisk = {
    url = "github:obsidiansystems/obelisk";
    flake = false;
  };

  outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
    let
      pkgs = import inputs.nixpkgs { inherit system; };
      obelisk = pkgs.callPackage inputs.obelisk {
        inherit system;
        terms.security.acme.acceptTerms = true;
      };
    in
    {
      inherit obelisk;
      devShells.default = pkgs.mkShell {
        nativeBuildInputs = [
          obelisk.command
        ];
      };
    });
}
MohsenNz commented 6 months ago

I got this error:

error: flake 'path:/home/mohsen/dev/test' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'

I have no idea about fixing it. home/mohsen/dev/test is the directory contains the flake.nix

MohsenNz commented 6 months ago

Ok I did wrong command, nix shell, Now doing nix develop give this error:

λ nix develop
error (ignored): error: end of string reached
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/stdenv/generic/make-derivation.nix:354:7

       … while evaluating attribute 'nativeBuildInputs' of derivation 'nix-shell'

         at /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/stdenv/generic/make-derivation.nix:398:7:

          397|       depsBuildBuild              = elemAt (elemAt dependencies 0) 0;
          398|       nativeBuildInputs           = elemAt (elemAt dependencies 0) 1;
             |       ^
          399|       depsBuildTarget             = elemAt (elemAt dependencies 0) 2;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: the path '~/.gitconfig' can not be resolved in pure mode
turtton commented 6 months ago

It looks partial duplicate of #854. Try to add --impure option.

BTW, using this method started building a large number of dependencies such as cabal, glib, llvm, etc. and wasted several hours. Does anyone know how to import the cache?

Ericson2314 commented 2 days ago

https://github.com/obsidiansystems/obelisk/pull/1096 this should fix it: it fixes the ~/.gitconfig issue and one more you'd hit afterwards.

Leave a comment if it still doesn't work.