From 872899d581d7c361b814247f6b28a1f9c159005a Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 24 Nov 2020 03:01:16 +0000 Subject: [PATCH] 3p/nixpkgs: reorganise patches; add all my outstanding PRs --- third_party/nixpkgs/copy.bara.sky | 4 +- .../0001-nixpkgs-allow-disable-nix.patch | 108 ------------------ ...ch => pr102855-zram-allow-memorymax.patch} | 0 .../pr103084-teamspeak3-bump-3.5.5.patch | 49 ++++++++ .../pr104725-factorio-bump-1.1.0.patch | 28 +++++ ...32-factorio-fail-early-without-creds.patch | 42 +++++++ third_party/nixpkgs/patches/series | 4 + 7 files changed, 124 insertions(+), 111 deletions(-) delete mode 100644 third_party/nixpkgs/patches/0001-nixpkgs-allow-disable-nix.patch rename third_party/nixpkgs/patches/{0002-zram-allow-memorymax.patch => pr102855-zram-allow-memorymax.patch} (100%) create mode 100644 third_party/nixpkgs/patches/pr103084-teamspeak3-bump-3.5.5.patch create mode 100644 third_party/nixpkgs/patches/pr104725-factorio-bump-1.1.0.patch create mode 100644 third_party/nixpkgs/patches/pr104732-factorio-fail-early-without-creds.patch create mode 100644 third_party/nixpkgs/patches/series diff --git a/third_party/nixpkgs/copy.bara.sky b/third_party/nixpkgs/copy.bara.sky index 5b74d8e769..6f81dfcbc1 100644 --- a/third_party/nixpkgs/copy.bara.sky +++ b/third_party/nixpkgs/copy.bara.sky @@ -15,9 +15,7 @@ core.workflow( ]), authoring = authoring.pass_thru("Default email "), transformations = [ - patch.apply(patches = [ - "patches/0002-zram-allow-memorymax.patch", - ]), + patch.apply(series = "patches/series"), core.move("", "third_party/nixpkgs"), ], ) diff --git a/third_party/nixpkgs/patches/0001-nixpkgs-allow-disable-nix.patch b/third_party/nixpkgs/patches/0001-nixpkgs-allow-disable-nix.patch deleted file mode 100644 index b954af114c..0000000000 --- a/third_party/nixpkgs/patches/0001-nixpkgs-allow-disable-nix.patch +++ /dev/null @@ -1,108 +0,0 @@ -diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix ---- a/nixos/modules/installer/tools/tools.nix -+++ b/nixos/modules/installer/tools/tools.nix -@@ -86,7 +86,7 @@ in - ''; - }; - -- config = { -+ config = mkIf config.nix.enable { - - system.nixos-generate-config.configuration = mkDefault '' - # Edit this configuration file to define what should be installed on -diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix ---- a/nixos/modules/services/misc/nix-daemon.nix -+++ b/nixos/modules/services/misc/nix-daemon.nix -@@ -81,6 +81,14 @@ in - - nix = { - -+ enable = mkOption { -+ type = types.bool; -+ default = true; -+ description = '' -+ If disabled, Nix will not be available on the built NixOS system. -+ ''; -+ }; -+ - package = mkOption { - type = types.package; - default = pkgs.nix; -@@ -498,7 +506,7 @@ in - - ###### implementation - -- config = { -+ config = mkIf cfg.enable { - - nix.binaryCachePublicKeys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; - nix.binaryCaches = [ "https://cache.nixos.org/" ]; -diff --git a/nixos/modules/services/misc/nix-gc.nix b/nixos/modules/services/misc/nix-gc.nix ---- a/nixos/modules/services/misc/nix-gc.nix -+++ b/nixos/modules/services/misc/nix-gc.nix -@@ -48,7 +48,7 @@ in - - ###### implementation - -- config = { -+ config = mkIf config.nix.enable { - - systemd.services.nix-gc = - { description = "Nix Garbage Collector"; -diff --git a/nixos/modules/services/misc/nix-optimise.nix b/nixos/modules/services/misc/nix-optimise.nix ---- a/nixos/modules/services/misc/nix-optimise.nix -+++ b/nixos/modules/services/misc/nix-optimise.nix -@@ -36,7 +36,7 @@ in - - ###### implementation - -- config = { -+ config = mkIf config.nix.enable { - - systemd.services.nix-optimise = - { description = "Nix Store Optimiser"; -diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py ---- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py -+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py -@@ -124,18 +124,19 @@ def mkdir_p(path): - raise - - def get_generations(profile=None): -- gen_list = subprocess.check_output([ -- "@nix@/bin/nix-env", -- "--list-generations", -- "-p", -- "/nix/var/nix/profiles/%s" % ("system-profiles/" + profile if profile else "system"), -- "--option", "build-users-group", ""], -- universal_newlines=True) -- gen_lines = gen_list.split('\n') -- gen_lines.pop() -+ generation_dir = "/nix/var/nix/profiles/%s" % ("system-profiles" if profile else "",) -+ profile_name = profile if profile else "system" -+ generations = [] -+ for gen_entry in os.scandir(generation_dir): -+ gen_name = gen_entry.name -+ if not (gen_name.startswith(profile_name + '-') and gen_name.endswith('-link')): -+ continue -+ gen_num = gen_name[len(profile_name+'-'):-len('-link')] -+ generations.append(int(gen_num)) -+ generations.sort() - - configurationLimit = @configurationLimit@ -- return [ (profile, int(line.split()[0])) for line in gen_lines ][-configurationLimit:] -+ return [ (profile, gen_num) for gen_num in sorted(generations) ][-configurationLimit:] - - def remove_old_entries(gens): - rex_profile = re.compile("^@efiSysMountPoint@/loader/entries/nixos-(.*)-generation-.*\.conf$") -diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix ---- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix -+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix -@@ -16,8 +16,6 @@ let - - systemd = config.systemd.package; - -- nix = config.nix.package.out; -- - timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else ""; - - editor = if cfg.editor then "True" else "False"; diff --git a/third_party/nixpkgs/patches/0002-zram-allow-memorymax.patch b/third_party/nixpkgs/patches/pr102855-zram-allow-memorymax.patch similarity index 100% rename from third_party/nixpkgs/patches/0002-zram-allow-memorymax.patch rename to third_party/nixpkgs/patches/pr102855-zram-allow-memorymax.patch diff --git a/third_party/nixpkgs/patches/pr103084-teamspeak3-bump-3.5.5.patch b/third_party/nixpkgs/patches/pr103084-teamspeak3-bump-3.5.5.patch new file mode 100644 index 0000000000..20f7537390 --- /dev/null +++ b/third_party/nixpkgs/patches/pr103084-teamspeak3-bump-3.5.5.patch @@ -0,0 +1,49 @@ +From c4b02d504e348d18f3c5cbcd208e8ecae492e463 Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Sat, 7 Nov 2020 13:37:58 +0000 +Subject: [PATCH] teamspeak_client: 3.5.3 -> 3.5.5 + +--- + .../instant-messengers/teamspeak/client.nix | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/pkgs/applications/networking/instant-messengers/teamspeak/client.nix b/pkgs/applications/networking/instant-messengers/teamspeak/client.nix +index 7d2586c670817..3ec888df2fc1f 100644 +--- a/pkgs/applications/networking/instant-messengers/teamspeak/client.nix ++++ b/pkgs/applications/networking/instant-messengers/teamspeak/client.nix +@@ -33,13 +33,13 @@ in + stdenv.mkDerivation rec { + pname = "teamspeak-client"; + +- version = "3.5.3"; ++ version = "3.5.5"; + + src = fetchurl { + url = "https://files.teamspeak-services.com/releases/client/${version}/TeamSpeak3-Client-linux_${arch}-${version}.run"; + sha256 = if stdenv.is64bit +- then "0fp9v2rkxf0zgvf3wcx8nsmf93bzdc22xlqxk3r8cb0415adp76a" +- else "0ni7hijprc8xygyz41568f1m9wwhl8lk5c3q28bm9m5r6qym39l6"; ++ then "sha256:13f9n55ii93y72l68idvhpwdgr8k3qhrwim0n1jz251n3ydnsqjk" ++ else "sha256:0frc2aqz4scm77qs5032b71sjly31abbczc3ipw7liq6m1nr6nw7"; + }; + + # grab the plugin sdk for the desktop icon +@@ -99,15 +99,15 @@ stdenv.mkDerivation rec { + dontStrip = true; + dontPatchELF = true; + +- meta = { ++ meta = with stdenv.lib; { + description = "The TeamSpeak voice communication tool"; + homepage = "https://teamspeak.com/"; + license = { + fullName = "Teamspeak client license"; +- url = "http://sales.teamspeakusa.com/licensing.php"; ++ url = "https://www.teamspeak.com/en/privacy-and-terms/"; + free = false; + }; +- maintainers = [ stdenv.lib.maintainers.lhvwb ]; ++ maintainers = with maintainers; [ lhvwb lukegb ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + }; + } diff --git a/third_party/nixpkgs/patches/pr104725-factorio-bump-1.1.0.patch b/third_party/nixpkgs/patches/pr104725-factorio-bump-1.1.0.patch new file mode 100644 index 0000000000..7c5d1b3d1d --- /dev/null +++ b/third_party/nixpkgs/patches/pr104725-factorio-bump-1.1.0.patch @@ -0,0 +1,28 @@ +From 378db78499c64130dc560cac34729b14e13b09cc Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Tue, 24 Nov 2020 00:21:08 +0000 +Subject: [PATCH] factorio-experimental, factorio-headless-experimental: 1.0.0 + -> 1.1.0 + +--- + pkgs/games/factorio/default.nix | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix +index 0226acf160460..0e2592de919ee 100644 +--- a/pkgs/games/factorio/default.nix ++++ b/pkgs/games/factorio/default.nix +@@ -63,11 +63,11 @@ let + x86_64-linux = let bdist = bdistForArch { inUrl = "linux64"; inTar = "x64"; }; in { + alpha = { + stable = bdist { sha256 = "0zixscff0svpb0yg8nzczp2z4filqqxi1k0z0nrpzn2hhzhf1464"; version = "1.0.0"; withAuth = true; }; +- experimental = bdist { sha256 = "0zixscff0svpb0yg8nzczp2z4filqqxi1k0z0nrpzn2hhzhf1464"; version = "1.0.0"; withAuth = true; }; ++ experimental = bdist { sha256 = "0n00nbh44nyf485jys6pkga3pb9j4zywk0liq6jq99pil6z7na3y"; version = "1.1.0"; withAuth = true; }; + }; + headless = { + stable = bdist { sha256 = "0r0lplns8nxna2viv8qyx9mp4cckdvx6k20w2g2fwnj3jjmf3nc1"; version = "1.0.0"; }; +- experimental = bdist { sha256 = "0r0lplns8nxna2viv8qyx9mp4cckdvx6k20w2g2fwnj3jjmf3nc1"; version = "1.0.0"; }; ++ experimental = bdist { sha256 = "15qiwz3wvyaidndrrm1wfznbidnpf12wpzb8vlm9g0gaq3b0f6h6"; version = "1.1.0"; }; + }; + demo = { + stable = bdist { sha256 = "0h9cqbp143w47zcl4qg4skns4cngq0k40s5jwbk0wi5asjz8whqn"; version = "1.0.0"; }; diff --git a/third_party/nixpkgs/patches/pr104732-factorio-fail-early-without-creds.patch b/third_party/nixpkgs/patches/pr104732-factorio-fail-early-without-creds.patch new file mode 100644 index 0000000000..ddd0ab24f5 --- /dev/null +++ b/third_party/nixpkgs/patches/pr104732-factorio-fail-early-without-creds.patch @@ -0,0 +1,42 @@ +From 86aa2a57d3a60d68af8689c4a1eb4da306f90c98 Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Tue, 24 Nov 2020 01:27:34 +0000 +Subject: [PATCH] factorio: fail fetch early if no credentials provided + +The download URL will redirect to the login page if credentials are not +present, but will return an error if the credentials are wrong. + +Since we know we always expect credentials, we can fail the fetch in +the preHook if they're not provided. + +We can't use e.g. builtins.throw because we want the fetchurl derivation +to be evaluated in all cases - because that's the mechanism which allows +you to just manually add the tarball to the Nix store. +--- + pkgs/games/factorio/default.nix | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix +index 0226acf160460..e5527c9d4ef70 100644 +--- a/pkgs/games/factorio/default.nix ++++ b/pkgs/games/factorio/default.nix +@@ -104,10 +104,15 @@ let + ]; + }) + (_: { # This preHook hides the credentials from /proc +- preHook = '' +- echo -n "${username}" >username +- echo -n "${token}" >token +- ''; ++ preHook = ++ if username != "" && token != "" then '' ++ echo -n "${username}" >username ++ echo -n "${token}" >token ++ '' else '' ++ # Deliberately failing since username/token was not provided, so we can't fetch. ++ # We can't use builtins.throw since we want the result to be used if the tar is in the store already. ++ exit 1 ++ ''; + failureHook = '' + cat <