pkgs/mkSymlinks: add method to create arbitrary symlinks
This commit is contained in:
parent
71ae9d9630
commit
b43b922e78
2 changed files with 24 additions and 0 deletions
23
pkgs/mk-symlinks.nix
Normal file
23
pkgs/mk-symlinks.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ lib, stdenv }:
|
||||
|
||||
{ name, symlinks }:
|
||||
let
|
||||
normalized = lib.mapAttrs' (n: v: lib.nameValuePair (lib.path.subpath.normalise n) "${v}") symlinks;
|
||||
linkCommands = lib.mapAttrsToList
|
||||
(n: v: ''
|
||||
mkdir -p $out/$(dirname ${n})
|
||||
ln -s ${v} $out/${n}
|
||||
'')
|
||||
normalized;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "firefox";
|
||||
phases = [ "installPhase" ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
|
||||
${lib.concatStringsSep "\n" linkCommands}
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue