From 0c24c1ec6aef63b1ba13a019b40d6bb047c62e26 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Tue, 22 Oct 2024 12:27:28 +0100 Subject: [PATCH 1/2] factorio: Give advice on retaining source tarball When manually adding the source tarball to the store with `nix-prefetch-url`, it can be GC'd after the derivation is built. Then if any library version updates and the derivation wants to rebuild, the same tarball needs to be redownloaded and re-prefetched. (Even if downloading it automatically, this can be annoying on a slower network connection, since it's nearly 4GB). This advice is mostly helpful on NixOS and it'd be nice to offer something to non-NixOS nix users as well, but I don't know what it would be. --- pkgs/by-name/fa/factorio/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/fa/factorio/package.nix b/pkgs/by-name/fa/factorio/package.nix index c9b30b31b4615..a4d72af4b29e0 100644 --- a/pkgs/by-name/fa/factorio/package.nix +++ b/pkgs/by-name/fa/factorio/package.nix @@ -70,6 +70,15 @@ let nix-prefetch-url file://\''$HOME/Downloads/factorio_\''${releaseType}_x64_\''${version}.tar.xz --name factorio_\''${releaseType}_x64-\''${version}.tar.xz Note the ultimate "_" is replaced with "-" in the --name arg! + + If you go this route you might want to tell nix to explicitly hold on to the + source tarball. Otherwise it could get GC'd from the nix store and you'd + have to redownload it next time the package wants to rebuild to use a newer + dependency. E.g. if you're using nixos: + + system.extraDependencies = [ + factorio.src + ]; ''; desktopItem = makeDesktopItem { From 36534d1172c9763449b7355be47653b017cb1de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Wed, 30 Oct 2024 14:32:25 +0000 Subject: [PATCH 2/2] factorio: stylistic changes from PR review --- pkgs/by-name/fa/factorio/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/fa/factorio/package.nix b/pkgs/by-name/fa/factorio/package.nix index a4d72af4b29e0..ebeb71d4e2456 100644 --- a/pkgs/by-name/fa/factorio/package.nix +++ b/pkgs/by-name/fa/factorio/package.nix @@ -71,10 +71,10 @@ let Note the ultimate "_" is replaced with "-" in the --name arg! - If you go this route you might want to tell nix to explicitly hold on to the - source tarball. Otherwise it could get GC'd from the nix store and you'd + If you go this route you might want to tell Nix to explicitly hold on to the + source tarball. Otherwise it could get GC'd from the Nix store and you'd have to redownload it next time the package wants to rebuild to use a newer - dependency. E.g. if you're using nixos: + dependency. E.g. if you're using NixOS: system.extraDependencies = [ factorio.src