Correct way to package a grub .tar theme

I want to package a nixos grub theme, this is what i have right now, i need to extract themes/nixos.tar to $out, this is what i have and it isnt working:

{pkgs, ...}:
pkgs.stdenv.mkDerivation rec {
  pname = "nixos-distro-theme";
  version = "v3.2";
  src = pkgs.fetchFromGitHub {
    owner = "AdisonCavani";
    repo = "distro-grub-themes";
    rev = version;
    hash = "sha256-ZcoGbbOMDDwjLhsvs77C7G7vINQnprdfI37a9ccrmPs=";
  };
  installPhase = ''
    tar -xf themes/nixos.tar -C $out
  '';
}

Overall, the problem is you’re trying to execute a directory, which isn’t a binary, you’d need to use lib.getExe pkgs.gnutar. But in this case, just use tar -xf ... since GNU tar is already part of stdenv:
https://nixos.org/manual/nixpkgs/unstable/#sec-tools-of-stdenv

1 Like

how did i forget that, stupid mistake… used tar instead of ${pkgs.gnutar} but got this:

nix build .#nixos-grub
warning: Git tree '/home/cinnamon/blueprint' is dirty
error: builder for '/nix/store/1q8aqmqym5x4sjk0lwbcb39p5z7n05f6-nixos-distro-theme-v3.2.drv' failed with exit code 2;
       last 12 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/4qy8msljhzbi7fx9v34n663y5p1al39g-source
       > source root is source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > no Makefile or custom buildPhase, doing nothing
       > Running phase: installPhase
       > tar: /nix/store/8s81hfvzgibgp54svgicwyxsgw5prcsy-nixos-distro-theme-v3.2: Cannot open: No such file or directory
       > tar: Error is not recoverable: exiting now
       For full logs, run 'nix log /nix/store/1q8aqmqym5x4sjk0lwbcb39p5z7n05f6-nixos-distro-theme-v3.2.drv'.

You may need to add: mkdir -p $out

2 Likes

thanks, that was it!