flake.nix (1747B)
1 { 2 description = "purr - a web application for generating and sharing secrets "; 3 4 inputs = { 5 nixpkgs.url = "github:NixOS/nixpkgs"; 6 flake-utils.url = "github:numtide/flake-utils"; 7 }; 8 9 outputs = { self, nixpkgs, flake-utils }: 10 flake-utils.lib.eachDefaultSystem (system: 11 let 12 pkgs = nixpkgs.legacyPackages.${system}; 13 packageName = "purr"; 14 containerPackageName = "${packageName}-container"; 15 16 haskellPackages = pkgs.haskellPackages; 17 18 enableSharedExecutables = false; 19 enableSharedLibraries = false; 20 21 purr = pkgs.haskell.lib.justStaticExecutables self.packages.${system}.default; 22 in { 23 24 packages.${packageName} = 25 haskellPackages.callCabal2nix packageName self rec {}; 26 27 packages.default = self.packages.${system}.${packageName}; 28 defaultPackage = self.packages.${system}.default; 29 30 devShells.default = pkgs.mkShell { 31 buildInputs = with pkgs; [ 32 ghcid 33 cabal-install 34 ghc 35 ]; 36 inputsFrom = builtins.attrValues self.packages.${system}; 37 }; 38 devShell = self.devShells.${system}.default; 39 40 packages.${containerPackageName} = pkgs.dockerTools.buildImage { 41 name = "purr"; 42 43 copyToRoot = pkgs.buildEnv { 44 name = "image-root"; 45 paths = [ purr ]; 46 pathsToLink = [ "/bin" ]; 47 }; 48 tag = "latest"; 49 config = { 50 Cmd = [ 51 "/bin/Purr" 52 ]; 53 WorkingDir = "/app"; 54 ExposedPorts = { 55 "3000/tcp" = {}; 56 }; 57 extraCommands = '' 58 ''; 59 }; 60 }; 61 }); 62 }