mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-08-16 02:10:42 +03:00
Add flake.nix
This commit is contained in:
parent
5caec2e85a
commit
1bffaa07f3
27
flake.nix
Normal file
27
flake.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
description = "The purely functional package manager";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-20.03-small";
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
||||
in {
|
||||
exporters = forAllSystems (system: let
|
||||
nixpkgs' = nixpkgs.legacyPackages.${system};
|
||||
nix-bundle = import self { nixpkgs = nixpkgs'; };
|
||||
in {
|
||||
nix-bundle = { program }: let
|
||||
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} '\"$@\"'";
|
||||
};
|
||||
});
|
||||
|
||||
defaultExporter = forAllSystems (system: self.exporters.${system}.nix-bundle);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user