purr

password generation and secret sharing
Log | Files | Refs | README | LICENSE

commit e95f9e4433a8f1fef7dfe2355ad05df49e07a1a7
parent ed2ebc91b859cf7fdaa58720b3cbd09d07b00f02
Author: James Eversole <james@eversole.co>
Date:   Tue,  2 May 2023 18:35:04 -0500

Flakeify repository and remove Stack

Diffstat:
M.gitignore | 1+
DPurr.cabal | 110-------------------------------------------------------------------------------
Dbuild-docker | 13-------------
Aflake.lock | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.nix | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apurr.cabal | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dstack.yaml | 27---------------------------
Dstack.yaml.lock | 20--------------------
8 files changed, 225 insertions(+), 170 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,5 +1,6 @@ data/ bin/ +/result /config.dhall /Dockerfile /docker-stack.yml diff --git a/Purr.cabal b/Purr.cabal @@ -1,110 +0,0 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.34.4. --- --- see: https://github.com/sol/hpack - -name: Purr -version: 0.3.0 -description: https://git.eversole.co/James/Purr -author: James Eversole -maintainer: james@eversole.co -copyright: 2022 James Eversole -license: ISC -license-file: LICENSE -build-type: Simple -extra-source-files: - README - ChangeLog.md - -library - exposed-modules: - Core.Configuration - Core.HTTP - Core.SQLite - Core.Templates - Core.Types - Feature.Generation.HTTP - Feature.Generation.Links - Feature.Generation.Passwords - Feature.Generation.Shared - Feature.Generation.Templates - Feature.Sharing.HTTP - Feature.Sharing.SQLite - Feature.Sharing.Templates - Lib - other-modules: - Paths_Purr - hs-source-dirs: - src - default-extensions: - ConstraintKinds - DeriveGeneric - FlexibleContexts - FlexibleInstances - GeneralizedNewtypeDeriving - OverloadedStrings - ScopedTypeVariables - build-depends: - base >=4.7 - , base64-bytestring >=1.2.0.0 - , blaze-html >=0.9.1.0 - , bytestring >=0.10.12.1 - , containers >=0.6.4.1 - , crypto-simple >=0.1.0.0 - , dhall >=1.40 && <1.41.2 - , file-embed ==0.0.15.0 - , http-types >=0.12.3 - , iso8601-time >=0.1.5 - , mtl >=2.2.2 - , random >=1.2 - , scotty ==0.12 - , shakespeare >=2.0.20 - , split >=0.2.3.4 - , sqlite-simple >=0.4.18.0 - , text >=1.2.5.0 - , time >=1.9 - , utf8-string ==1.0.2 - , wai-extra >=3.1.12.1 - , wai-middleware-static >=0.5 - default-language: Haskell2010 - -executable Purr-musl - main-is: Main.hs - other-modules: - Paths_Purr - hs-source-dirs: - app - default-extensions: - ConstraintKinds - DeriveGeneric - FlexibleContexts - FlexibleInstances - GeneralizedNewtypeDeriving - OverloadedStrings - ScopedTypeVariables - ghc-options: -threaded -rtsopts -with-rtsopts=-N -static -optl-static -optl-pthread -fPIC - build-depends: - Purr - , base >=4.7 - , base64-bytestring >=1.2.0.0 - , blaze-html >=0.9.1.0 - , bytestring >=0.10.12.1 - , containers >=0.6.4.1 - , crypto-simple >=0.1.0.0 - , dhall >=1.40 && <1.41.2 - , file-embed ==0.0.15.0 - , http-types >=0.12.3 - , iso8601-time >=0.1.5 - , mtl >=2.2.2 - , random >=1.2 - , scotty ==0.12 - , shakespeare >=2.0.20 - , split >=0.2.3.4 - , sqlite-simple >=0.4.18.0 - , text >=1.2.5.0 - , time >=1.9 - , utf8-string ==1.0.2 - , wai-extra >=3.1.12.1 - , wai-middleware-static >=0.5 - default-language: Haskell2010 diff --git a/build-docker b/build-docker @@ -1,13 +0,0 @@ -#!/bin/bash -set -e -# Date: 12/27/2022 -# Author: James Eversole -# ISC License -# This script completes a stack build and then builds a docker image -# containing Purr. The image name is the first argument to the script. - -IMAGE_NAME=${1:-"purr"} - -stack setup -stack build --copy-bins -docker build . -t $IMAGE_NAME diff --git a/flake.lock b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1683067191, + "narHash": "sha256-41nOQDiYytmT6YVfI+X/Qo+rfIJOSuQ7OTAANAFp82o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a002cddf22e5f6c59c5cdeece1285c7ae9236d7d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix @@ -0,0 +1,58 @@ +{ + 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 }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + haskellPackages = pkgs.haskellPackages; + + jailbreakUnbreak = pkg: + pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; })); + + packageName = "purr"; + in { + packages.${packageName} = + haskellPackages.callCabal2nix packageName self rec { + crypto-simple = + pkgs.haskell.lib.dontCheck haskellPackages.crypto-simple; + }; + + packages.default = self.packages.${system}.${packageName}; + defaultPackage = self.packages.${system}.default; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + ghcid + cabal-install + ]; + inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system}); + }; + devShell = self.devShells.${system}.default; + packages.purrImage = pkgs.dockerTools.buildImage { + name = "purr"; + copyToRoot = pkgs.buildEnv { + name = "image-root"; + paths = [ self.packages.${system}.default ]; + pathsToLink = [ "/bin" ]; + }; + tag = "latest"; + config = { + Cmd = [ + "/bin/Purr-musl" + ]; + ExposedPorts = { + "3000/tcp" = {}; + }; + extraCommands = '' + ''; + }; + }; + }); +} diff --git a/purr.cabal b/purr.cabal @@ -0,0 +1,106 @@ +cabal-version: 1.12 + +name: purr +version: 0.3.0 +description: https://git.eversole.co/purr +author: James Eversole +maintainer: james@eversole.co +copyright: 2022 James Eversole +license: ISC +license-file: LICENSE +build-type: Simple +extra-source-files: + README + ChangeLog.md + +library + exposed-modules: + Core.Configuration + Core.HTTP + Core.SQLite + Core.Templates + Core.Types + Feature.Generation.HTTP + Feature.Generation.Links + Feature.Generation.Passwords + Feature.Generation.Shared + Feature.Generation.Templates + Feature.Sharing.HTTP + Feature.Sharing.SQLite + Feature.Sharing.Templates + Lib + other-modules: + Paths_Purr + hs-source-dirs: + src + default-extensions: + ConstraintKinds + DeriveGeneric + FlexibleContexts + FlexibleInstances + GeneralizedNewtypeDeriving + OverloadedStrings + ScopedTypeVariables + build-depends: + base >=4.7 + , base64-bytestring >=1.2.0.0 + , blaze-html >=0.9.1.0 + , bytestring >=0.10.12.1 + , containers >=0.6.4.1 + , crypto-simple >=0.1.0.0 + , dhall >=1.40 + , file-embed ==0.0.15.0 + , http-types >=0.12.3 + , iso8601-time >=0.1.5 + , mtl >=2.2.2 + , random >=1.2 + , scotty >=0.12 + , shakespeare >=2.0.20 + , split >=0.2.3.4 + , sqlite-simple >=0.4.18.0 + , text >=1.2.5.0 + , time >=1.9 + , utf8-string ==1.0.2 + , wai-extra >=3.1.12.1 + , wai-middleware-static >=0.5 + default-language: Haskell2010 + +executable Purr-musl + main-is: Main.hs + other-modules: + Paths_Purr + hs-source-dirs: + app + default-extensions: + ConstraintKinds + DeriveGeneric + FlexibleContexts + FlexibleInstances + GeneralizedNewtypeDeriving + OverloadedStrings + ScopedTypeVariables + ghc-options: -threaded -rtsopts -with-rtsopts=-N -optl-pthread -fPIC + build-depends: + Purr + , base >=4.7 + , base64-bytestring >=1.2.0.0 + , blaze-html >=0.9.1.0 + , bytestring >=0.10.12.1 + , containers >=0.6.4.1 + , crypto-simple >=0.1.0.0 + , dhall >=1.40 + , file-embed ==0.0.15.0 + , http-types >=0.12.3 + , iso8601-time >=0.1.5 + , mtl >=2.2.2 + , random >=1.2 + , scotty >=0.12 + , shakespeare >=2.0.20 + , split >=0.2.3.4 + , sqlite-simple >=0.4.18.0 + , text >=1.2.5.0 + , time >=1.9 + , utf8-string ==1.0.2 + , wai-extra >=3.1.12.1 + , wai-middleware-static >=0.5 + default-language: Haskell2010 diff --git a/stack.yaml b/stack.yaml @@ -1,27 +0,0 @@ -# This file was automatically generated by 'stack init' -# -resolver: - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/13.yaml - -# User packages to be built. -packages: -- . -# -extra-deps: -- crypto-simple-0.1.0.0@sha256:5c0e1e04a814d903743d7543245951a91a46817230fdf478fadca57116805fc1,1502 - -docker: - enable: true - image: "utdemir/ghc-musl:v24-ghc902" - -local-bin-path: - ./bin -#ghc-options: - -# Require a specific version of stack, using version ranges -# require-stack-version: -any # Default -# require-stack-version: ">=2.7" -# -# Override the architecture used by stack, especially useful on Windows -# arch: i386 -# arch: x86_64 diff --git a/stack.yaml.lock b/stack.yaml.lock @@ -1,20 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - hackage: crypto-simple-0.1.0.0@sha256:5c0e1e04a814d903743d7543245951a91a46817230fdf478fadca57116805fc1,1502 - pantry-tree: - size: 472 - sha256: 66c4ac2c2ddb74d31370026799a44fa78dc3b64d82cec0a1bc87b30e816195a4 - original: - hackage: crypto-simple-0.1.0.0@sha256:5c0e1e04a814d903743d7543245951a91a46817230fdf478fadca57116805fc1,1502 -snapshots: -- completed: - size: 618740 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/13.yaml - sha256: ef98d70e4018bf01feb00ccdcd33ab26d056dbb71b38057c78fdd0d1ec671c85 - original: - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/13.yaml