overrideAttributes for a new Notion version

I am trying to use the existing notion-app-enhanced package as a base for a more up to date version of notion. I found a fork of notion-repackaged that fits that purpose and have created this overrideAttrs using the documentation found here https://nixos.org/manual/nixpkgs/stable/#sec-pkg-overrideDerivation

  notion = pkgs.notion-app-enhanced.overrideDerivation (oldAttrs: {
    name = "notion-3.0.0-1";
    src = fetchurl {
          url = "https://github.com/aokellermann/notion-repackaged/releases/download/v3.0.0-1/Notion-3.0.0-1.AppImage";
          sha256 = "4ca2dbc3e90e8166037f420d54a7cfe8373e27707fdee999e6458044b66786d0";
    };
  });

However when I place it in my configuration.nix I get the following error.

       error: undefined variable 'fetchurl'

       at /etc/nixos/configuration.nix:131:11:

          130|     name = "notion-3.0.0-1";
          131|     src = fetchurl {
             |           ^
          132|           url = "https://github.com/aokellermann/notion-repackaged/releases/download/v3.0.0-1/Notion-3.0.0-1.AppImage";

I feel like I am close, but missing some small piece. Any help would be appreciated.

Replace it with pkgs.fetchurl. Consider updating the package upstream if this works!

Changing it to read pkgs.fetchurl did resolve that issue. But I ran into other issues, so decided to go another route.
I created notion-app.nix with contents

{ appimageTools, lib, fetchurl }:
  let
    pname = "notion-app";
    version = "3.0.0-1";

    src = fetchurl {
      url = "https://github.com/aokellermann/notion-repackaged/releases/download/v${version}/Notion-${version}.AppImage";
      sha256 = "4ca2dbc3e90e8166037f420d54a7cfe8373e27707fdee999e6458044b66786d0";
    };

    appimageContents = appimageTools.extract { inherit pname version src; };
  in appimageTools.wrapType2 {
      inherit pname version src;

      extraInstallCommands = ''
        install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
        substituteInPlace $out/share/applications/${pname}.desktop \
          --replace 'Exec=AppRun' 'Exec=${pname}'
        cp -r ${appimageContents}/usr/share/icons $out/share
      '';

      meta = with lib; {
        description = "Notion Desktop builds for Windows, MacOS and Linux.";
        homepage = "https://github.com/aokellermann/notion-repackaged";
        license = licenses.unfree;
        maintainers = with maintainers; [ skane ];
        platforms = [ "x86_64-linux" ];
        mainProgram = "notion-app";
      };
    }

And then referenced that in my configuration.nix

  environment.systemPackages = with pkgs; [
    (pkgs.callPackage ./notion-app.nix {})
  ];

And this successfully grabbed and created the new application.
I may try and fork the repo and see if I can get an even more up to date version of Notion running now that I know how this end of it works. If I do I’ll probably make a PR into the nixpkgs repo.

I have forked the repo myself and updated the Notion version to latest. The updated notion-app.nix

{ appimageTools, lib, fetchurl }:
  let
    pname = "notion-app";
    version = "3.12.1-1";

    src = fetchurl {
       url = "https://github.com/sdkane/notion-repackaged/releases/download/v${version}/Notion-${version}.AppImage";
       sha256 = "14febb00b229b11a1f5024d127ba97663c9ae301fd411106933fd2400fc6c448";
    };

    appimageContents = appimageTools.extract { inherit pname version src; };
  in appimageTools.wrapType2 {
      inherit pname version src;

      extraInstallCommands = ''
        install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
        substituteInPlace $out/share/applications/${pname}.desktop \
          --replace 'Exec=AppRun' 'Exec=${pname}'
        mkdir -p $out/share/icons
        cp -r ${appimageContents}/usr/share/icons/hicolor/0x0/apps/notion-app.png $out/share/icons/notion-app.png
      '';

      meta = with lib; {
        description = "Notion Desktop builds for Windows, MacOS and Linux.";
        homepage = "https://github.com/sdkane/notion-repackaged";
        license = licenses.unfree;
        maintainers = with maintainers; [ skane ];
        platforms = [ "x86_64-linux" ];
        mainProgram = "notion-app";
      };
    }

With the same reference in configuration.nix.

  environment.systemPackages = with pkgs; [
    (pkgs.callPackage ./notion-app.nix {})
  ];

I am looking into adding it to the official nixpkgs repo.

1 Like