55 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  inputs = {
 | 
						|
    nixpkgs.url = "github:nixos/nixpkgs/23.11";
 | 
						|
    haskell-flake.url = "github:srid/haskell-flake";
 | 
						|
    parts.url = "github:hercules-ci/flake-parts";
 | 
						|
  };
 | 
						|
  outputs = inputs@{ self, nixpkgs, parts, ... }:
 | 
						|
    let
 | 
						|
      packageName = "sampu";
 | 
						|
      containerPackageName = "${packageName}-container";
 | 
						|
    in
 | 
						|
    parts.lib.mkFlake { inherit inputs; } {
 | 
						|
      systems = nixpkgs.lib.systems.flakeExposed;
 | 
						|
      imports = [ inputs.haskell-flake.flakeModule ];
 | 
						|
 | 
						|
      perSystem = { self', pkgs, ... }: {
 | 
						|
        haskellProjects.default = {
 | 
						|
          basePackages = pkgs.haskellPackages;
 | 
						|
          packages = {
 | 
						|
            http2.source = "3.0.3";
 | 
						|
          };
 | 
						|
          devShell = {
 | 
						|
           enable = true;
 | 
						|
           tools = hp: { fourmolu = hp.fourmolu; };
 | 
						|
           hlsCheck.enable = true;
 | 
						|
          };
 | 
						|
        };
 | 
						|
 | 
						|
        packages.${containerPackageName} = pkgs.dockerTools.buildImage {
 | 
						|
          name = packageName;
 | 
						|
 | 
						|
          copyToRoot = pkgs.buildEnv {
 | 
						|
            name = "image-root";
 | 
						|
            paths = [ (pkgs.haskell.lib.justStaticExecutables self'.packages.sampu) ];
 | 
						|
            pathsToLink = [ "/bin" ];
 | 
						|
          };
 | 
						|
          tag = "latest";
 | 
						|
          config = {
 | 
						|
            Cmd = [
 | 
						|
              "/bin/sampu"
 | 
						|
            ];
 | 
						|
            WorkingDir = "/app";
 | 
						|
            ExposedPorts = {
 | 
						|
              "3000/tcp" = {};
 | 
						|
            };
 | 
						|
            extraCommands = ''
 | 
						|
            '';
 | 
						|
          };
 | 
						|
        };
 | 
						|
 | 
						|
        packages.default = self'.packages.sampu;
 | 
						|
      };
 | 
						|
    };
 | 
						|
}
 |