diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e0b180..b906a0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,3 +43,7 @@ jobs: # continue-on-error: true - run: nix build + + # To get image and layered image into binary cache + - run: nix build .#image + - run: nix build .#layeredImage diff --git a/flake.nix b/flake.nix index 26d5837..5b2472d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "LiveBeats"; + description = "Play music together with Phoenix LiveView!"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; @@ -11,12 +11,33 @@ let # pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs { inherit system; }; + imagePkgs = import nixpkgs { system = "x86_64-linux"; }; in rec { packages = { live-beats = pkgs.callPackage ./pkgs/live-beats { inherit pkgs self; }; default = packages.live-beats; + + image = pkgs.dockerTools.buildImage { + name = "hello"; + tag = "latest"; + created = "now"; + copyToRoot = pkgs.buildEnv { + name = "image-root"; + paths = [ pkgs.hello ]; + pathsToLink = [ "/bin" ]; + }; + + config.Cmd = [ "/bin/hello" ]; + }; + + layeredImage = pkgs.dockerTools.buildLayeredImage { + name = "hello"; + config = { + Cmd = [ "${pkgs.hello}/bin/hello" ]; + }; + }; }; @@ -25,6 +46,7 @@ dev = import ./pkgs/dev-shell { inherit pkgs; + inputsFrom = [ packages.live-beats ]; db_name = "db_dev"; # MIX_ENV = "dev"; };