Compare commits

...

5 commits

Author SHA1 Message Date
be2a3c31e5 gdm: use wayland 2024-06-05 16:21:48 +02:00
b5f46c14ee nvidia: update to 555.42.02 2024-06-05 16:20:06 +02:00
ed66ca84bc core: explicitly wrap nixos-rebuild 2024-06-01 03:27:45 +02:00
82bf8ab05f core: wrap nix with wrapped commands 2024-06-01 01:12:39 +02:00
9abc9c10ba core: rework mkWrappedExecutable helper
- returns packages with high priority
- inherits wrapperArgs so they could be overriden
- fixed typo in description
2024-05-31 23:47:56 +02:00
4 changed files with 36 additions and 16 deletions

View file

@ -21,7 +21,6 @@
networking.hostName = "wroclaw-hp";
networking.networkmanager.enable = true;
networking.firewall.enable = true;
services.xserver.displayManager.gdm.wayland = lib.mkForce true;
hardware.sensor.iio.enable = true;
networking.firewall.allowedTCPPortRanges = [

View file

@ -6,23 +6,37 @@
let
/*
* pkgs: package - nixpkgs package
* pkg: package - nixpkgs package
* exe: string - executable (under bin) in pkgs
* wrapperArgs: string[] - arguments to pass to the wrapper
*/
mkWrappedExecutable = {pkg, exe ? pkg.meta.mainProgram, wrapperArgs}: let inherit (pkgs) lib makeWrapper; in pkgs.stdenv.mkDerivation {
mkWrappedExecutable = {pkg, exe ? pkg.meta.mainProgram, wrapperArgs}: let inherit (pkgs) lib makeWrapper; in lib.hiPrio (
pkgs.stdenv.mkDerivation {
inherit wrapperArgs;
name = "${pkg.name}-wrap-${exe}";
nativeBuildInputs = [ makeWrapper ];
phases = ["installPhase"];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} ${lib.concatStringsSep " " wrapperArgs}
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs
'';
};
wrapedNixPrograms = builtins.map lib.hiPrio [
(mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar-with-logs"];})
}
);
# bool -> nixpkgs[]
wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [
(mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar${lib.optionalString inEnvironment "-with-logs"}"];})
(mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];})
];
wrappedNixosExecutables = [
(mkWrappedExecutable {pkg = pkgs.nixos-rebuild; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];})
];
wrappedNix = (pkgs.buildEnv {
name = "wrappedNix-${pkgs.nix.version}";
paths = [ pkgs.nix ] ++ wrappedNixExecutables false;
}).overrideAttrs {
version = pkgs.nix.version;
};
in
{
# kernel
@ -33,6 +47,7 @@ in
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
nix.package = wrappedNix;
# List packages installed in system profile. To search, run:
# $ nix search wget
@ -45,7 +60,8 @@ in
fastfetch
smartmontools
ddrescue
] ++ wrapedNixPrograms;
] ++ wrappedNixExecutables true
++ wrappedNixosExecutables;
programs.git.enable = true;
programs.git.config = {

View file

@ -7,7 +7,6 @@
config = {
services.xserver.displayManager.gdm = {
enable = true;
wayland = false;
autoSuspend = false;
};

View file

@ -12,6 +12,12 @@
powerManagement.enable = true;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "555.42.02";
sha256_64bit = "sha256-k7cI3ZDlKp4mT46jMkLaIrc2YUx1lh1wj/J4SVSHWyk=";
settingsSha256 = "sha256-rtDxQjClJ+gyrCLvdZlT56YyHQ4sbaL+d5tL4L4VfkA=";
persistencedSha256 = "";
};
};
nixpkgs.config.nvidia.acceptLicense = true;
}