add nicer + tmuxbash

compress-drv-tests
Motiejus Jakštys 2024-02-05 09:19:16 +02:00 committed by Motiejus Jakštys
parent e5736c67b9
commit eeaed5f3ab
5 changed files with 52 additions and 27 deletions

View File

@ -103,6 +103,10 @@
};
})
(_: _: {deploy-rs-pkg = null;})
(_: super: {
tmuxbash = super.callPackage ./pkgs/tmuxbash.nix {};
nicer = super.callPackage ./pkgs/nicer.nix {};
})
];
in
{
@ -308,6 +312,7 @@
shared/home
];
extraSpecialArgs = {
inherit self system;
stateVersion = "23.05";
username = "motiejus";
email = "motiejusja@wix.com";

View File

@ -111,6 +111,10 @@ in {
};
environment.systemPackages = with pkgs; [
# packages defined here
nicer
tmuxbash
iw
vlc
i7z

28
pkgs/nicer.nix Normal file
View File

@ -0,0 +1,28 @@
{
coreutils,
writeShellApplication,
}:
writeShellApplication {
name = "nicer";
text = ''
f=$(${coreutils}/bin/mktemp)
trap '${coreutils}/bin/rm -f "$f"' EXIT
${coreutils}/bin/env > "$f"
systemd-run \
--user \
--same-dir \
--slice nicer \
--nice=19 \
--property CPUSchedulingPolicy=idle \
--property IOSchedulingClass=idle \
--property IOSchedulingPriority=7 \
--pty \
--pipe \
--wait \
--collect \
--quiet \
--property EnvironmentFile="$f" \
--service-type=exec \
-- "$@"
'';
}

13
pkgs/tmuxbash.nix Normal file
View File

@ -0,0 +1,13 @@
{
tmux,
bash,
writeShellApplication,
...
}:
writeShellApplication {
name = "tmuxbash";
text = ''
${tmux}/bin/tmux
${bash}/bin/bash
'';
}

View File

@ -8,31 +8,6 @@
username ? "motiejus",
...
}: let
pkgNicer = pkgs.writeShellApplication {
name = "nicer";
text = ''
f=$(${pkgs.coreutils}/bin/mktemp)
trap '${pkgs.coreutils}/bin/rm -f "$f"' EXIT
${pkgs.coreutils}/bin/env > "$f"
systemd-run \
--user \
--same-dir \
--slice nicer \
--nice=19 \
--property CPUSchedulingPolicy=idle \
--property IOSchedulingClass=idle \
--property IOSchedulingPriority=7 \
--pty \
--pipe \
--wait \
--collect \
--quiet \
--property EnvironmentFile="$f" \
--service-type=exec \
-- "$@"
'';
};
# from https://github.com/Gerg-L/demoninajar/blob/39964f198dbfa34c21f81c35370fab312b476051/homes/veritas_manjaro/nixGL.nix#L42
mkWrapped = wrap: orig-pkg: execName:
pkgs.makeOverridable
@ -79,14 +54,14 @@ in {
home.packages = with pkgs;
lib.mkMerge [
[pkgNicer]
(lib.mkIf devTools [
go
zig
])
(lib.mkIf hmOnly [
tmuxbash
nicer
ncdu
tokei
scrcpy