purr/flake.nix

63 lines
1.7 KiB
Nix
Raw Normal View History

2023-05-02 18:35:04 -05:00
{
description = "purr - a web application for generating and sharing secrets ";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
2023-05-02 18:35:04 -05:00
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
packageName = "purr";
2024-02-17 08:34:26 -06:00
containerPackageName = "${packageName}-container";
2023-05-02 18:35:04 -05:00
haskellPackages = pkgs.haskellPackages;
enableSharedExecutables = false;
enableSharedLibraries = false;
purr = pkgs.haskell.lib.justStaticExecutables self.packages.${system}.default;
2023-05-02 18:35:04 -05:00
in {
2023-05-02 18:35:04 -05:00
packages.${packageName} =
haskellPackages.callCabal2nix packageName self rec {};
2023-05-02 18:35:04 -05:00
packages.default = self.packages.${system}.${packageName};
defaultPackage = self.packages.${system}.default;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
ghcid
cabal-install
ghc
2023-05-02 18:35:04 -05:00
];
inputsFrom = builtins.attrValues self.packages.${system};
2023-05-02 18:35:04 -05:00
};
devShell = self.devShells.${system}.default;
2024-02-17 08:34:26 -06:00
packages.${containerPackageName} = pkgs.dockerTools.buildImage {
2023-05-02 18:35:04 -05:00
name = "purr";
2023-05-02 18:35:04 -05:00
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ purr ];
2023-05-02 18:35:04 -05:00
pathsToLink = [ "/bin" ];
};
tag = "latest";
config = {
Cmd = [
"/bin/Purr"
2023-05-02 18:35:04 -05:00
];
2024-02-17 08:34:26 -06:00
WorkingDir = "/app";
2023-05-02 18:35:04 -05:00
ExposedPorts = {
"3000/tcp" = {};
};
extraCommands = ''
'';
};
};
});
}