TristanCacqueray/autochill

nix-shell: no reproducible dev environment

Closed this issue · 3 comments

srid commented

Great to see that this project uses Nix!

I tried nix-shell, but it failed on my machine:

error: attribute 'gtk4' missing

       at /home/srid/code/autochill/default.nix:16:5:

           15|     pkgs.gjs
           16|     pkgs.gtk4
             |     ^
           17|     pkgs.gnome3.gobject-introspection
(use '--show-trace' to show detailed location information)

I believe this is because nixpkgs is not pinned,

{ pkgs ? import <nixpkgs> { } }:

.. and that pinning that should resolve it.

srid commented

Some progress after this patch,

diff --git a/default.nix b/default.nix
index 283663f..975ccac 100644
--- a/default.nix
+++ b/default.nix
@@ -1,4 +1,4 @@
-{ pkgs ? import <nixpkgs> { } }:
+{ pkgs ? import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/94b2848559b12a8ed1fe433084686b2a81123c99.tar.gz") { } }:
 
 let
   easy-ps = import (pkgs.fetchFromGitHub {
@@ -15,5 +15,7 @@ in pkgs.mkShell {
     pkgs.gjs
     pkgs.gtk4
     pkgs.gnome3.gobject-introspection
+    pkgs.dhall
+    pkgs.dhall-json
   ];
 }

But stuck at,

❯ nix-shell --run 'make dist'
this path will be fetched (1.85 MiB download, 11.17 MiB unpacked):
  /nix/store/vn4v15zdnabzjn6l5pwqdxaxavn1dr7j-dhall-1.38.1
copying path '/nix/store/vn4v15zdnabzjn6l5pwqdxaxavn1dr7j-dhall-1.38.1' from 'https://cache.nixos.org'...
mkdir -p dist/schemas
dhall-to-json --file ./src/metadata.dhall --output dist/metadata.json
dhall text --file ./src/autochill.gschema.dhall --output dist/schemas/autochill.gschema.xml
glib-compile-schemas dist/schemas/
spago bundle-app -m AutoChill --to dist/extension.js
[error] ERROR: it was not possible to find a `spago.dhall` file at the following location: "./../purescript-gjs/spago.dhall"
make: *** [Makefile:22: dist-extension] Error 1
srid commented

Running git clone https://github.com/purescript-gjs/purescript-gjs.git ../purescript-gjs before nix-shell resolves that, FWIW.

Oops indeed, gtk4 is not always available. For purescript-gjs, it is still a work in progress, I've udpated the README with git clone instruction.

Thanks for the feedback!