mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-10-05 19:17:16 +03:00
27 lines
848 B
Nix
27 lines
848 B
Nix
{
|
|
description = "The purely functional package manager";
|
|
|
|
inputs.nixpkgs.url = "nixpkgs/nixos-20.03-small";
|
|
|
|
outputs = { self, nixpkgs }: let
|
|
systems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
|
in {
|
|
bundlers = {
|
|
nix-bundle = { program, system }: let
|
|
nixpkgs' = nixpkgs.legacyPackages.${system};
|
|
nix-bundle = import self { nixpkgs = nixpkgs'; };
|
|
script = nixpkgs'.writeScript "startup" ''
|
|
#!/bin/sh
|
|
.${nix-bundle.nix-user-chroot}/bin/nix-user-chroot -n ./nix -- ${program} "$@"
|
|
'';
|
|
in nix-bundle.makebootstrap {
|
|
targets = [ script ];
|
|
startup = ".${builtins.unsafeDiscardStringContext script} '\"$@\"'";
|
|
};
|
|
};
|
|
|
|
defaultBundler = self.bundlers.nix-bundle;
|
|
};
|
|
}
|