aboutsummaryrefslogtreecommitdiff
path: root/tests/flake-bundler.sh
blob: 699920f60944e3e5dba252b2185d639b327d0c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
source common.sh

clearStore
rm -rf $TEST_HOME/.cache $TEST_HOME/.config $TEST_HOME/.local

cp ./simple.nix ./simple.builder.sh ./config.nix $TEST_HOME

cd $TEST_HOME

cat <<EOF > flake.nix
{
    outputs = {self}: {
       bundlers.$system.simple = drv:
          if drv?type && drv.type == "derivation"
          then drv
          else self.defaultPackage.$system;
       defaultBundler.$system = self.bundlers.$system.simple;
       defaultPackage.$system = import ./simple.nix;
       defaultApp.$system = {
         type = "app";
         program = "\${import ./simple.nix}/hello";
       };
    };
}
EOF
nix build .#
nix bundle --bundler .# .#
nix bundle --bundler .#defaultBundler.$system  .#defaultPackage.$system
nix bundle --bundler .#bundlers.$system.simple .#defaultPackage.$system

nix bundle --bundler .#defaultBundler.$system  .#defaultApp.$system
nix bundle --bundler .#bundlers.$system.simple .#defaultApp.$system

clearStore