aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/nixos/modules/config
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/nixos/modules/config')
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/fonts/fontdir.nix2
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/malloc.nix2
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/no-x-libs.nix3
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/pulseaudio.nix10
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/swap.nix2
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/system-path.nix3
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/update-users-groups.pl18
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/users-groups.nix17
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/config/zram.nix20
9 files changed, 55 insertions, 22 deletions
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/fonts/fontdir.nix b/infra/libkookie/nixpkgs/nixos/modules/config/fonts/fontdir.nix
index 264d73ebafa5..c4bd3a077d33 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/fonts/fontdir.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/fonts/fontdir.nix
@@ -8,7 +8,7 @@ let
x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } ''
mkdir -p "$out/share/X11/fonts"
- font_regexp='.*\.\(ttf\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
+ font_regexp='.*\.\(ttf\|ttc\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
find ${toString config.fonts.fonts} -regex "$font_regexp" \
-exec ln -sf -t "$out/share/X11/fonts" '{}' \;
cd "$out/share/X11/fonts"
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/malloc.nix b/infra/libkookie/nixpkgs/nixos/modules/config/malloc.nix
index 31a659ee83fe..a3eb55d8a42e 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/malloc.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/malloc.nix
@@ -23,7 +23,7 @@ let
};
scudo = {
- libPath = "${pkgs.llvmPackages.compiler-rt}/lib/linux/libclang_rt.scudo-x86_64.so";
+ libPath = "${pkgs.llvmPackages_latest.compiler-rt}/lib/linux/libclang_rt.scudo-x86_64.so";
description = ''
A user-mode allocator based on LLVM Sanitizer’s CombinedAllocator,
which aims at providing additional mitigations against heap based
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/no-x-libs.nix b/infra/libkookie/nixpkgs/nixos/modules/config/no-x-libs.nix
index 941ab78f8632..c3120c2bf30d 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/no-x-libs.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/no-x-libs.nix
@@ -30,11 +30,12 @@ with lib;
cairo = super.cairo.override { x11Support = false; };
dbus = super.dbus.override { x11Support = false; };
networkmanager-fortisslvpn = super.networkmanager-fortisslvpn.override { withGnome = false; };
+ networkmanager-iodine = super.networkmanager-iodine.override { withGnome = false; };
networkmanager-l2tp = super.networkmanager-l2tp.override { withGnome = false; };
networkmanager-openconnect = super.networkmanager-openconnect.override { withGnome = false; };
networkmanager-openvpn = super.networkmanager-openvpn.override { withGnome = false; };
+ networkmanager-sstp = super.networkmanager-vpnc.override { withGnome = false; };
networkmanager-vpnc = super.networkmanager-vpnc.override { withGnome = false; };
- networkmanager-iodine = super.networkmanager-iodine.override { withGnome = false; };
gobject-introspection = super.gobject-introspection.override { x11Support = false; };
qemu = super.qemu.override { gtkSupport = false; spiceSupport = false; sdlSupport = false; };
}));
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/pulseaudio.nix b/infra/libkookie/nixpkgs/nixos/modules/config/pulseaudio.nix
index 408d0a9c33f2..a77524d75d8d 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/pulseaudio.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/pulseaudio.nix
@@ -36,6 +36,8 @@ let
${addModuleIf cfg.zeroconf.discovery.enable "module-zeroconf-discover"}
${addModuleIf cfg.tcp.enable (concatStringsSep " "
([ "module-native-protocol-tcp" ] ++ allAnon ++ ipAnon))}
+ ${addModuleIf config.services.jack.jackd.enable "module-jack-sink"}
+ ${addModuleIf config.services.jack.jackd.enable "module-jack-source"}
${cfg.extraConfig}
'';
};
@@ -144,7 +146,9 @@ in {
package = mkOption {
type = types.package;
- default = pkgs.pulseaudio;
+ default = if config.services.jack.jackd.enable
+ then pkgs.pulseaudioFull
+ else pkgs.pulseaudio;
defaultText = "pkgs.pulseaudio";
example = literalExample "pkgs.pulseaudioFull";
description = ''
@@ -259,7 +263,7 @@ in {
(drv: drv.override { pulseaudio = overriddenPackage; })
cfg.extraModules;
modulePaths = builtins.map
- (drv: "${drv}/lib/pulse-${overriddenPackage.version}/modules")
+ (drv: "${drv}/${overriddenPackage.pulseDir}/modules")
# User-provided extra modules take precedence
(overriddenModules ++ [ overriddenPackage ]);
in lib.concatStringsSep ":" modulePaths;
@@ -284,6 +288,8 @@ in {
RestartSec = "500ms";
PassEnvironment = "DISPLAY";
};
+ } // optionalAttrs config.services.jack.jackd.enable {
+ environment.JACK_PROMISCUOUS_SERVER = "jackaudio";
};
sockets.pulseaudio = {
wantedBy = [ "sockets.target" ];
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/swap.nix b/infra/libkookie/nixpkgs/nixos/modules/config/swap.nix
index adb4e2294213..4bb66e9b5144 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/swap.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/swap.nix
@@ -187,7 +187,7 @@ in
before = [ "${realDevice'}.swap" ];
# If swap is encrypted, depending on rngd resolves a possible entropy starvation during boot
after = mkIf (config.security.rngd.enable && sw.randomEncryption.enable) [ "rngd.service" ];
- path = [ pkgs.utillinux ] ++ optional sw.randomEncryption.enable pkgs.cryptsetup;
+ path = [ pkgs.util-linux ] ++ optional sw.randomEncryption.enable pkgs.cryptsetup;
script =
''
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/system-path.nix b/infra/libkookie/nixpkgs/nixos/modules/config/system-path.nix
index c46937f80081..27d1cef849bc 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/system-path.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/system-path.nix
@@ -33,10 +33,11 @@ let
pkgs.ncurses
pkgs.netcat
config.programs.ssh.package
+ pkgs.mkpasswd
pkgs.procps
pkgs.su
pkgs.time
- pkgs.utillinux
+ pkgs.util-linux
pkgs.which
pkgs.zstd
];
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/update-users-groups.pl b/infra/libkookie/nixpkgs/nixos/modules/config/update-users-groups.pl
index e220aa610908..fd3affae899c 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/update-users-groups.pl
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/update-users-groups.pl
@@ -16,8 +16,7 @@ my $gidMap = -e $gidMapFile ? decode_json(read_file($gidMapFile)) : {};
sub updateFile {
my ($path, $contents, $perms) = @_;
- write_file("$path.tmp", { binmode => ':utf8', perms => $perms // 0644 }, $contents);
- rename("$path.tmp", $path) or die;
+ write_file($path, { atomic => 1, binmode => ':utf8', perms => $perms // 0644 }, $contents) or die;
}
@@ -98,7 +97,7 @@ sub parseGroup {
return ($f[0], { name => $f[0], password => $f[1], gid => $gid, members => $f[3] });
}
-my %groupsCur = -f "/etc/group" ? map { parseGroup } read_file("/etc/group") : ();
+my %groupsCur = -f "/etc/group" ? map { parseGroup } read_file("/etc/group", { binmode => ":utf8" }) : ();
# Read the current /etc/passwd.
sub parseUser {
@@ -109,20 +108,19 @@ sub parseUser {
return ($f[0], { name => $f[0], fakePassword => $f[1], uid => $uid,
gid => $f[3], description => $f[4], home => $f[5], shell => $f[6] });
}
-
-my %usersCur = -f "/etc/passwd" ? map { parseUser } read_file("/etc/passwd") : ();
+my %usersCur = -f "/etc/passwd" ? map { parseUser } read_file("/etc/passwd", { binmode => ":utf8" }) : ();
# Read the groups that were created declaratively (i.e. not by groups)
# in the past. These must be removed if they are no longer in the
# current spec.
my $declGroupsFile = "/var/lib/nixos/declarative-groups";
my %declGroups;
-$declGroups{$_} = 1 foreach split / /, -e $declGroupsFile ? read_file($declGroupsFile) : "";
+$declGroups{$_} = 1 foreach split / /, -e $declGroupsFile ? read_file($declGroupsFile, { binmode => ":utf8" }) : "";
# Idem for the users.
my $declUsersFile = "/var/lib/nixos/declarative-users";
my %declUsers;
-$declUsers{$_} = 1 foreach split / /, -e $declUsersFile ? read_file($declUsersFile) : "";
+$declUsers{$_} = 1 foreach split / /, -e $declUsersFile ? read_file($declUsersFile, { binmode => ":utf8" }) : "";
# Generate a new /etc/group containing the declared groups.
@@ -175,7 +173,7 @@ foreach my $name (keys %groupsCur) {
# Rewrite /etc/group. FIXME: acquire lock.
my @lines = map { join(":", $_->{name}, $_->{password}, $_->{gid}, $_->{members}) . "\n" }
(sort { $a->{gid} <=> $b->{gid} } values(%groupsOut));
-updateFile($gidMapFile, encode_json($gidMap));
+updateFile($gidMapFile, to_json($gidMap));
updateFile("/etc/group", \@lines);
system("nscd --invalidate group");
@@ -251,7 +249,7 @@ foreach my $name (keys %usersCur) {
# Rewrite /etc/passwd. FIXME: acquire lock.
@lines = map { join(":", $_->{name}, $_->{fakePassword}, $_->{uid}, $_->{gid}, $_->{description}, $_->{home}, $_->{shell}) . "\n" }
(sort { $a->{uid} <=> $b->{uid} } (values %usersOut));
-updateFile($uidMapFile, encode_json($uidMap));
+updateFile($uidMapFile, to_json($uidMap));
updateFile("/etc/passwd", \@lines);
system("nscd --invalidate passwd");
@@ -260,7 +258,7 @@ system("nscd --invalidate passwd");
my @shadowNew;
my %shadowSeen;
-foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) {
+foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow", { binmode => ":utf8" }) : ()) {
chomp $line;
my ($name, $hashedPassword, @rest) = split(':', $line, -9);
my $u = $usersOut{$name};;
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/users-groups.nix b/infra/libkookie/nixpkgs/nixos/modules/config/users-groups.nix
index 1bb1317a8e85..72285fe631da 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/users-groups.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/users-groups.nix
@@ -35,8 +35,7 @@ let
'';
hashedPasswordDescription = ''
- To generate a hashed password install the <literal>mkpasswd</literal>
- package and run <literal>mkpasswd -m sha-512</literal>.
+ To generate a hashed password run <literal>mkpasswd -m sha-512</literal>.
If set to an empty string (<literal>""</literal>), this user will
be able to log in without being asked for a password (but not via remote
@@ -139,6 +138,20 @@ let
'';
};
+ pamMount = mkOption {
+ type = with types; attrsOf str;
+ default = {};
+ description = ''
+ Attributes for user's entry in
+ <filename>pam_mount.conf.xml</filename>.
+ Useful attributes might include <code>path</code>,
+ <code>options</code>, <code>fstype</code>, and <code>server</code>.
+ See <link
+ xlink:href="http://pam-mount.sourceforge.net/pam_mount.conf.5.html" />
+ for more information.
+ '';
+ };
+
shell = mkOption {
type = types.either types.shellPackage types.path;
default = pkgs.shadow;
diff --git a/infra/libkookie/nixpkgs/nixos/modules/config/zram.nix b/infra/libkookie/nixpkgs/nixos/modules/config/zram.nix
index 5e9870bf6b1c..1f513b7e4dae 100644
--- a/infra/libkookie/nixpkgs/nixos/modules/config/zram.nix
+++ b/infra/libkookie/nixpkgs/nixos/modules/config/zram.nix
@@ -80,6 +80,15 @@ in
'';
};
+ memoryMax = mkOption {
+ default = null;
+ type = with types; nullOr int;
+ description = ''
+ Maximum total amount of memory (in bytes) that can be used by the zram
+ swap devices.
+ '';
+ };
+
priority = mkOption {
default = 5;
type = types.int;
@@ -146,11 +155,16 @@ in
# Calculate memory to use for zram
mem=$(${pkgs.gawk}/bin/awk '/MemTotal: / {
- print int($2*${toString cfg.memoryPercent}/100.0/${toString devicesCount}*1024)
+ value=int($2*${toString cfg.memoryPercent}/100.0/${toString devicesCount}*1024);
+ ${lib.optionalString (cfg.memoryMax != null) ''
+ memory_max=int(${toString cfg.memoryMax}/${toString devicesCount});
+ if (value > memory_max) { value = memory_max }
+ ''}
+ print value
}' /proc/meminfo)
- ${pkgs.utillinux}/sbin/zramctl --size $mem --algorithm ${cfg.algorithm} /dev/${dev}
- ${pkgs.utillinux}/sbin/mkswap /dev/${dev}
+ ${pkgs.util-linux}/sbin/zramctl --size $mem --algorithm ${cfg.algorithm} /dev/${dev}
+ ${pkgs.util-linux}/sbin/mkswap /dev/${dev}
'';
restartIfChanged = false;
};