Uutils: Difference between revisions

mNo edit summary
Adding a warning that uutils currently break nixos rebuild
 
(One intermediate revision by the same user not shown)
Line 35: Line 35:


== Installation ==
== Installation ==
To do a systemwide replacement of gnu utils with uutils you can use system.replaceDependencies. It should be noted that the name of the dependency is hardcoded in the binaries, therefore the name of the replacing dependency needs to have exactly the same length as the name of the source dependency. To do this declaratively this snippet should be added to your configs:
To do a systemwide replacement of gnu utils with uutils you can use system.replaceDependencies.  
 
''Warning: as of February 2026 this seems to break nixos-rebuild, as uutils mv uses an interactive prompt where coreutils don't''
 
It should be noted that the name of the dependency is hardcoded in the binaries, therefore the name of the replacing dependency needs to have exactly the same length as the name of the source dependency. To do this declaratively this snippet should be added to your configs:
{{File|3={ pkgs, ... }:
{{File|3={ pkgs, ... }:
let
let
   coreutils-full-name = "coreuutils-full-" + builtins.concatStringsSep ""
   coreutils-full-name = "coreuutils-full" + builtins.concatStringsSep ""
     (builtins.genList (_: "v") ((builtins.stringLength pkgs.coreutils-full.version) - 1));
     (builtins.genList (_: "_") (builtins.stringLength pkgs.coreutils-full.version));


   coreutils-name = "coreuutils-" + builtins.concatStringsSep ""
   coreutils-name = "coreuutils" + builtins.concatStringsSep ""
     (builtins.genList (_: "v") ((builtins.stringLength pkgs.coreutils.version) - 1));
     (builtins.genList (_: "_") (builtins.stringLength pkgs.coreutils.version));


   findutils-name = "finduutils-" + builtins.concatStringsSep ""
   findutils-name = "finduutils" + builtins.concatStringsSep ""
     (builtins.genList (_: "v") ((builtins.stringLength pkgs.findutils.version) - 1));
     (builtins.genList (_: "_") (builtins.stringLength pkgs.findutils.version));


   diffutils-name = "diffuutils-" + builtins.concatStringsSep ""
   diffutils-name = "diffuutils" + builtins.concatStringsSep ""
     (builtins.genList (_: "v") ((builtins.stringLength pkgs.diffutils.version) - 1));
     (builtins.genList (_: "_") (builtins.stringLength pkgs.diffutils.version));
in
in
{
{
Line 94: Line 98:
}|name=/etc/nixos/configuration.nix|lang=nix}}
}|name=/etc/nixos/configuration.nix|lang=nix}}


It should be noted that this is of course still quite a hacky solution, as the name of the resulting binaries will simply be padded with the char 'v'. A better solution might be found in the future.
This is of course still quite a hacky solution, as the name of the resulting binaries will simply be padded with the char '_'. A better solution might be found in the future.


<small>For details, see [https://discourse.nixos.org/t/how-to-use-uutils-coreutils-instead-of-the-builtin-coreutils/8904/36?u=malix NixOS - Discourse: "How to use uutils-coreutils instead of the builtin coreutils?" (8904) - Comment 36]</small>}}
<small>For details, see [https://discourse.nixos.org/t/how-to-use-uutils-coreutils-instead-of-the-builtin-coreutils/8904/36?u=malix NixOS - Discourse: "How to use uutils-coreutils instead of the builtin coreutils?" (8904) - Comment 36]</small>}}