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
|
@ -3,6 +3,7 @@
|
|||
ears-cli = pkgs.callPackage ./ears-cli.nix { };
|
||||
hexagon = pkgs.callPackage ./hexagon.nix { };
|
||||
mcaselector = pkgs.callPackage ./mcaselector.nix { };
|
||||
mkSymlinks = pkgs.callPackage ./mk-symlinks.nix { };
|
||||
neocities = pkgs.callPackage ./neocities { };
|
||||
nix-modrinth-prefetch = pkgs.callPackage ./nix-modrinth-prefetch.nix { };
|
||||
olympus = pkgs.callPackage ./olympus.nix { };
|
||||
|
|
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