diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..8252b041b8f0e9082af5a5576dfd39a5e338a503 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,44 @@ +# Use a template that makes pipelines run for the default branch, tags, and +# all types of merge request pipelines. +include: + - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' + +# The jobs all use the `nix` CLI so make sure we have it. +image: "nixos/nix:2.13.2" + +default: + # Choose a native Nix runner and we can use the local system's Nix store as + # our Nix cache. + tags: + - "nix" + +variables: + # Pick a nixpkgs to get cachix and bash from. Nothing else + # Turn on some `nix` CLI features that aren't on by default. + NIX_CONFIG: "experimental-features = nix-command flakes" + +# Run the standard Haskell linter over the library and test suite sources. +hlint: + script: >- + nix run .#hlint -- src/ test/ + +# Use cabal to build the library and test suite and then run the test suite. +cabal-build-and-test: + script: + - | + nix run .#cabal-test + +# Use nix to build the library and test suite and run the test suite. +nix-build-and-test: + script: >- + nix build + +# Force a build of the dev shell dependencies so we know they still work. +# Also, this populates the cache with the results which is a big win for every +# developer using our cache. +# +# We only have an x86_64-linux builder so we can't build the aarch64-darwin +# shell. Sorry... +nix-develop: + script: >- + nix build .#devShells.x86_64-linux.default diff --git a/flake.lock b/flake.lock index 83cd9614ddef677856e3cf0dba517a00a0dad145..9a56af92a1955255dc2752fc22846e0f07a89773 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -33,11 +33,11 @@ }, "flake-utils_2": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -71,17 +71,15 @@ "hs-flake-utils": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": [ - "nixpkgs" - ], + "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1673454489, - "narHash": "sha256-LsOintvQ4n3QPkI5MA+IhmlLlH5BVzL2xqT/h5U5K7w=", + "lastModified": 1681762240, + "narHash": "sha256-+PLx9xHBvV70dA7Gy/+YTH1w3PcSOrGV0z0rGxts8jU=", "ref": "main", - "rev": "4feccf13501960b92e1d9d73bf6e046b36861af0", - "revCount": 4, + "rev": "a51e591b7fdf8881ac0237452691df7b1aceecd3", + "revCount": 10, "type": "git", "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git" }, @@ -93,11 +91,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1670543317, - "narHash": "sha256-4mMR56rtxKr+Gwz399jFr4i76SQZxsLWxxyfQlPXRm0=", + "lastModified": 1677624842, + "narHash": "sha256-4DF9DbDuK4/+KYx0L6XcPBeDHUFVCtzok2fWtwXtb5w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19", + "rev": "d70f5cd5c3bef45f7f52698f39e7cc7a89daa7f0", "type": "github" }, "original": { @@ -109,16 +107,16 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1671271954, - "narHash": "sha256-cSvu+bnvN08sOlTBWbBrKaBHQZq8mvk8bgpt0ZJ2Snc=", + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d513b448cc2a6da2c8803e3c197c9fc7e67b19e3", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.05", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } @@ -138,11 +136,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1673281605, - "narHash": "sha256-v6U0G3pJe0YaIuD1Ijhz86EhTgbXZ4f/2By8sLqFk4c=", + "lastModified": 1677722096, + "narHash": "sha256-7mjVMvCs9InnrRybBfr5ohqcOz+pyEX8m22C1XsDilg=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "f8992fb404c7e79638192a10905b7ea985818050", + "rev": "61a3511668891c68ebd19d40122150b98dc2fe3b", "type": "github" }, "original": { @@ -155,7 +153,10 @@ "inputs": { "flake-utils": "flake-utils", "hs-flake-utils": "hs-flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "hs-flake-utils", + "nixpkgs" + ] } } }, diff --git a/flake.nix b/flake.nix index 9cd8d5a53ea95ed0630454613ec101fe73030616..b97bb3e0df73427c618811e9518e7c660801cb6e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,11 @@ { - description = "tahoe-lafs-immutable-uploader"; + description = "tahoe-capabilities"; inputs = { # Nix Inputs - nixpkgs.url = github:nixos/nixpkgs/?ref=nixos-22.11; + nixpkgs.follows = "hs-flake-utils/nixpkgs"; flake-utils.url = github:numtide/flake-utils; hs-flake-utils.url = "git+https://whetstone.private.storage/jcalderone/hs-flake-utils.git?ref=main"; - hs-flake-utils.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { @@ -18,15 +17,37 @@ ulib = flake-utils.lib; in ulib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let + pkgs = nixpkgs.legacyPackages.${system}; + ghcVersion = "ghc8107"; hslib = hs-flake-utils.lib { - pkgs = nixpkgs.legacyPackages.${system}; + inherit pkgs; src = ./.; - compilerVersion = "ghc8107"; + compilerVersion = ghcVersion; packageName = "tahoe-capabilities"; }; in { checks = hslib.checks {}; devShells = hslib.devShells {}; packages = hslib.packages {}; + + apps.hlint = hslib.apps.hlint {}; + + # Using the working directory of `nix run`, do a build with cabal and + # then run the test suite. + apps.cabal-test = { + type = "app"; + program = "${ + pkgs.writeShellApplication { + name = "cabal-build-and-test"; + runtimeInputs = with pkgs; [pkg-config haskell.compiler.${ghcVersion} cabal-install]; + + text = '' + cabal update hackage.haskell.org + cabal build all + cabal run tests + ''; + } + }/bin/cabal-build-and-test"; + }; }); } diff --git a/src/MyLib.hs b/src/MyLib.hs deleted file mode 100644 index e657c4403f66f966da13d2027bf595d9673387f6..0000000000000000000000000000000000000000 --- a/src/MyLib.hs +++ /dev/null @@ -1,4 +0,0 @@ -module MyLib (someFunc) where - -someFunc :: IO () -someFunc = putStrLn "someFunc" diff --git a/src/Tahoe/Capability.hs b/src/Tahoe/Capability.hs new file mode 100644 index 0000000000000000000000000000000000000000..d1393bb7da56111cd2d73c2b2eed8da37e02ec9f --- /dev/null +++ b/src/Tahoe/Capability.hs @@ -0,0 +1 @@ +module Tahoe.Capability where diff --git a/tahoe-capabilities.cabal b/tahoe-capabilities.cabal index 1d7d4424caf40c3e8998e5e04309a87a06589dab..d73684e9e72d67cbe4570d1239b7f7e2006bef39 100644 --- a/tahoe-capabilities.cabal +++ b/tahoe-capabilities.cabal @@ -64,7 +64,7 @@ library import: warnings -- Modules exported by the library. - exposed-modules: MyLib + exposed-modules: Tahoe.Capability -- Modules included in this library but not exported. -- other-modules: