Initial commit

This commit is contained in:
Mats Rauhala 2023-02-12 14:19:45 +02:00
commit ca7bf79c7d
17 changed files with 465 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.direnv
.envrc
dist-newstyle

5
CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
# Revision history for image_backup
## 0.1.0.0 -- YYYY-mm-dd
* First version. Released on an unsuspecting world.

30
LICENSE Normal file
View File

@ -0,0 +1,30 @@
Copyright (c) 2023, Mats Rauhala
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Mats Rauhala nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

8
app/Main.hs Normal file
View File

@ -0,0 +1,8 @@
module Main where
import qualified MyLib (someFunc)
main :: IO ()
main = do
putStrLn "Hello, Haskell!"
MyLib.someFunc

19
default.nix Normal file
View File

@ -0,0 +1,19 @@
{ mkDerivation, amazonka, amazonka-s3, base, bytestring, conduit
, cryptonite, directory, ekg-core, filepath, lib, mtl, servant
, servant-server, sqlite-simple, text
}:
mkDerivation {
pname = "image-backup";
version = "0.1.0.0";
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
amazonka amazonka-s3 base bytestring conduit cryptonite directory
ekg-core filepath mtl servant servant-server sqlite-simple text
];
executableHaskellDepends = [ base ];
testHaskellDepends = [ base ];
license = lib.licenses.bsd3;
mainProgram = "image-backup";
}

41
flake.lock Normal file
View File

@ -0,0 +1,41 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1675940568,
"narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6ccc4a59c3f1b56d039d93da52696633e641bc71",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@ -0,0 +1,46 @@
{
description = "A very basic flake";
inputs = {
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem ["x86_64-linux" "x86_64-darwin"] (system:
let pkgs = nixpkgs.legacyPackages.${system};
hp = nixpkgs.legacyPackages.${system}.haskellPackages.override (old: {
overrides = pkgs.lib.composeExtensions (old.overrides or (_: _: {})) (f: p: rec {
image-backup = f.callPackage ./. {};
# Need to update amazonka...
amazonka-core = f.callPackage nix/amazonka-core.nix {};
amazonka-s3 = f.callPackage nix/amazonka-s3.nix {};
amazonka-test = f.callPackage nix/amazonka-test.nix {};
amazonka = f.callPackage nix/amazonka.nix {};
amazonka-sso = f.callPackage nix/amazonka-sso.nix {};
amazonka-sts = f.callPackage nix/amazonka-sts.nix {};
});
});
in {
devShell = hp.shellFor {
packages = h: [h.image-backup];
withHoogle = false;
buildInputs = with pkgs; [
cabal-install
hp.hlint
stylish-haskell
ghcid
sqlite-interactive
hp.graphmod
hp.haskell-language-server
];
};
}
);
}

141
image-backup.cabal Normal file
View File

@ -0,0 +1,141 @@
cabal-version: 3.0
-- The cabal-version field refers to the version of the .cabal specification,
-- and can be different from the cabal-install (the tool) version and the
-- Cabal (the library) version you are using. As such, the Cabal (the library)
-- version used must be equal or greater than the version stated in this field.
-- Starting from the specification version 2.2, the cabal-version field must be
-- the first thing in the cabal file.
-- Initial package description 'image-backup' generated by
-- 'cabal init'. For further documentation, see:
-- http://haskell.org/cabal/users-guide/
--
-- The name of the package.
name: image-backup
-- The package version.
-- See the Haskell package versioning policy (PVP) for standards
-- guiding when and how versions should be incremented.
-- https://pvp.haskell.org
-- PVP summary: +-+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
version: 0.1.0.0
-- A short (one-line) description of the package.
-- synopsis:
-- A longer description of the package.
-- description:
-- The license under which the package is released.
license: BSD-3-Clause
-- The file containing the license text.
license-file: LICENSE
-- The package author(s).
author: Mats Rauhala
-- An email address to which users can send suggestions, bug reports, and patches.
maintainer: mats.rauhala@iki.fi
-- A copyright notice.
-- copyright:
category: Web
build-type: Simple
-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.
extra-doc-files: CHANGELOG.md
-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
-- extra-source-files:
common warnings
ghc-options: -Wall
library
-- Import common warning flags.
import: warnings
-- Modules exported by the library.
exposed-modules: MyLib
-- Modules included in this library but not exported.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
-- Other library packages from which modules are imported.
build-depends: base ^>=4.16.3.0
, sqlite-simple
, amazonka
, amazonka-s3
, ekg-core
, servant
, servant-server
, cryptonite
, conduit
, filepath
, directory
, bytestring
, text
, mtl
-- Directories containing source files.
hs-source-dirs: src
-- Base language which the package is written in.
default-language: Haskell2010
executable image-backup
-- Import common warning flags.
import: warnings
-- .hs or .lhs file containing the Main module.
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
-- Other library packages from which modules are imported.
build-depends:
base ^>=4.16.3.0,
image-backup
-- Directories containing source files.
hs-source-dirs: app
-- Base language which the package is written in.
default-language: Haskell2010
test-suite image-backup-test
-- Import common warning flags.
import: warnings
-- Base language which the package is written in.
default-language: Haskell2010
-- Modules included in this executable, other than Main.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
-- The interface type and version of the test suite.
type: exitcode-stdio-1.0
-- Directories containing source files.
hs-source-dirs: test
-- The entrypoint to the test suite.
main-is: Main.hs
-- Test dependencies.
build-depends:
base ^>=4.16.3.0,
image-backup

34
nix/amazonka-core.nix Normal file
View File

@ -0,0 +1,34 @@
{ mkDerivation, aeson, attoparsec, base, bytestring
, case-insensitive, conduit, conduit-extra, containers, cryptonite
, data-ordlist, deepseq, fetchgit, hashable, http-client
, http-conduit, http-types, lens, lib, memory, QuickCheck
, quickcheck-unicode, regex-posix, resourcet, scientific, tasty
, tasty-hunit, tasty-quickcheck, template-haskell, text, time
, transformers, unordered-containers, xml-conduit, xml-types
}:
mkDerivation {
pname = "amazonka-core";
version = "2.0";
src = fetchgit {
url = "https://github.com/brendanhay/amazonka.git";
sha256 = "1wq0wyk6mgrcx3jr6js7s1y80bz8d8sv81p1b4k5wjwf17yv6rk6";
rev = "f610f8c95e190edf86606c5f86485d198671beb0";
fetchSubmodules = true;
};
postUnpack = "sourceRoot+=/lib/amazonka-core; echo source root reset to $sourceRoot";
libraryHaskellDepends = [
aeson attoparsec base bytestring case-insensitive conduit
conduit-extra containers cryptonite deepseq hashable http-client
http-conduit http-types lens memory regex-posix resourcet
scientific text time transformers unordered-containers xml-conduit
xml-types
];
testHaskellDepends = [
aeson base bytestring case-insensitive conduit data-ordlist
http-conduit http-types QuickCheck quickcheck-unicode tasty
tasty-hunit tasty-quickcheck template-haskell text time
];
homepage = "https://github.com/brendanhay/amazonka";
description = "Core data types and functionality for Amazonka libraries";
license = lib.licenses.mpl20;
}

23
nix/amazonka-s3.nix Normal file
View File

@ -0,0 +1,23 @@
{ mkDerivation, amazonka-core, amazonka-test, base, bytestring
, case-insensitive, fetchgit, lens, lib, tasty, tasty-hunit, text
, time, unordered-containers
}:
mkDerivation {
pname = "amazonka-s3";
version = "2.0";
src = fetchgit {
url = "https://github.com/brendanhay/amazonka.git";
sha256 = "1wq0wyk6mgrcx3jr6js7s1y80bz8d8sv81p1b4k5wjwf17yv6rk6";
rev = "f610f8c95e190edf86606c5f86485d198671beb0";
fetchSubmodules = true;
};
postUnpack = "sourceRoot+=/lib/services/amazonka-s3; echo source root reset to $sourceRoot";
libraryHaskellDepends = [ amazonka-core base lens text ];
testHaskellDepends = [
amazonka-core amazonka-test base bytestring case-insensitive tasty
tasty-hunit text time unordered-containers
];
homepage = "https://github.com/brendanhay/amazonka";
description = "Amazon Simple Storage Service SDK";
license = lib.licenses.mpl20;
}

23
nix/amazonka-sso.nix Normal file
View File

@ -0,0 +1,23 @@
{ mkDerivation, amazonka-core, amazonka-test, base, bytestring
, case-insensitive, fetchgit, lib, tasty, tasty-hunit, text, time
, unordered-containers
}:
mkDerivation {
pname = "amazonka-sso";
version = "2.0";
src = fetchgit {
url = "https://github.com/brendanhay/amazonka.git";
sha256 = "1wq0wyk6mgrcx3jr6js7s1y80bz8d8sv81p1b4k5wjwf17yv6rk6";
rev = "f610f8c95e190edf86606c5f86485d198671beb0";
fetchSubmodules = true;
};
postUnpack = "sourceRoot+=/lib/services/amazonka-sso; echo source root reset to $sourceRoot";
libraryHaskellDepends = [ amazonka-core base ];
testHaskellDepends = [
amazonka-core amazonka-test base bytestring case-insensitive tasty
tasty-hunit text time unordered-containers
];
homepage = "https://github.com/brendanhay/amazonka";
description = "Amazon Single Sign-On SDK";
license = lib.licenses.mpl20;
}

23
nix/amazonka-sts.nix Normal file
View File

@ -0,0 +1,23 @@
{ mkDerivation, amazonka-core, amazonka-test, base, bytestring
, case-insensitive, fetchgit, lib, tasty, tasty-hunit, text, time
, unordered-containers
}:
mkDerivation {
pname = "amazonka-sts";
version = "2.0";
src = fetchgit {
url = "https://github.com/brendanhay/amazonka.git";
sha256 = "1wq0wyk6mgrcx3jr6js7s1y80bz8d8sv81p1b4k5wjwf17yv6rk6";
rev = "f610f8c95e190edf86606c5f86485d198671beb0";
fetchSubmodules = true;
};
postUnpack = "sourceRoot+=/lib/services/amazonka-sts; echo source root reset to $sourceRoot";
libraryHaskellDepends = [ amazonka-core base ];
testHaskellDepends = [
amazonka-core amazonka-test base bytestring case-insensitive tasty
tasty-hunit text time unordered-containers
];
homepage = "https://github.com/brendanhay/amazonka";
description = "Amazon Security Token Service SDK";
license = lib.licenses.mpl20;
}

26
nix/amazonka-test.nix Normal file
View File

@ -0,0 +1,26 @@
{ mkDerivation, aeson, amazonka-core, base, bifunctors, bytestring
, case-insensitive, conduit, conduit-extra, fetchgit, groom
, http-client, http-types, lib, process, resourcet, tasty
, tasty-hunit, template-haskell, temporary, text, time
, unordered-containers, yaml
}:
mkDerivation {
pname = "amazonka-test";
version = "2.0";
src = fetchgit {
url = "https://github.com/brendanhay/amazonka.git";
sha256 = "1wq0wyk6mgrcx3jr6js7s1y80bz8d8sv81p1b4k5wjwf17yv6rk6";
rev = "f610f8c95e190edf86606c5f86485d198671beb0";
fetchSubmodules = true;
};
postUnpack = "sourceRoot+=/lib/amazonka-test; echo source root reset to $sourceRoot";
libraryHaskellDepends = [
aeson amazonka-core base bifunctors bytestring case-insensitive
conduit conduit-extra groom http-client http-types process
resourcet tasty tasty-hunit template-haskell temporary text time
unordered-containers yaml
];
homepage = "https://github.com/brendanhay/amazonka";
description = "Common functionality for Amazonka library test-suites";
license = lib.licenses.mpl20;
}

25
nix/amazonka.nix Normal file
View File

@ -0,0 +1,25 @@
{ mkDerivation, aeson, amazonka-core, amazonka-sso, amazonka-sts
, base, bytestring, conduit, directory, exceptions, fetchgit
, http-client, http-conduit, http-types, ini, lens, lib, resourcet
, retry, text, time, transformers, unordered-containers, uuid
}:
mkDerivation {
pname = "amazonka";
version = "2.0";
src = fetchgit {
url = "https://github.com/brendanhay/amazonka.git";
sha256 = "1wq0wyk6mgrcx3jr6js7s1y80bz8d8sv81p1b4k5wjwf17yv6rk6";
rev = "f610f8c95e190edf86606c5f86485d198671beb0";
fetchSubmodules = true;
};
postUnpack = "sourceRoot+=/lib/amazonka; echo source root reset to $sourceRoot";
libraryHaskellDepends = [
aeson amazonka-core amazonka-sso amazonka-sts base bytestring
conduit directory exceptions http-client http-conduit http-types
ini lens resourcet retry text time transformers
unordered-containers uuid
];
homepage = "https://github.com/brendanhay/amazonka";
description = "Comprehensive Amazon Web Services SDK";
license = lib.licenses.mpl20;
}

4
src/MyLib.hs Normal file
View File

@ -0,0 +1,4 @@
module MyLib (someFunc) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"

4
test/Main.hs Normal file
View File

@ -0,0 +1,4 @@
module Main (main) where
main :: IO ()
main = putStrLn "Test suite not yet implemented."

10
update_amazonka.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
#
# Update to 2.0 version of amazonka
projects="lib/amazonka-test lib/amazonka-core lib/services/amazonka-s3 lib/amazonka lib/services/amazonka-sso lib/services/amazonka-sts"
for project in $projects; do
nix run nixpkgs#cabal2nix -- https://github.com/brendanhay/amazonka.git --subpath $project > nix/$(basename $project).nix
done