Uutils: Difference between revisions

No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 34: Line 34:
[https://search.nixos.org/packages?show=uutils-diffutils Nixpkgs - <code>uutils-diffutils</code>]
[https://search.nixos.org/packages?show=uutils-diffutils Nixpkgs - <code>uutils-diffutils</code>]


=== 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. 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 94:
}|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.
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 '_'. 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>}}