Remove redundancies

This commit is contained in:
Manuel Thalmann 2024-05-01 00:43:41 +02:00
parent 690b33bd08
commit 467b2036a7

View file

@ -40,24 +40,25 @@
(item: { inherit (item) file value; })); (item: { inherit (item) file value; }));
in in
lib.mkForce ( lib.mkForce (
if (mergedSystem.mergedValue.vm.name == packageName) with { inherit (mergedSystem.mergedValue) vm; };
then if (vm.name == packageName)
mergedSystem.mergedValue.vm then
else vm
let else
prefix = lib.concatStringsSep " " (lib.optional config.virtualisation.runAsRoot "sudo"); let
wrapped = pkgs.writeShellApplication { prefix = lib.concatStringsSep " " (lib.optional config.virtualisation.runAsRoot "sudo");
name = "run-${config.system.name}-vm"; wrapped = pkgs.writeShellApplication {
text = '' name = "run-${config.system.name}-vm";
${prefix} ${mergedSystem.mergedValue.vm}/bin/run-${config.system.name}-vm text = ''
''; ${prefix} ${vm}/bin/run-${config.system.name}-vm
}; '';
in };
# Rename package to `nixos-vm` in
pkgs.symlinkJoin { # Rename package to `nixos-vm`
name = packageName; pkgs.symlinkJoin {
paths = [ wrapped ]; name = packageName;
}); paths = [ wrapped ];
});
}; };
}; };
} }