on master help sign in
nix-bundle/flake.nix
26 lines 848 B history raw
1{
2 description = "The purely functional package manager";
4 inputs.nixpkgs.url = "nixpkgs/nixos-20.03-small";
6 outputs = { self, nixpkgs }: let
7 systems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
8 forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
9 in {
10 bundlers = {
11 nix-bundle = { program, system }: let
12 nixpkgs' = nixpkgs.legacyPackages.${system};
13 nix-bundle = import self { nixpkgs = nixpkgs'; };
14 script = nixpkgs'.writeScript "startup" ''
15 #!/bin/sh
16 .${nix-bundle.nix-user-chroot}/bin/nix-user-chroot -n ./nix -- ${program} "$@"
17 '';
18 in nix-bundle.makebootstrap {
19 targets = [ script ];
20 startup = ".${builtins.unsafeDiscardStringContext script} '\"$@\"'";
21 };
22 };
24 defaultBundler = self.bundlers.nix-bundle;
25 };