3p/nixpkgs: reorganise patches; add all my outstanding PRs

This commit is contained in:
Luke Granger-Brown 2020-11-24 03:01:16 +00:00
parent 311fc015f4
commit 872899d581
7 changed files with 124 additions and 111 deletions

View file

@ -15,9 +15,7 @@ core.workflow(
]), ]),
authoring = authoring.pass_thru("Default email <noreply+nixpkgs@lukegb.com>"), authoring = authoring.pass_thru("Default email <noreply+nixpkgs@lukegb.com>"),
transformations = [ transformations = [
patch.apply(patches = [ patch.apply(series = "patches/series"),
"patches/0002-zram-allow-memorymax.patch",
]),
core.move("", "third_party/nixpkgs"), core.move("", "third_party/nixpkgs"),
], ],
) )

View file

@ -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";

View file

@ -0,0 +1,49 @@
From c4b02d504e348d18f3c5cbcd208e8ecae492e463 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
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" ];
};
}

View file

@ -0,0 +1,28 @@
From 378db78499c64130dc560cac34729b14e13b09cc Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
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"; };

View file

@ -0,0 +1,42 @@
From 86aa2a57d3a60d68af8689c4a1eb4da306f90c98 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
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 <<EOF
${helpMsg}

4
third_party/nixpkgs/patches/series vendored Normal file
View file

@ -0,0 +1,4 @@
pr102855-zram-allow-memorymax.patch
pr103084-teamspeak3-bump-3.5.5.patch
pr104725-factorio-bump-1.1.0.patch
pr104732-factorio-fail-early-without-creds.patch